Time-Stepping

5 posts

Flag Post

1. How to do it (Correctly)
2. Why I should do it
3. Is it needed in Flash Games?

 
Flag Post

1) SetTimeout()

2) So lag doesn’t effect the play rate at which the game runs. Takes longer → fewer frames → doesn’t matter, as things move in “real time” anyway (distance moved is based on deltaTime).

3) Not really. Its more hassle than its worth.

 
Flag Post
Originally posted by Draco18s:

1) SetTimeout()

2) So lag doesn’t effect the play rate at which the game runs. Takes longer → fewer frames → doesn’t matter, as things move in “real time” anyway (distance moved is based on deltaTime).

3) Not really. Its more hassle than its worth.

Thanks.

 
Flag Post

Time stepping is easier in Unity, because you can make it frame based or time based without changing your code.

The function is still Update() and you can either use “position.x += speed” or “position.x += speed * Time.deltaTime”

Flash doesn’t have a built in “time since last update” counter, you have to make one.

 
Flag Post

By the way, don’t use setTimeout(). Use an ENTER_FRAME listener and calculate the time between frames.