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.

Newcomers DBPro Corner / Defining speeds as per second or tick as opposed to per loop

Author
Message
Mike F
19
Years of Service
User Offline
Joined: 30th Mar 2005
Location:
Posted: 31st Mar 2005 00:25
Hello,

My aplogies if this is one of the exceedingly often asked questions, but I'm looking for a way to model gravity somewhat realistically (and other physics later on) and, at least with the way I've been programing, all the movements are taken care of dependant on how quickly the program runs.

I'm looking for eventually doing multi-player games, and differing processor speeds would require a lock-step method if speed was dependant on the number of iterations of the main loop.

I'm currently using the DB trial, but should have DBPro once shipping and customs are all done with. I have some experience with BASIC, MATLAB and a bit of knowledge of DarkBasic.

I appreciate the help.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Mar 2005 05:00


Mike F
19
Years of Service
User Offline
Joined: 30th Mar 2005
Location:
Posted: 31st Mar 2005 06:48
I had actaully attempted to do something similar. However, the numbers were signifigantly off. When I did a check every second, a fall of 500m (which should take a hair more than 10 seconds) took 13 seconds. When I changed the numbers so it measured in 1/50 second chunks, it got worse, but I think my math may have been the blame there.

My current trial gets me a number of ~9 seconds.



Thanks for the help, though. Is there any way to make the function send a click at exactly one second instead of waiting for the subroutines under it to finish? Basically, can the function run while something else is going?
Baggers
20
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 31st Mar 2005 09:01
Dividing any movement by the fps rate is reasonably accurate, however it is put off by object loading and manipulations.
Remember that from then on your are programing in units per second..

also you will have to divide the fps from some other equations, such as friction commands
(im sorry if this answer was abit off...im very tired)
Mike F
19
Years of Service
User Offline
Joined: 30th Mar 2005
Location:
Posted: 1st Apr 2005 00:58
Wow. I can't believe I missed the FPS idea. It has "Per Second" right in the title, even.

Anyway, here's my revised code. The REM comments are for 20 and 30 seconds respectively. They come in with less than 1/10 a second error, although values such as 5 tend to be off by a bit. Small number of samples, I guess.



Thanks for the help, guys.

LeaderOne
20
Years of Service
User Offline
Joined: 9th Jan 2004
Location:
Posted: 19th Apr 2005 23:57
thanx phaelax

"Chicken is nice"

Login to post a reply

Server time is: 2024-09-23 17:21:20
Your offset time is: 2024-09-23 17:21:20