I have been wanting to write a video game for a long time now. I have had a lot of ideas stewing in the back of my head and I think I have thought about it enough to make a real attempt at writing a simple side-scroller.

I have one big problem though. The game timer. I can't figure out how to do it. I need to make sure a loop only runs so many times per second no matter how long each cycle takes. I know there is a way to do it, but I don't know how.

For any type of game timer it is always advisable to use the highest resolution timer available. Standard C library functions are normally not good enough. You never know how well they are implemented. In most cases this has to be system specific.