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 / [dark dynamix] Timer based physics

Author
Message
Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 19th Oct 2012 14:01
Has anyone succeeded with implementing timer based simulations? I seem to have trouble setting it up.

The basics of the code I have so far:



I have a timer based function from kistech as follows:



It has always worked for me until now, I can't help but think I'm setting up the physics wrong somehow, when the FPS is dropped the objects are moved slower (these objects are moved using add force). If I multiply the force by the timestep movement becomes erratic and when the fps goes down it moves the objects faster.

Any help on this would be appreciated, I have been scratching my head over this for days
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 19th Oct 2012 15:44
Out of curiousity, should this
Quote: "DYN UPDATE"
not be just before the SYNC call and after everything else? [unless of course you wanted AI to be updated in advance...]

Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 19th Oct 2012 16:29
Nope doing that stops multithreading from working apparently. Where the ai update is doesn't matter i think...
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Oct 2012 01:32
When does timestep# get updated? I can't see that changed in your code snippets. The lower your FPS the higher timestep# needs to be to keep things simulating at the same speed.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 22nd Oct 2012 16:17
I have had some success with timer based movement but it is not an easy subject since advancing the simulation by a value that is not a multiple of the sub-step value can cause unstable simulations in complex scenes(joints and wheels etc).

There is lots of information on a thread fallout made a few months back, let me know if you can't find it and I'll have a look for it.

I would advise to experiment with simple scenes without AI or other stuff which may complicate the matter, that way I can directly help you with the code if needed.

Chenak
21
Years of Service
User Offline
Joined: 13th Sep 2002
Location: United Kingdom
Posted: 2nd Nov 2012 10:56
Sorry it took so long to reply, it seems I accidently got the time code from another project, basically timestep#=sys.speed

I'm still having a bit of trouble with it, when I display sys.speed it does react normally to fps change so I can still have a constant speed, it just doesn't seem to work when I apply it in physics, perhaps its something to do with forces? I tried multiplying the movement vector by the speed where I get slightly better results, but not much

Login to post a reply

Server time is: 2024-03-28 22:33:23
Your offset time is: 2024-03-28 22:33:23