Game State Architecture
Our game world is divided into a grid of tiles. Each tile can contain an object, which we call a TileContent. The TileContent is a base class that all entities in the game world inherit from. A list of all TileContent's can be found here. This document will explain how the game state, containing all the TileContent objects, is managed and updated.
Game State
The game state is held in a 2D array of type tile, called the TileArray. Each tile can contain one TileContent object. Each TileContent can contain another Instance of TileContent, allowing for multiple objects on one tile. This achieves a hierarchical structure of the game world.
Accessed is this TileArray over the Map class, as shown in the class diagram below.
Class Documentation References
Summary of Class Interactions
Mapcontains multipleTileobjects, forming the game grid.Specialized
Tiletypes (EmptyTile,GroundTile) inherit fromTile.Each
Tilecan hold oneTileContent, representing a new layer of the game world.Specialized
TileContenttypes (Wall,Player,Goal) inherit fromTileContent.TileContent Objects interact through actions and updates, supporting dynamic map changes ( see Interaction System).