AI Creativity Support

Using PCG algorithm to aid game level designer’s creative process

Skills Unity (C#), User Research, Ideation, Product Management
Role Developer, UX Researcher & Designer
Team Elias El Kozah, Yvonne Fang
Duration 4 months


As an artist myself, I am interested in exploring procedural content generation’s (PCG) (specifically the Wave Function Collapse (WFC) algorithm’s) possible function as a co-creative tool in a visual art or design context. This project focused on using WFC to generate game levels in Unity, specifically for the Dice Adventure game used in a long-term project studying how humans and AI teammates cooperate in asymmetrical collaborative games.

Initial Literature Review

To approach the problem of designing a PCG tool for a game designer, I first consulted academic literature to learn about possible opportunities. From my initial conversation with the research team, I understood that the problem is twofold: 1) to help game level designers create more new game levels faster; 2) making sure the generated game levels promote collaboration between players due to research needs.

1. Helping the Game Level Designer

Khaled, Nelson, Barr, in their 2013 paper, focused on how using design metaphors, namely Tool, Material, Designer, and Expert, to frame PCG tools can help designers choose the tools that fit their purpose the best. In particular, Tool and Material served as very appropriate metaphors for the Dice Adventure PCG tool. This paper also highlights an open opportunity in the PCG space of designing PCG tools in a designer-centered way, which influenced my decision to interview the design team as well as the game designer, in order to create a tool that better fits the designer’s workflow and design rationales.

2. Making Sure the Generated Levels Promote Collaboration

Liu et al. (2022) and Fontaine et al. (2021) described approaches these researchers used in their own games to facilitate and measure the level of collaboration needed in procedurally generated game levels. In particular, Liu et al.’s method of generation based on game level chunks that are designed to encourage collaboration served as an inspiration for my approach to designing the PCG tool for the Dice Adventure game.

Research & Needfinding

Research Question 1: Why is the current game level design process slow?

I conducted a semi-structured interview with the game design and development team, and learned that the main pain points faced by the team, which has only one designer, are the difficulty in expanding beyond 10x10 levels with sufficient complexity, and the general unstructured design process.

Research Question 2: How does the team currently design game levels that promote collaboration between players?

In order to understand the individual creative process of the designer, I conducted another think aloud study with him, so that I can glean insights about his process and design rationale as I observe him working.

Takeaway 1:

I learned that the designer usually starts by just having fun with the terrain-making process of placing the wall tiles. Also, the designer usually would just put rocks (R) around Giant’s Altar (A(G)) for challenge, or at most 1 trap (T) for added challenge, and 1 rock (R) near Dwarf’s Altar (A(D)), which according to him is already challenging enough, and that more traps (T) around Giant’s Altar (A(G)), for example, might cause monotony.

Takeaway 2:

Additionally, the designer would intentionally create opportunities for the AI to make a decision, for example, by having 2 different obstacles blocking 2 different paths at a 2-cell wide choke point. The designer also had monsters of varying levels of difficulty (1-3), and monster level 2 is about the same difficulty as rocks or traps, while monster level 3 is easier and usually put near rocks or traps.  

Revisit Problem Space

Since the game design and development team only has one level designer, it is currently difficult for them to expand the level design beyond a 10x10 map scale and include more complexity. Additionally, the level designer currently does not strictly follow any process for level design. However, he does follow some general patterns and have specific design rationales to back up his design decisions.


Creating a tool that can automatically generate new game levels with a click of the button can help the game level designer expand game level design beyond a 10x10 grid. Encoding some of the designer’s design rationales can also help the designer create high-quality game levels quickly.

Design Goals

The main design goals was to create a script that the designer can use within Unity, which enables quick large level generation and provides some kind of control for the designer to specify specific traits they want the final generation to have, including the rough amount of collaboration the game level should require. Another overall goal is based on my conversation with the level designer, which revealed that he usually starts his design process by creating a terrain with wall tiles largely randomly, creating some form of constraint for himself to work from. Therefore, it makes sense for the script to work from an existing well-designed level, so that the generation outcome can serve as a high-quality intermediate design product, which the designer can further modify to create the final level design.


(Github Repo Link:
(Generation results)
(Testing process)

I chose the Wave Function Collapse (WFC) algorithm as the basis of the PCG tool, since this algorithm is relatively new and works well with a Tilemap in Unity. In addition, there are a few prior implementations of this algorithm online. Our team chose to work with the one by Sunny Valley Studio. The implementation first reads in an input tilemap, encodes the different tiles in numerical values, then assigns a unique number for each pattern made up of n x n tiles specified by the user. It uses the overlapping model where patterns can overlap each other as long as there are no “conflicts.” It solves for a final solution by “collapsing” or solving cells one by one based on how low their “entropy levels” are. Based on the existing implementation, I added the following features:

  1. The script consistently leaves three open tiles at the bottom left corner of the game level for character spawn (according to how the level designer is placing characters currently)
    1. This is achieved through keeping a list of patterns “legalPatterns” that would leave space for character spawn, namely, the pattern’s tile at 0, 1, 3 indices will be open tile or road. (Figure 1)
    2. The solver would then “collapse” the (0,0) cell first, and randomly assign to it a pattern from the list “legalPatterns,” after which the algorithm would choose the lowest entropy cell to collapse as usual.

  2. The script also checks if the generated levels have the correct number of required elements, namely 1 Giant’s Altar, 1 Human Altar, 1 Dwarf Altar, and 1 Gate.
    1. This is done by iterating through the solution “output grid” and checking if the current solution satisfies the requirements, and if not, the algorithm backtracks and resets the solution grid to solve for a new design.
    2. This makes sure that no matter how large the generated level is, there will always be exactly 1 Giant’s Altar, 1 Human Altar, 1 Dwarf Altar, and 1 Gate, generating a valuable intermediate design product.

  3. I edited the code to enable generation of arbitrarily large game levels. This could be further improved by encoding some kind of rule where the number of game elements increase in proportion to the game level size

  4. To increase levels of collaboration required in the game level, I attempted to implement constraints where (for pattern size 3) the cells in the three rows below the top border, for example would not contain any possible solution that included one of the altars (giant’s or dwarf’s), so as to make sure the altar would be placed on the border, which will add to the level of collaboration needed by reducing paths to access the altar. The way I approach it is by removing any pattern containing the altar from the list of neighbors of cells in these three rows, initially when the dictionaries containing each cell’s neighboring cells are initialized. However, this made it nearly impossible for the algorithm to find a solution, so I decided not to include the code for now.

Limitations & Future Work

  1. Implementing the algorithm from the ground up.
  2. Implementing other PCG/generative AI algorithms, for example, GAN+MIP, markov chain, genetic algorithm, or rule-based generation methods.
  3. Refining the UI of the Unity script. More visual information can be offered to the designer to explain how the generation works. There is also an opportunity to visualize the generation process in some way.
  4. Integrating the PCG tool better with the game development pipeline, rather than restricting it to the 2D representation of a tilemap.
  5. Implement flood fill to check for solvability.
  6. UI for the designer to specify any specific element that they want to place at a specific cell. The UI could include input fields: “Specify row”, “Specify col”, “Specify element”.
  7. A score system where the system can produce a quantitative assessment of the level of collaboration required by the generated game level, specified by the table below