[SDL] Delta time?

necronology at cox.net necronology at cox.net
Fri Oct 12 18:02:14 PDT 2007


Wow that paper is something. My opinion is that he easy answer is as follows>
td2=SDL_GetTicks();    dt=((float)(td2-td))*0.1;    td=td2;
//the function SDL_GetTicks() is not used in any other part of the game.
//the product variable sdlgt tells how many milliseconds the game has been played
// (w/o being paused)
if(!paused){sdlgt+=dt*10;}
// Move object up at rate that compensates
if(keys[SDLK_UP]){ship.yadd((int)(-2*dt));}
//does this make sense or have I complicated it?

---- David Olofson <david at olofson.net> wrote: 
> On Saturday 13 October 2007, Torsten Giebl wrote:
> [...]
> > Is this the paper you mean ?
> > 
> > http://www.gaffer.org/game-physics/fix-your-timestep/
> 
> Yup, that's the one. Thanks!
> 
> 
> //David Olofson - Programmer, Composer, Open Source Advocate
> 
> .-------  http://olofson.net - Games, SDL examples  -------.
> |        http://zeespace.net - 2.5D rendering engine       |
> |       http://audiality.org - Music/audio engine          |
> |     http://eel.olofson.net - Real time scripting         |
> '--  http://www.reologica.se - Rheology instrumentation  --'
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



More information about the SDL mailing list