36 ticks per second?

Discuss all aspects of editing for ZDoom.
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

36 ticks per second?

Postby Nightfall » Thu Jul 21, 2011 9:23 am

From ZDoom Wiki:
Note: Because of a loss of precision with integer division, the duration of a tic is of 28 milliseconds (instead of 28.5714287514...), which means that 35 tics actually make up only 0.98 seconds. There are therefore actually 35.7142857142857... tics in one second.


35.7142857142857 rounds into 36, though 35 seems to be generally used for seconds. What's going on?
User avatar
Nightfall
 
Joined: 06 Aug 2009
Location: Finland

Re: 36 ticks per second?

Postby FDARI » Thu Jul 21, 2011 5:53 pm

Maybe they rounded down, which is not all that unusual. Somebody may have consciously decided to set the standard at slightly less than a full second rather than slightly more, when the choice needed to be made.

My guess, though, is that somebody decided to have 35 ticks in a second, and found that the integers couldn't perfectly accomodate this. Given a goal of 35 ticks per second, and a reasonably good approximation in the engine, you might present it as 35 ticks per second, make a footnote about the specifics, and assume that nobody will ever have a real need to synchronize Doom with their watches.
User avatar
FDARI
Melbourne is actually pronounced Mel-Byn, as though it were a wizard.
 
Joined: 03 Nov 2009

Re: 36 ticks per second?

Postby Blzut3 » Thu Jul 21, 2011 6:21 pm

Code: Select allExpand view
// State updates, number of tics / second.
#define TICRATE       35

The reason for 35 probably stems from Wolfenstein running at 70hz and id deciding in order to accommodate for the increased graphical capabilities they would cut that in half. However, due to how computers work, the engine actually end up using 28ms a tic. This is really not important to the user and the note was merely a technicality previous discussion on the topic. 35 tics is, according to the game simulation, one second.
Blzut3
Pronounced: B-l-zut
 
Joined: 24 Nov 2004

Re: 36 ticks per second?

Postby Nightfall » Fri Jul 22, 2011 9:09 am

Hmm.. I suppose. Thanks.
User avatar
Nightfall
 
Joined: 06 Aug 2009
Location: Finland

Re: 36 ticks per second?

Postby randi » Fri Jul 22, 2011 2:54 pm

Blzut3 wrote:However, due to how computers work, the engine actually end up using 28ms a tic.

Actually, I doubt this. Doom (probably) used the vblank signal for timing. It ran at a 70 Hz resolution, so it ticked every other screen refresh and got exactly 35 FPS.
User avatar
randi
Site Admin
 
Joined: 09 Jul 2003

Re: 36 ticks per second?

Postby Blzut3 » Fri Jul 22, 2011 3:38 pm

randy wrote:Actually, I doubt this. Doom (probably) used the vblank signal for timing. It ran at a 70 Hz resolution, so it ticked every other screen refresh and got exactly 35 FPS.

Well outside of the first sentence explaining where 35 comes from, I was mostly speaking in terms of ZDoom. On Windows, the frame rate limiting events are fired every 1000/TICRATE milliseconds (35.714285714...fps). On Linux/Mac OS X the timer is in microseconds so we can fire them every 1000000/TICRATE microseconds (which when you account for the precision loss you get 35.0005250078...fps). This can easily be noticed since in Windows when using cl_capfps you fluctuate between 35 and 36fps where as on Linux you should get a solid 35.
Blzut3
Pronounced: B-l-zut
 
Joined: 24 Nov 2004


Return to Editing (Archive)

Who is online

Users browsing this forum: Google [Bot], Yandex [Bot] and 2 guests