How long is a tick?

How long is a tick?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

How long is a tick?

Post by Guessmyname »

For a rather time-sensitive script I'm doing.

How long is a tick? If my memory serves me correctly, a sleep [1000]; command in a script would make it wait for an exact second. Is that correct?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

NO! [] multiplies the value with 161200 or so, a sleep [1] would take forever to resolve. Sleep 1000 supposedly sleeps for 1000 milliseconds but I'm not sure if that's really accurate. In case it's not you can tell a part to turn by n at speed 1 (remember, <> multiplies by 182) and wait-for-turn.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

A tick is 1/30 second.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

So how long does a sleep 1000 wait, 1000 milliseconds or 1000 ticks?
User avatar
Bobcatben
Posts: 120
Joined: 10 Mar 2006, 17:01

Post by Bobcatben »

jcnossen wrote:A tick is 1/30 second.
hasn't seemed that way to me with my experimentation with groupai's
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

I thoughght it was something like 30/32 seconds per tic (0.9375 seconds a tic)... but I'm not sure either...
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

I thoughght it was something like 30/32 seconds per tic (0.9375 seconds a tic)... but I'm not sure either...
Well I am, it's 1/30 sec in game time.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

A second ingame is 30 frames. However the slowupdate is every 32 frames, which means some stuff is updated every 32 frames, for example the GUI resource stats, aka thats where caydrs magic number comes from (30/32)
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

Still, sleep doesn't have anything to do with SlowUpdate IIRC.. the cob interpreter is updated every tick.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

So, therefore, if you want something to move EXACTLY 1 unit over 5 ticks... then it needs to move 0.2 per tick, and 5 ticks will be almost exactly 0.1666666 seconds. The only problem with this is that if we want things to be exact times, we're going to have to settle for a lot've rounding, but the tiny difference in the end won't be noticable except under very long durations of time, and if everything is kept in strict lockstep... no big deal. The really hard part, as I've been finding lately, is how to keep everything in true lockstep.
User avatar
Molloy
Posts: 225
Joined: 05 Jan 2005, 22:05

Post by Molloy »

Post Reply

Return to “Engine”