top of page

Duo Dilemmas|2022

Path Generation

Puzzle Generation

About

Genre2D cooperative game with procedurally generated puzzle-platform levels

Software: Unity 

Project Type: Solo Project

Design and Development Time: 5 weeks

Supervisor: Professor Chris Barney

GitHub

 

My Role: Game Designer, Programmer

My Responsibilities: ​

  • Designed the heuristics for cooperative level generation 

  • Paper prototyped the initial design with modular pieces for path and puzzle generation

  • Programmed the level generator algorithms such as path generation, room type generation and puzzle generation

  • Programmed gameplay system and mechanics for the Unity game engine scenes

Concept

This project is about procedurally generating cooperative puzzle-platform levels with mixed-authorship approach. Players need to cooperate in order to progress through the puzzle platforming levels. The game can be interesting for the players who love playing cooperative games, puzzle games, and platformers.

Levels are generated in three phases: 

  1. Generating the main path consists of connected rooms with openings

  2. Generating room types with specific difficulty levels

  3. Generating puzzle pieces and placing them in each room

Inspirations

It Takes Two

It Takes Two.jpg

I analyzed the cooperative puzzle techniques used in It Takes Two, and deconstructed its levels into components including mechanics, interactable objects, challenges and puzzles, and narrative. Then I designed new rules and heuristics based on the analyzed cooperative puzzle techniques, and finally I generated new levels by putting components together.

Catlateral Damage

Catlateral Damage.jpg

I was inspired by level generation approach in Catlateral Damage. Generating levels happens in three steps, in which rooms of a building will generate with open doors between them. Then, each room has appropriate furniture placed within it according to the type of room. Finally, the physics objects that the player will interact with are placed on top of the furniture.

Spelunky

Spelunky.jpg

Spelunky was my first source of inspiration for generating the level layout. In this game, after the first room is randomly generated at the top row of the level grid, next room will be placed to the left/right/bottom of this room. This process is repeated from room to room until the generator gets to the lowest level. However, in my project, the rooms are generated in four directions.

Level Generation Approach

Circulation Patterns

One solution to generate levels is to segment level design into circulation patterns - how a player moves a character through a gamespace. We can divide these circulation patterns into three categories of Meta, Macro, and Micro circulation patterns. Meta Circulation patterns define how the player moves through the overall game, Macro Circulation Patterns relate to the way a character moves through a level, and Micro Circulation Patterns are composed of movement in individual encounters within a level.

 
 

Visualization of the concept of circulation patterns in Super Mario Bros.

 

Applying Circulation Patterns in this Project:

Using this approach for  level design in this project, each level is generated in three phases based on a sequence of circulation patterns. The output of each step in the level generation will be the input of the next procedural generation phase:

  1. Meta - Each level contains different critical path with specific rooms (level segments)

  2. Macro - Each room is actually a puzzle with problem and solutions in it and different level of difficulty

  3. Micro - Problems and Solutions are generated from a pool based on the characteristics of each room (puzzle).

 

Procedural Elements Based on Circulation Patterns

Mario.JPG
8_edited.jpg

Meta-level Circulation Pattern

  • Path generation and level layout (combination of rooms - level segments containing puzzles)

  •  Entrance and exit generation for each room

  • Shortcut generation to have multiple paths in the game

Example of main path generation

Macro-level Circulation Pattern

  • Room type generation based on puzzle types, and their level of difficulty.

    • ​Puzzles are categorized into two types of Ability-based puzzles and Skill-based puzzles

8.jpg

Example of room type generation

Slide24-.jpg

Micro-level Circulation 

  • Puzzle Pieces Generation based on the type of problem and solution for each puzzle, and players input

    • Problems:

      • GapsObstaclesEnemies 

    • Solutions: 

      • Platform generation

      • Interactables in the environment

        • BridgesCatapultCraneDoor etc.

    • Inputs - Player abilities (mechanics) and their skills -
       

  • Placement of the puzzle pieces in each room.

Example of a generated puzzle room

The Intent of Procedural Elements

Level Layout Generation

Using Random Walk algorithm, the whole level layout and a primary path through level is generated procedurally, which contains 10 rooms with their openings, and possible shortcuts to provide multiple paths in a level and give more autonomy to the player. The Primary path is  the longer path which is about learning a set of puzzles based on  difficulty progression as part of the algorithm. The shortcuts follow the risk-reward concept. They are created when there are 3 or more puzzles with a difficulty progression chain, then if the players can skip from the first one to the last one by opening a new path, they’ll have a chance to get training or take the shortcut and pick the challenge. Therefore, shortcuts become challenges, not just random paths.

Puzzle Room Generation

Each room contains a specific puzzle type (ability-based puzzle or skill-based puzzle) with a different difficulty level. The order in which the puzzles would appear on the main path will be determined by an algorithm so that players have a chance to build up their skills for specific types of puzzles and the puzzles won’t feel random or unsolvable.

Library of Puzzles

Puzzles are categorized into two types of Ability-based puzzles and Skill-based puzzles by the designer. Ability-based puzzles that player only needs to apply a mechanic (without a specific skill) to solve a puzzle,  and skill-based puzzles which player needs to use their ability to apply a mechanic with specific skills (like precision and timing) to solve a puzzle. The difficulty level of each puzzle is marked in the library, as well.

Puzzle Pieces Generation

Each puzzle contains a set of problems and solutions. Problems include gaps, barriers, obstacles, or enemies. Solutions include interactables in each room based on the puzzle types and their difficulty level such as bridges, doors, catapults, cranes etc.

Placement of the Puzzle Pieces

Then the algorithm will decide on where to place the puzzle pieces in the room so that it’s accessible and solvable for the players.

Keep Track of Generated Puzzles

For each interactable (solution) that the algorithm finds, it keeps track of what solution was applied, and it wouldn’t apply the same solution multiple times in a level or so many times so that the puzzles won’t feel random or repetitive.

Keep Track of Who Leads

The puzzles are also labeled as synchronous or asynchronous co-op. A synchronous co-op is when both players are involved in solving a puzzle, while in an asynchronous co-op, only one player helps the other player. In order to have interesting puzzles for both players, an algorithm will keep track of which player helps the other player in every puzzle, and will generate the next puzzle in a way that they change roles for the next puzzle.  

Design Process - Generative Code

  1. I started by brainstorming the aspects of PCG games that I wanted to work on such as procedurally generating puzzles and platforms (since I’m interested in platformers and Metroidvanias), mixed with my interest in exploring cooperative dynamics. I decided to work on a project that procedurally generates puzzle platformer levels for cooperative play. I was inspired by Spelunky and It Takes Two for level generation and cooperative puzzle creation.

  2. I’ve done research on how to generate levels, especially levels with cooperative puzzles, and I found a few inspiring articles. In one of the articles, they generated levels with cooperative challenges and I got very interested. As for their future work or filling the gap, they suggested generating cooperative puzzles that are balanced and interesting for both players.

  3. I’ve also done research on how to design and develop good cooperative games and if it’s possible to develop cooperative games using patterns, or even how to evaluate good cooperative games and found some articles that presented some cooperative techniques to create cooperative games. Literature Review​

  4. One of the paper's approaches to designing level generators was to divide the design problem into smaller parts. These sections can follow the circulation patterns of Meta, Macro, and Micro circulation patterns. This helped me to design the level I wanted to design in three phases and better plan for development.

  5. I then started with analyzing cooperative puzzle techniques used in cooperative games such as in It Takes Two and deconstructed its levels into components including mechanical components, objects or interactables, challenges and puzzles, and narrative components. Then I designed new rules and heuristics based on the analyzed cooperative puzzle techniques, and finally I generated new levels by putting components together. 

  6. I made a paper prototype of the cooperative levels by designing an algorithm and using the rules and heuristics from the last step. Paper prototyping helped me in balancing the procedural elements and tuning the algorithms thus adding more meaning to the procedural content. Some of the paper prototyping results helped me to understand how to:

    • Keep track of generated puzzles

    • Iterate on the difficulty of the solutions for puzzle challenge

    • Keep track of Who Leads

    • Consider asymmetric difficulty

    • Change the grid size and initial room spawn point

    • Create shortcuts to add multiple paths

  7. I iterated on the paper prototype































     

  8. Started implementation in Unity by generating the main path with openings, determining room types with difficulty levels, and generating Puzzles in each room

20230227_153719-.jpg
Paper Prototype1.jpg
bottom of page