This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Sync game speed using frame rate ratio ?


Sync game speed using frame rate ratio ?

Postby denthorq » Sep 26, 2003 @ 4:25am

It's worth the wait...
User avatar
denthorq
pm Insider
 
Posts: 447
Joined: Apr 18, 2003 @ 9:15pm
Location: USA-PHILIPPINES


Postby fast_rx » Sep 26, 2003 @ 5:49am

User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby mlepage » Sep 26, 2003 @ 8:14pm

Round by adding 0.5 before casting to int. (Only works on positive numbers and won't round 0.5 to even as statisticians prefer.)
www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby denthorq » Sep 26, 2003 @ 9:49pm

fast_rx: here's the thread

Pls make the formula clear to me. Thanks.
It's worth the wait...
User avatar
denthorq
pm Insider
 
Posts: 447
Joined: Apr 18, 2003 @ 9:15pm
Location: USA-PHILIPPINES


Postby fast_rx » Sep 26, 2003 @ 10:44pm

User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby fast_rx » Sep 27, 2003 @ 2:22am

Some other things I just thought about. They may interest you or anyone else reading...

IF you use integers for your iterated values, you'll be thowing out small (less than 1, obviously) parts of your movement... And since it's iterated dozens of times (hopefully) per second, the errors can really add up. I'd suggest either using floats or at least fixed point floats in order to minimize the error.

Another important thing to consider is that we really don't know what devices will be out in a couple of years... so, ensure you code so that really, really fast devices don't cause a problem. In the previous message, I suggest taking the ratio of the delta time to the desired delta. On a super fast machine, that will approach zero. And if you add in the round off errors of int's or even floats for that matter, you may end up with things not moving at all...

A good way to check to see if your code is working is to compile it in debug (runs slow) and then check it with a full optimized build. They should be almost identical in the timing of things happening, right?

And lastly, I mentioned that this works fine for linearly tweaked values (i.e. constant speed for instance). But in my game Lejjo (), I am iterating a mass-spring system. This caused a problem because there was a point where if my iterations were too large, the spring-mass system equations would go crazy. The fix was to check to see if I was below a minimum update rate, and if not, use multiple smaller iteration time slices.

If any of you made it through all that, I congratulate you.
User avatar
fast_rx
pm Member
 
Posts: 660
Joined: Jun 10, 2003 @ 4:24pm


Postby warmi » Sep 27, 2003 @ 2:29am

warmi
pm Insider
 
Posts: 518
Joined: Aug 24, 2002 @ 8:07am
Location: Chicago USA


Postby denthorq » Sep 27, 2003 @ 2:37am

It's worth the wait...
User avatar
denthorq
pm Insider
 
Posts: 447
Joined: Apr 18, 2003 @ 9:15pm
Location: USA-PHILIPPINES


Postby warmi » Sep 27, 2003 @ 2:42am

warmi
pm Insider
 
Posts: 518
Joined: Aug 24, 2002 @ 8:07am
Location: Chicago USA


Postby denthorq » Sep 27, 2003 @ 2:45am

It's worth the wait...
User avatar
denthorq
pm Insider
 
Posts: 447
Joined: Apr 18, 2003 @ 9:15pm
Location: USA-PHILIPPINES


Postby warmi » Sep 27, 2003 @ 2:57am

warmi
pm Insider
 
Posts: 518
Joined: Aug 24, 2002 @ 8:07am
Location: Chicago USA


Postby mlepage » Sep 27, 2003 @ 3:11am

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum