Jump to content
  • Advertisement
Sign in to follow this  
maruk

How to code a game loop

This topic is 3452 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm interested in making a game engine for a game like Morrowind. AI is mostly script driven and scripts can be attached to the GUI as well. There two interaction styles: gui and game. In gui mode the player controls a mouse pointer to use the gui and the game is automatically paused. In game mode the player controls the player character like an FPS game. I have identified the following tasks the game has to do: load/save config file, bootstrap, load game data, read input devices, render, render gui, update physics, update ai/scripts. I'm uncertain in what order to execute the game tasks. The best idea i have is this: 1. Load config file 2. Bootstrap (this is a small initialization step that only loads minimal resources and initializes the console). 3. Enter resource loading loop (a loop maybe needed to use a console and display information about the resources being loaded) 3.1. Read mouse and keyboard input (for cheat codes?) 3.2. Translate input for gui mode (translate real input data to logical input commands) 3.3. Possibly update scripts/ai for a background scene (ala Half-Life 2) 3.4. Possibly update physics for background scene 3.5. Possibly render a background scene 3.6. Load some resources and update GUI by adding info messages to the console 3.7. Render GUI 4. Exit load resources loop 4 Enter game loop 4.1. Read mouse and keyboard input 4.2. Translate input for current interaction style 4.3. Update game scripts/ai (may depend on interaction style) 4.4. Update physics (may depend on interaction style) 4.5. Render game world (may depend on interaction style) 4.6. Update GUI related scripts (may depend on interaction style) 4.7. Render GUI (may depend on interaction style) 5. Exit game loop What do you think? Is this a good way to code the game loop?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!