Public Group

What is a timestep?

This topic is 1089 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I know this sounds like a silly question, but I am a bit perplexed at what a timestep is exactly. I have been reading a lot of physics articles, but they do not describe thorougly what they are. Is a timestep, the rate in which the game logic (excluding the rendering code) is updated?

Share on other sites

Physics simulation gives you snapshots of simulated system.

"Step" is a process of calculating system's next state. "Timestep" is the time interval for which simulation will progress during next "step".

Share on other sites

Timestep defines how small the time interval is inbetween physics simulations. In game engines this reflects how often functions() need be run.

Physics(simulations) uses mathematical models to predict the future. These simulations output the path between the present and the future, the models predict the direction towards the future while we calculate the path. How accurate the direction is depends on the models input value which is time. The lower the time value you give the model, the more steps in can take in total until the simulation reaches it's goal. This time value is also known as timestep or dt.

model(time, position) =  new_position

Share on other sites

Wow, thanks guys. Nice detailed responses, especially you Mathias Goldberg.

Just to be clear would you guys say that a timestep has two functions:

* To provide regular consistent update intervals for a physics simulation

* To provide as many steps as possible for accurate real world physics.

Share on other sites

To provide as many steps as possible for accurate real world physics.

This is usually limited by floating point precision problems.  So its not as many steps as possible its enough steps.

edit- well not really you'd need a minuscule timestep to encounter precision problems.

Edited by Infinisearch

Share on other sites

* To provide as many steps as necessary for accurate real world physics.

Fixed.
You should always use the largest (slowest) time step possible for a robust simulation. There is no need to run physics every millisecond unless you are in a super-high-end reflex racing game.
Once every 30-40 milliseconds is typically fine.
Fixed-Time-Step Implementation

L. Spiro

Share on other sites

One other thing youll likely come across, is that there are multiple methods of advancing from step n to step n+1 when approximating a seemingly continuous system with a discrete one.

In physics engines this 'method' is called the "integrator" - its job is to attempt and sum up all the changes between the nth and n+1th steps with minimal error and acceptable performance.

The most basic integrators make assumptions like "acceleration is constant" when for example calculating velocity (v1 = v0 + a0*dt) even if its known that its not. And so on. More complex ones use some carefully derived polynomials and whatnot to more closely capture the details.

The importance of these becomes apparent when working with feedback and little dampening - think springs, objects orbiting a planet, pendulums...

The tiniest error will easily accumulate due to the feedback and soon its all messed up (spring ends up with 10x more energy out of nowhere, orbiting object reaches escape velocity, the pendulum stops without there being any friction...)

You dont often think about an 'integrator' outside a physics simulation, but its still very relevant - without a proper one, changing the time step might change the behavior completely. So think about this every time you have some time dependent quantities, especially if they also depend on OTHER time dependent quantities. This is also why a variable time step it more difficult than a fixed one - you can completely ignore the issue with a fixed time step as long as it doesnt change (well, to the extent that the game will always behave the same, doesnt mean it behaves correct...).

Edited by Waterlimon

Share on other sites

Great responses.

Thanks everyone for the help.

1. 1
2. 2
Rutin
21
3. 3
4. 4
5. 5
A4L
14

• 13
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633736
• Total Posts
3013602
×