• Advertisement
Sign in to follow this  

Handling time in a physics engine?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

When building a physics engine, how do we handle simulation time, how can it be controlled from system to system (different hardware), how is it maintained? Can you also explain to me the most efficient way to handle frame data, for backtracking and so on. 

 

Thanks in advance.

 

Cheers!!

Share this post


Link to post
Share on other sites
Advertisement

You often use a fix simulation step timeframe (eg 20 ms). A longer frame time would result in more simulation steps in a single frame, and really fast FPS would result in skipping the simulation for some frames.

 

PS: writing your own physics engine is really hard and frustrating, I would suggest to think about using an existing physics engine. There are many engines around like the free bullet physics engine

Share this post


Link to post
Share on other sites

When building a physics engine, how do we handle simulation time, how can it be controlled from system to system (different hardware), how is it maintained? Can you also explain to me the most efficient way to handle frame data, for backtracking and so on. 

 

Thanks in advance.

 

Cheers!!

These two articles do a good job of introducing the topic:

- Fix Your Timestep! by Glenn Fiedler

- deWiTTERS Game Loop by Koen Witters

 

There is not a "most efficient way", it depends on a number of factors. You have to find out on your own the way that suits your scenario best.

Share this post


Link to post
Share on other sites
Kudos on building your own, it is rewarding and empowering for a programmer. You're in for a wild ride though, so I'd recommend reading Game Physics Engine Development by Ian Millington (http://www.amazon.com/gp/aw/d/0123819768/ref=mp_s_a_1_1?qid=1396511885&sr=8-1&pi=SY200_QL40)

It's really good, has great examples and aimed toward first time physics engine developers. It's missing a bit on rigid body contact resolution in terms of code samples, but all the theory is there.

Best of luck! I'm just finishing my custom physics engine and can honestly say it was worth it, for me at least.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement