Archived

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

Controlling Game Flow

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

Hey, In my new game I''ve been wondering how to control my gameflow. It''s a racing type game and I''m thinking about using States in my game loop. If a state is Enabled then it only loops in the section of the state- states can also have substates and so on that''s why I''ve linked them in a tree as an object CState for easy State checking and manipulation. Although this is a way to Control game flow (like form the main game to menus to the tiltle screen) I wonder what is the BEST way for my aplication -- a racing game. What ever you think Let me know. thanx

Share this post


Link to post
Share on other sites
states are very good for quickly deciding program flow, the trouble is they can clash.

plan each set of mutually exclusive states (ie paused, unpaused) and decide what is to be done differently.

instead of just setting a "Paused" flag, have Pause() and Unpause() functions to set a series of things relevant to different areas
eg, Pause() might save the current render to a texture, darken it and make it the background for the menus.

just be careful that you dont simply check groups of states before skipping out a whole section of code, unexpected combinations of variables can cause silly things like the physics engine running with zero time advance.

Share this post


Link to post
Share on other sites
>>instead of just setting a "Paused" flag, have Pause() and Unpause() functions to set a series of things relevant to different areas eg, Pause() might save the current render to a texture, darken it and make it the background for the menus.<<

Interesting idea. Do you happen to know if there''s any articles, online or in a book, that go more in-depth on this style of state management?

-John

Share this post


Link to post
Share on other sites