[SDL] Fixed Rate Logic (was: stuck with multiplayer and some segfaults)
David Olofson
david at olofson.net
Sat Mar 12 01:52:22 PST 2005
On Friday 11 March 2005 19.59, Olof Bjarnason wrote:
> Well of course fixed frame rate might seem jerky to the trained eye,
> compared to "floating deltas", if you look at a ball or something
> moving at a constant speed over the screen or the prime example,
> scrolling text, since every now and then there is one more or one
less
> logic step taken between to consequtive graphics frames:
>
> Let's say we have 100 Hz game logic, and 60 Hz gfx. Then there are
> 100/60 ~= 1.67 logic frames per graphic update. Then somethimes
there
> will be two logic updates between two graphic frames, and sometimes
> one. Now when I come to think of it like this I'm not so sure I
would
> use dt = 10 ms (100 Hz) fixed logic frame rate since this WILL look
> jerky :)
That doesn't matter if you're interpolating. (As Kobo Deluxe and Pig
are doing.) You *will* get linear "segments" instead of smooth
curves, but after trying the Kobo Deluxe engine with logic frame
rates between 5 and 50 Hz, I dare say there's no way to tell the
difference with sensible logic frame rates. (Say, above 20 Hz, if
even that.) The difference between the exact positions and the
piecewise linearly interpolated ones is in the order of fractional
pixels.
> Then again, increasing the logic frame rate to 1000 Hz will look
> much smoother,
Yes, but it's a rather inefficient way of dealing with the problem.
You need *insane* logic frame rates to get anywhere near the accuracy
of simple, fast 24:8 fixed point interpolation with a logic frame
rate lower than the rendering frame rate. And if you're going to do
sub-pixel accurate rendering (with OpenGL), you'll need that
accuracy...
//David Olofson - Programmer, Composer, Open Source Advocate
.- Audiality -----------------------------------------------.
| Free/Open Source audio engine for games and multimedia. |
| MIDI, modular synthesis, real time effects, scripting,... |
`-----------------------------------> http://audiality.org -'
--- http://olofson.net --- http://www.reologica.se ---
More information about the SDL
mailing list