MAKING MAZES
Game State

Overview of the Game State Working with the Game State

Overview of the Game State

In an abstract sense the 'Game State' is the current state of all the things happening in a maze game. It is the state, the situation, or the circumstances of all events or objects in this make-believe game world.

In a more concrete sense the 'Game State' is found in the Game State Folder.   This folder is meant to hold the working files for all players in an instance of a maze game.   It holds all the files that keep track of what the maze is currently like for the players of the make-believe maze.   Since the maze can be a little bit different for each player depending on what the player has already done in the maze, each player has their own files in the Game State Folder.

The first file that might be seen for a player when looking in the Game State Folder is a file with a name like '0001.txt' or '0002.txt'.   The number in the file name stands for the player number.   The first player has information in the '0001.txt' file.   The 2nd player has information in the '0002.txt' file.   The 3rd in the '0003.txt' file and the 4th in the '0004.txt' file.   These files are commonly called the (player number).txt File in other places on this website.

The rest of each players files are kept in a folder that has a folder name like '0001' or '0002'.   The number is again the player number.   These folders are commonly called the (player number) Folder in other locations on this website.   The things that can be a little bit different for each player are usually things like which Challenges a player has already solved, which Passages a player has already opened, or which Secrets a player has already recovered.   Each player's folder has copies of all the room files.   The room files are generally called (room number).txt Files in many locations on this website.   The room files have the information that the Challenge Maze Software uses to figure out things like whether it should show open passages, closed passages, or no passages.   To find out all the information that room files might have you can visit the (room number).txt File page.

Each player's folder also keeps a folder inside of it called the Secrets Behavior Folder.   That folder has some information about the status of each player's activities involving Secrets.

There is some information that is shared by all the players.   This information will be found in the Persistent Info Folder that is inside of the Game State Folder.   This folder holds information about how the Challenge Maze Software should show different parts of a maze to the players.

Working with the Game State

It is possible to work towards constructing a completed maze by editing files in the Game State Folder.   However, please keep in mind the following 4 general behaviors of how the Challenge Maze Software deals with 'Game States'.

  1. When the Challenge Maze Software is started, a player can select a maze to play.   When starting a new game in a maze the Challenge Maze Software copies the contents of (maze name) Folder into the Game State Folder.   The Challenge Maze Software makes a copy of the maze for each player.  
  2. While the maze game is being played, the Challenge Maze Software modifies files in the Game State Folder.   Things such as the solving of Challenges or the opening of Passages begin to get recorded.   These changes and many more are recorded as textual changes to files.
  3. When a player saves a game, the Challenge Maze Software copies the Game State Folder to a folder in the Saves Folder.   Along with that copied folder, a file is created that is named after the 'Game ID' of the saved game.   The copied folder is the _Game ID (original game save time) Folder which is given a new name that matches the name of the _Game ID (original game save time).txt File.
  4. When a player loads a saved game, the Challenge Maze Software copies the saved game folder into the Game State Folder.  

As a result of these four behaviors, any edits you make to files in the Mazes Folder will not be observed in a maze game until the maze is restarted from the Title Screen.   Further, any saved games from that maze will not show any changes even if a game is restarted because the 'Game State' files in the 'Saves' folder are from the old version of the maze.

Finally, if any changes are made to (room number).txt Files in the Game State Folder after a game is started, the effects will be observable in the game by merely walking out of and back into the room that is affected by the changes.   This can help quickly build mazes, but it adds complexity in other ways.   For example, any changes made to files in the Game State Folder, will not be automatically updated in the (maze name) Folder.   Those changes must be copied carefully to the files in the (maze name) Folder.   If all the files are completely copied back to the (maze name) Folder, all the changes the Challenge Maze Software makes to files in the Game State Folder (like unlocked doors, revealed secrets, etc..), will be copied too.