2D Top Down Action RPG

2D level creation with Cellular Automata and Connected Component Labeling

Worlds are generated with multiple zones and levels inside. Each level is created using Cellular Automata techniques to generate the solid parts of the terrain. Levels are currently only rectangular in size, and each level has multiple paths/doors to other levels. These paths are created randomly within a tree like structure.

Level Creation Steps:

  1. Run Cellular Automata Logic
  2. Create Border Walls
  3. Find all Open Spaces via Connected Component Labeling
  4. Create Border Doors
  5. Ensure all open spaces are accessible by the player
  6. Ensure all border doors are also accessible.

To ensure that all doors on the levels are accessible to the player, A Star path finding techniques are used after level boundaries are created and cellular automata logic is run. A Star is run between each pair of doors within a level, with weights on solid cells of the grid being very large, causing the path finding to travel through already opened areas created via the cellular automata. If a door is not accessible the path finding will remove solid cells to ensure accessibility.

Connected Component Labeling was used to ensure that all open/non solid areas of the level are accessible. Each connected open space is checked against its neighbors to ensure it is accessible by the player, path finding is then used to create a path if needed.

Goal-Driven Agent Behavior for Enemy Control

Enemy Behavior was created with a design pattern found in the book Programming Game AI by Example . This allowed each enemy to have emergent behavior based on various goals and conditions of the game world. Goals and actions included keeping rooms cleared of enemies, avoiding attacks, seeking out health, etc.

References: