2010年7月20日 星期二

[Game] Develop Game Loop

IntroductionGame is a real-time application.In the section, I use some image and sample code to explain how to develop game loop.

BackgroundFirst, game status need to update in game world.Secound, game allow interaction with player.And last, the result need to dislpay for players, whether screen, sound or other outputs.Game status and player input can consider as a behavior.So game is as a combination of update and render.

First loop, update and render everytime.When game logic is too complex, it may reduce render's performance.Secound loop, using multi-thread to update and render.Last loop, using a timer to record last update time.