Frame Rates

Started by
14 comments, last by Dovyman 21 years ago
This is interesting, when I asked about locking the framerate a while back, I was told how terribly stupid that was, and that I should use time based animation instead, and here you go, telling Dovyman to do just that.

For Sprite Animation, I use a timer value in the sprite struct. and every frame I check if that timer value has been reached with a check to the main system timer.

basically I use gettickcount to init a value at the start of the rendering, and then I just update that every frame. And store a value in my sprite struct, of the gettickcount from the last sprite frame, plus the time I want it to take until the next update.
Then when I reached that value, I change the sprite frame, and update the sprite.timer with gettickcount + time until next anim frame.

Makes sense?

It''''s nice to be important, but it''''s more important to be nice.
Don't we all still remember and miss the day we plotted our first pixel?
Advertisement
what CrazedGenius said in his first post has made the most sense to me out of these options. To me it makes more sense to allow drawing to occur as fast as possible, but control the movement of the objects on the screen in a time based manner.
How do you implement something like that? (ill probably just try both and see what works best for me)

-Paul-
define the movement in terms of pixels/sec. Now, find the time elapsed since the last frame. Move the sprite by the velocity * the time elapsed (pixels / sec * sec = pixels)

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
quote:Original post by CrazedGenius

On the other hand, time based animation is not just for 3D. Asteroids is a 2D game for which locking the framerate would be a bad idea.



I have to lock my asteroids clone framerate otherwise it''ll run too fast. This is how I did this:

I lock the physics, movement, and AI to 60 frames per second, but the blitting and flipping as fast as it can go. Try my game from my signature. You''ll see what I mean.

Or did you mean something else?


Beyaan
[All inappropriate messages deleted, regardless if they contained useful information or not]

No flaming in my forum. Thank you.


Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX
and Focus On: Advanced Animation with DirectX



[edited by - Jim Adams on October 21, 2002 4:44:19 PM]
I know this is an old thread but I used the trusty search engine and this was the topic I was looking for. Now after reading this I get:

tile based games are ok to lock fps
3d use interpolation.

I am working on an isometric multiplayer game and want all the computers to be in sync. Should I be looking at something completely different or go with the locking the fps?

GRELLIN

"I installed a skylight in my apartment...The people who live above me are furious."
Steven Bradley .:Personal Journal:. .:WEBPLATES:. .:CGP Beginners Group:. "Time is our most precious resource yet it is the resource we most often waste." ~ Dr. R.M. Powell

This topic is closed to new replies.

Advertisement