Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / True timerbased physics

Author
Message
Duke E
15
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 7th Sep 2009 22:24 Edited at: 7th Sep 2009 22:49
Posted this on some obscure thread on general physics engine stuff, just thought i would add it here for future reference and with a search-able topic and some example code.

The Phy timing commands are somewhat cryptic in the help files, but with some experimenting and luck i came up with this method (and some looking over the NVidia boards plus SDK)

Both the fixed timing commands have to be used in conjunction every loop,
passing in the frame Elapsed and Duration time:
Phy Set Fixed Timing Elapsed
Phy Set Timing Duration,8,0

The code shows a tray with a ball rolling down to stop at the center, should be pretty consistent test circumstances.
For every run more iterations are added to a work loop so the FPS will drop, the time it takes to reach the bottom should be pretty much the same.
The time the ball takes to reach the bottom is recored and the last fifteen times are displayed.
Should give something like 14-15 seconds every time. The Physics solver can act up on extreme high or low FPS though but thats to be expected.

The timing/average function method is not my invention, i borrowed it from code posted by the eminent DarkCoder.
Remove the comment from the "Elapsed = Average(..." for more consistent Elapsed values.
Interestingly a zero Elapsed value passed in to the fixed timing commands now and then does not matter. The engine seems to make an average itself.




Edit, lost a paragraph in the initial editing

Regards

Login to post a reply

Server time is: 2024-11-24 17:34:02
Your offset time is: 2024-11-24 17:34:02