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.

DarkBASIC Professional Discussion / Movement per second?

Author
Message
QuantumPixel
16
Years of Service
User Offline
Joined: 14th Feb 2010
Location: Alabama, USA
Posted: 29th Jan 2011 13:20
Greetings all,

I am currently attempting to write a flight sim in DB Pro. The problem is that nearly all physics equations that have to do with movement produce values measured in units(meters) per second. Obviously, I cannot use the equations as they are since the program would be making the calculations several times a second (thereby multiplying the effect), nor can I wait one full second between updates to the physics calculations.

I could divide the equations' results by the program's number of calculations per second, if I knew it. Is this the same as Frame Rate, or does frame rate only apply to how often the graphics are updated?

Basically, my question is this: If you wanted to assure that an object in your game fell at precisely 9.8 units per second, how would you do it?

Thanks.
CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 29th Jan 2011 16:07
Well, you can compare your Sync rate to your timer to find out how many syncs per second are going on, and move your objects a certain amount before each sync to acheive movement of a certain "meters per second".

Malevolence: The Sword of Ahkranox
The infinite RPG
http://www.msoa-game.com
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 29th Jan 2011 16:39
You need timer based movement, have a read of this fascinating article:
http://www.starwraith.com/main/article2.htm

Basically you just need to run something like:

The difference gives you the time that has elapsed (in ms) since you last updated your game physics. You can use this to scale your results accordingly.

Hope this helps!

We spend our lives chasing dreams. Dark Basic lets us catch some of them.

Login to post a reply

Server time is: 2026-07-16 12:20:04
Your offset time is: 2026-07-16 12:20:04