City generation - UQdeco2800/2022-studio-3 GitHub Wiki

Overview

Procedural city spawning is implemented with MapGenerator.java, all classes in game/areas/MapGenerator/Buildings/ and all classes in game/areas/MapGenerator/pathBuilding/. The entry point to the generation code can be found in AtlantisGameArea.spawnCity(). The call flow of the major classes are as follows:

MapGenerator->BuildingGenerator->PathGenerator->FindPath ->CheckConnectivity

Where '->' reads as 'instance is passed to'.

Once the city feature placements are generated, spawnBuildings() is called from spawnCity() to spawn the buildings in game and then spawnPaths() is called to place the path tiles.

City Spawning

Testing

Verifying AtlantisGameArea.spawnCity(), and the spawnBuildings() and spawnPaths() methods work, is done visually. Through multiple game generates it was determined that buildings are scaled correctly according to the tile sizes specified in buildingSpecification.json, and placed according to the positions determined by BuildingGenerator and PathGenerator. The following visual checks are done:

  • Walls and gates are placed at the edges of the city, bordering the city tile edges.
  • Wall assets join in a consistent way.
  • Paths meet building door positions relatively accurately.
  • Buildings do not overlap with other entities.
  • Paths are not placed outside city bounds or through building and wall placements.