The general game is based on "scene-driven".
The so-called scene drive is the player in the game specific position, specific state, specific behavior triggers the game logic.
As in a map, enter a door, to the next map;
If you choose to talk to someone in a map, it triggers a fight ...
Take a look at the following screenshot from the martial arts Group biography:
Drives subtasks (battles, games, menus) by driver-level tasks (RPG scenarios, Grow-out mode scenarios).
This design concept is also used in our Gde-x engine.
Consider fighting, games, other menus, etc. as temporary tasks. can be loaded independently each time it is needed.
The scene as a background-driven task, always exists, only need to maintain the current scene information.
Then our game engine state machine can be completely based on the current scene
while (not exit)
{
Scene behavior xxx (current scene);
}
And then to block in the scene behavior to start temporary tasks, such as combat startbattle (this. combat information);
After the battle was completed and returned to the scene behavior.