Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

elis-cool

The order of your game loop...

This topic is 6018 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

In what order do you put your game loop? I was thinking something like: 1. cheak for user input 2. move character/object/etc. // in code 3. cheak for collision detection 4. respond to collision detection eg. move character/object/etc. // in code 5. update score // in code 6. render scene // on screen 7. re-loop

Share this post


Link to post
Share on other sites
Advertisement
To boil it down even more:

1) Perform simulation step.
2) Render.

The point is: make sure you group all your rendering together and all your "other" simulation stuff together. This will allow for the best utilization of CPU cache and internal bandwidth, and will allow the Rendering step to stack up things in the pipeline and shift back to the simulation step without having to wait to finish. Inside the simulation step:

1) Perform simulation step.
a) Determine user input (check keyboard/mouse/joystick)
b) Perform macro world simulation
c) Perform micro world simulaiton where necessary

In regards to macro/micro world simulation -- I will be explaining this in an article in the upcoming future.

Troy.

Share this post


Link to post
Share on other sites
quote:
Original post by Simagery
The point is: make sure you group all your rendering together and all your "other" simulation stuff together. This will allow for the best utilization of CPU cache and internal bandwidth, and will allow the Rendering step to stack up things in the pipeline and shift back to the simulation step without having to wait to finish. Inside the simulation step:



Wouldn't it be better (in theory) to start rendering as soon as possible to avoid letting the videocard sit around doing nothing ?



Edited by - granat on February 25, 2002 3:13:29 PM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!