Found this game loop tutorial if anyone needs it..

http://jare.planet-d.net/docs/FixLoop.htm
I remeber myself having a problem creating a proper game loop for my app. I later followed Marcus Persson’s WIKI tutorial about a discrete step timming loop. But I had problems trying to achieve consitent smooth frame rates and animation. I have since found this tip of the day example and am currently tweaking my implementation of it. I decided to post this here in case anyone having problems figuring out their game loop. If I have this running better then some of my other implementations I will right up a WIKI tutorial for it.

Ooh, reminds me of the thing I wrote and posted here a while back. =D

(and, yes, I came up with mine independently of that one. :))

    currentTime = getTime();
    timePassed  = (currentTime - previousTime);

    timeSinceLastUpdate += timePassed;

    while( (timeSinceLastUpdate>10.0)){

      timeSinceLastUpdate-=10.0;
      updated = true;
     doLogic();
}
    if(updated){
      doStuff();
    }

    previousTime         = currentTime;

^ the one I use

Yeah Marcus you have good and interesting discrete step timming loop. But Ifounds that a bit complicated and odd at first. I have also experienced some problems with animation consistency. This is a fixed step timming loop which is a good begginer fast game loop.

They do basically the same thing, with the exception of that one explaining stuff better.

Thanks for sharing the link Kommi. I’m always looking for new examples of animation loops. I remember some time ago someone saying that a good animation loop could take months or years to develop and at the time I was just starting out and scoffed at the idea. Well it’s been several months later now and I find myself tweaking and adjusting and learning new techniques and realizing how true that statement was. Anyway, my current algorithm probably marries different ideas from at least 4 distinct implementations so I’m always glad to see something new even if it’s nothing more than different words to the same tune. :slight_smile: