zero's a life

An extra chance.

How I Am Setsuna Uses a State Stack: Overworld

| Comments

The Overworld state ties together all of the states I previously discussed based on watching this playthrough of I am Setsuna.


I think that the Overworld can serve as the base Map state I used in my previous examples. This allows the Overworld to serve two purposes. First, the Overworld state holds all of the map and area entrance data to allow characters to move about the overworld. And second, the Overworld state can store information about the state of the game for use in the other states.

Area information

| Overworld |

The Overworld contains all of the data necessary to render the overworld map, including the assets for rendering the map and the location and the target map data on triggers for entering towns, caves, and other Maps.

Gameplay information

| Menu ←    |
| Overworld |

The Overworld also contains the sorts of information you see in the main menu, such as the character’s state, inventory, money. Serializing a snapshot of this information and the characters’ position saves the game’s state and can be used to reload the game later.

The states added to the stack on top of the Overworld state can access this data for consumption and updating.

| Shop menu  |
| Map (Shop) |
| Map (Town) |
| Overworld  |

For instance, a shop in town may access the inventory and money to allow the player to purchase items.

| Combat   |
| Overwold |

Similarly, the combat state may access the characters’ stats, equipment and inventory to track health, damage output, and item use in battle.


I hope that the last few posts have given you an overview of how the state stack could work for supporting an RPG like I am Setsuna.