quote:
Wasted processing time. Your just doing nothing waiting for 16 milisecs to pass by.
Actually, it''s not wasted time. The delay function _frees_ the processor, allowing whatever tasks you are running in the background (like a separate audio thread) better access to the processor. Not wasted at all.
quote:
Also as mentioned on a slow system capable of less than 60fps this code would not degrade gracefully.
Wow, can you tell just by looking at it how graceful it will be? Actually, I upped the resolution and put a few thousand asteroids on the screen to see how well the game played when the processor couldn''t keep up. Amazingly, the gameplay became only a bit choppy but remained responsive as user input is still checked and accounted for each frame. Also, the speed of gameplay did not change. You should try it out before you bash it.
quote:
Rough Example.
I said it was my first game and my timing code does work, however "rough" it may be.
While Main_Loop { While Last_Time + Interval <= Current_Time { Last_Time = Last_Time + Interval Do_AI() } DrawFrame}
That''s a good idea. Actually from the discussion on this forum I''ve decided to rewrite the game using timing based movement. I agree it would probably be better in the long run. It will make collision detection more difficult and all the other timing things that counted frames. I guess I spent a lot of time with old consoles and console emulators and kind of assumed fixed frame-rate was standard.
steveth45 = new gamecoder;