Pacman Level Generator

Info

  • Engine: Unity
  • Languages: C#
  • Platform: PC
  • Time frame: 1 Month (20 Hours/Week)
  • Team Size: Solo

Overview

I had this idea of combining Pac-Man with a roguelike setup. This meant that the levels would have to be procedurally generated.

Creating custom-generated levels for one of my favorite games growing up sounded awesome, so I decided to try my hand at it! I challenged myself to make the level generation as efficient as possible to improve my understanding of time complexity.

Key Achievements

  • ● Efficient level generator using the Wave Function Collapse Algorithm.
  • ● Pac-Man Character Controller that can move around and interact with the generated level.
  • ● Setting of grid tile sprites based on neighbouring tiles' state.
  • ● Post-processing effects to give an arcade screen feel.

Take aways

I now have a much better understanding of procedural level generation. I am unsure if Wave Function Collapse was the best choice, since it was difficult to encode more specific rules than simply determining which tile types are allowed to be next to each other. Instead of using pure Wave Function Collapse, I implemented multiple passes over the level to correct minor issues, such as dead ends.

Even though the algorithm generates playable levels, it is apparent that certain levels would be very difficult to play if the Ghost AI existed. Some generated levels have very long paths with no intersections, while others have "dead-end" loops, both of which would make it very difficult to escape the Ghosts.