Project 01GenerationGenerative machine learning · PCG

AI-Driven Procedural Level Generation: Learning Level Design

What would it mean for a system to learn to produce meaningful levels?

A conventional level generator follows rules a developer wrote by hand. A learning-based generator instead produces levels by placing or arranging tiles in response to examples, feedback or its own trial and error, but producing a valid level and producing a meaningful one are not the same thing. This project investigates what a learning-based generator has actually learned about level design, and what would count as evidence for that claim.

What does it mean for a generator to "learn"?

Two quite different mechanisms both count as learning-based level generation. One trains an agent to place, remove or edit tiles step by step, receiving a reward signal for how well each edit is going, and improving through trial and error; no example of a "correct" level is ever shown to it, the agent has to discover what works. The other trains a model directly on a corpus of existing levels, learning a compressed internal sense of what makes them look the way they do, then produces new levels by sampling from that. Both raise the same underlying question: has the system learned something about level design it can apply to new situations, or has it just found a way to satisfy whatever it was measured against?

Project concept

Take a genre or style of level design that interests you. Build a small generator, and investigate which properties it has learned, whether its levels stay meaningful rather than merely valid, and whether it produces genuine variation rather than close copies of whatever it was trained or rewarded on. A 2D representation keeps the project manageable; the level type, the generation approach and what counts as a meaningful result are yours to define and justify.

Pathways into this project

Two starting directions, among others, to consider; a project can also draw on both if that suits the question you want to investigate.

Learning through interaction. An agent edits a level step by step and is rewarded for how well its edits are going. The interesting failure mode here is reward-chasing: an agent can find edits that satisfy the reward signal without producing levels a designer would call meaningful, so the reward itself becomes something to interrogate, not just tune.

Learning from examples. A generative model is trained on a corpus of existing levels and produces new ones by sampling from what it learned. The interesting failure mode here is memorisation: a model can produce levels that look plausible while having learned little beyond how to recombine or lightly perturb what it was shown.

Questions to consider

These are possible directions for your investigation, not a ready-made research question.

  • What would distinguish a level your generator produced because it learned something, from one it produced by coincidence or by copying?
  • How does the representation of a level shape what the generator is capable of producing?
  • What happens when the generator is pushed to optimise one desirable property at the expense of another?

What might you produce?

Some working generator, whichever pathway you take, together with a way to inspect or export what it produces and evidence that characterises its outputs, including where it fails. The exact form is open; an authoring prototype, an editor plugin, a batch generator with an inspection tool, or something else that suits your chosen genre.

Possible approach

A compact 2D tile map is a practical starting point for either pathway. For learning through interaction, an agent could edit through a Gymnasium-compatible interface; for learning from examples, a small generative model such as a VAE could be trained on a corpus of levels.

Investigating the result

Define what a meaningful level looks like before training starts, then check generated levels against that definition directly, separately from whatever the system was optimised or trained against; a high reward score or a low reconstruction error does not by itself tell you the levels are good. Consider variation between generated levels, constraints, and, for the examples pathway, overlap with the training data. A baseline and repeated runs make the claims more informative.

Core concepts

  • Procedural content generation
  • Meaningful variation versus validity
  • Level representation
  • Reward design or dataset preparation, depending on pathway
  • Novelty versus memorisation

Indicative technologies

Choose tools that suit the research and pathway. An engine is not required if a simulation can answer the question.

  • Python with Gymnasium and an RL library such as Stable-Baselines3, for learning through interaction
  • Python and PyTorch, with a small VAE or another justified generative model, for learning from examples
  • Godot, Unity or Unreal if a game-engine workflow is useful

Keeping the scope manageable

Staying in 2D and settling on one well-defined level representation keeps the project achievable; the interesting questions about what the system has learned are just as answerable in a tile grid as in a full 3D level. A complete playable game or a new learning algorithm is more than the project needs; discuss with your supervisor how far to take the generation approach itself.

Explore the literature

Search the library using relevant terms such as:

  • procedural content generation via reinforcement learning
  • PCGRL
  • generative models game levels
  • expressive range analysis
  • novelty and memorisation in generative models

Papers and reading

  • Khalifa, A., Bontrager, P., Earle, S. and Togelius, J. (2020) PCGRL: Procedural Content Generation via Reinforcement Learning. Proceedings of the 16th AAAI Conference on AI and Interactive Digital Entertainment (AIIDE). AAAI (also arXiv).
  • Volz, V., Schrum, J., Liu, J., Lucas, S. M., Smith, A. and Risi, S. (2018) Evolving Mario Levels in the Latent Space of a Deep Convolutional Generative Adversarial Network. Proceedings of the Genetic and Evolutionary Computation Conference (GECCO). ACM Digital Library (also arXiv).

Recommended reading:

  • Shaker, N., Togelius, J. and Nelson, M. J. (2016) Procedural Content Generation in Games. Springer.