Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Yet Another Physics Sample  (Read 381 times)
jviper
Community Member
*
Posts: 2127

Discipline in training


« on: March 11, 2010, 04:53:37 PM »

This is essentially the same physics sample I posted last time (a while ago). The controls are the same and you can do the same things. The only real difference is within the source. In the source I have the rendering decoupled from the physics.

Now I suppose I will exaplain why I am posting this. I am posting this because another TV3Der was having a problem with physics and performance. I also realized that this could be a common issue with the physics engine. So I posted this VB.NET source demonstrating the "on interval demand" method of syncing the graphics with the physics and avoiding performance issues.

The concept is this: There are two time counters (well actually three, but only need two to serve the perpose of decoucpling the physics with the rendering). In the main loop, I use Stopwatch (I forget which namespace it's in) to see how much time has passed since the last interval and add that time to all of the counters. If any of the counters go over their time interval, I then to what ever for that time counter, then reset the time  counter.

Here is the mistory: whether using SimulateFixedStep works better than Simulate, or whether they should act the same. Not quite sure of that yetm but I should be able to figure that out with some certain amount of time.
« Last Edit: March 11, 2010, 05:15:22 PM by jviper » Logged

JAbstract.....Don't just imagine, make it happen!
DarekRuman
Customers
Community Member
*****
Posts: 184

game developer


WWW
« Reply #1 on: March 13, 2010, 02:47:13 PM »

Its called Time Slicing (http://www.newtondynamics.com/wiki/index.php5?title=What_is_%22Time-slicing%22%3F) and I'm using this method too in my racing game.
Logged

www.reddotgames.pl
tv6.3 tv6.5 developer
games made in TV : Paintball Extreme, Reindeer Adventure, Mole : Great Adventure, Foxy Fox, Włatcy móch : Śnieżna Rozwałka, Włatcy Móch : Magiczni Wojownicy, Ski:), Lowrider Extreme
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks