Jump to content

  • Log In with Google      Sign In   
  • Create Account

Handling time in a physics engine?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 dribble04   Members   -  Reputation: 150

Like
0Likes
Like

Posted 23 March 2014 - 11:56 PM

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!!



Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7991

Like
0Likes
Like

Posted 24 March 2014 - 02:55 AM

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



#3 dribble04   Members   -  Reputation: 150

Like
0Likes
Like

Posted 24 March 2014 - 03:04 AM

Am doing this, only to brush up and strengthen my skills here and there. How do we find a balance?



#4 georger.araujo   Members   -  Reputation: 824

Like
1Likes
Like

Posted 24 March 2014 - 08:34 AM

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.



#5 dribble04   Members   -  Reputation: 150

Like
0Likes
Like

Posted 24 March 2014 - 10:33 PM

Thanks :)



#6 aggieblue92   Members   -  Reputation: 182

Like
0Likes
Like

Posted 03 April 2014 - 02:01 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS