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.

Bug Reports / [DarkPHYSICS] ( PHY Set Auto Fixed Timing does not work.

Author
Message
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 16th Oct 2006 18:56
Theorically, PHY SET AUTO FIXED TIMING do this:
When using a sync rate of 0 so that your application runs as fast as possible then you may prefer to link the elapsed time between calls to the simulation to the frame rate. This is achieved by making a call to phy set auto fixed timing. When using this command your program will produce the same results whether it is running at 30 fps or 130 fps.

but, in reality, it does not work.

Here is a small source code showing the problem:


If you change frame rates using keys 1-4 (10,60,150,Max) and press space, you'll see that the object does not JUMP at the same speed.

All we have to decide is what to do with the time that is given to us.
Freddix
AGK Developer
21
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 23rd Oct 2006 21:13
can someone confirm this ?

All we have to decide is what to do with the time that is given to us.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Dec 2009 13:50
Just adding my name to this list as I'm having the same problem...
Duke E
15
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 7th Dec 2009 10:55 Edited at: 7th Dec 2009 15:23
The problem is the movement of your character controller and the variable framerate. The Character controller does not work with set forces as the "Phy Add Rigid Body Local Force" type commands do. The CC move command takes a speed value instead, and that speed value will change with framerate.

You need to calculate the frame times yourself in this case and move the character controller the proper distance it is supposed to travel during each frame, longer when the framerate is low and less when it is high. Something like this:
"PHY Move Character Controller 2,0.0001 * FrameDuration"

Timer based physics with DarkPhysics works without Phy Set Auto Fixed Timing also:
http://forum.thegamecreators.com/?m=forum_view&t=157547&b=30

Edit: To be honest it's a flaw in the documentation, the help files should state that auto fixed timing produces the same results on physics simulated objects, not on CC's and Kinematics.

Regards
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Dec 2009 13:26
I've come up with a sort of workaround from various bits of code out there. It works quite well in my WIP "Bildin Bloks" (updated demo coming soon so you can test it yourself...

Anyway it's based on a "timer based movement" snippet by someone whose name I'll have to look up.

Add these functions


Put this in your loop:


Put this in just before your main loop or if you need to pause put this in after the pause:


Then this is the code I use to set the physics timing every loop:


Of course this only works with a sync rate of 0 and if you impliment the timer based movement for EVERYTHING that moves or is animated but I implimented this in my nearly finished game in a couple of hours and didn't find it too hard. Basically you just multiply any movement by the "FrameX#" variable (animation gets a little more complex but not much).

Hope this makes sense but if not then let me know and I'll try to help!

Login to post a reply

Server time is: 2024-04-19 13:18:00
Your offset time is: 2024-04-19 13:18:00