PDA

View Full Version : Sprite speed and FPS



atozix
22-10-2003, 11:01 AM
All rightee then, a bit more tricky...

Hi all,,,

Now, if sprites are updated every millisecond and advanced 1 pixel location at a time, we have the smoothest progression possible using DelphiX...

This looks good on the screen but is quite slow....

To increase the velocity of the sprite along the screen, all I can do is increase the sprite update increment to 2 or more.... If I use an increment of 6 to 20, then the speed is quite fast but obviously the higher the increment the bigger the jump gap and jerkier the display of the sprite..
And the more trouble it is to calculate collision and rebound values.

Which i find unsatisfactory... This is with a screen refresh rate of 75Hz
and an FPS of 75, as verified by displaying the FPS at run game time.

Is there any way to update sprites faster with a 1 pixel increment...???

Just exploring.... but I would like the SMOOTHEST FASTEST MOVEMENT POSSIBLE....

It seems to me that an update of 1 millisecond is just not fast enough.

Any comments and or methods for smooth fast sprites devoured...

THX and cheeeeeeeeeerrrrrrrrrssssssss atozix

Alimonster
22-10-2003, 12:06 PM
I can't speak from DelphiX experience (I'll let someone else do that), but I can give you a prod in the right direction.

Instead of thinking about movement in terms of "pixels per frame", think about movement in terms of "pixels per time unit" (e.g. per second, or something like that). This change will separate out the frame rate from the character movement so that the game plays at the same rate on all machines (just a bit jerkier on slower ones, probably). Thus, it won't matter what the frame rate is and you decide how far your objects move rather than the monitor refresh rate. ;)

The next change, in association with the above, would be to introduce reals instead of integers for the position, acceleration, velocity, gravity, and so on. Don't think in terms of whole numbers all the time! The penalty for converting from reals to integers is negligible unless you go totally overboard with the amount of updatable objects. You can get away with doing all your calculation in real numbers, then round down to the final position at the end if/when the object is visible on the screen. It's possible to use fixed point if you want, but you probably won't need to unless you have a _lot_ of sprites.

Now... I have no idea how, or if, the above is relevant to DelphiX, and I have no idea whether the above will play nicely with DelphiX's sprite engine. It's time for someone else to add to this thread and/or demolish the above info as nonsense.

Alimonster
22-10-2003, 12:09 PM
Oh, and to clarify a little: it is expensive to constantly convert to/from integers and reals, but doing your calculations in floats and only converting some of 'em once will not be a problem at all, so don't worry about that aspect. Also, it's unlikely that the number of conversions (a few hundred max, I'd guess) will be sufficient to be a problem.

atozix
22-10-2003, 06:59 PM
Hi Alimonster :)

Hmmmm, Well i do normally use floats for sprite directional control, as it allows me to have precise direction using degrees, and only convert to integers to update the sprite.. As you say there is no real time penalty in this...

But still, whether one thinks in time, FPS or monitor refresh rate, the simple fact is that i fear our rudimentary computers are just not fast enough..... YET.... As the illusion of speed is gained only by jumping gaps rather than very quickly passing through each available point on the screen..

Bummer really , as in real life the apparent gap is extremely small and therfore appears continuous.... like light moves at 186,000 miles / sec so its refresh rate for moving 1pixel length makes our measure of FPS and display refresh Hz pathetic by comparison.... :)

Of course this could lead to philosophic considerations regarding the nature of continuity and reality, but this is not the forum for that....

Still, we work with what we have CURRENTLY available and THX for your comments.....

BTW I am enjoying my recent return to programming and appreciate the replies to my questions from alllllllllllllllll...

Cheeeeeeeeeerrrrrrrrrrsssssssssssss atozix