A downloadable study for Windows

2D Platform Generator is a prototype I’m building using the Unity engine for my master’s dissertation on the generation and evaluation of platform games using rules. The purpose of this project is to build levels for a 2D platformer using a set of grammatical rules and to determine whether the levels are playable.


List of controls:

  • You can move using the WASD keys or the arrow keys;
  • Jump and double jump using the space key;
  • You can wall slide by pressing the move key in the direction of the wall;
  • You can jump while wall sliding.

Study instructions:

If you want to participate in my study please follow the next steps:

  • Download the prototype and run it as instructed below;
  • In the game click “Choose Levels” and play through all the levels;
  • Every time you finish a level your progress is saved and you can see this progress in the Level Selection menu;
  • Once you completed all the levels please fill out the following form: https://forms.gle/Yvw3mBLaBURTHiAy9

Note: If one of the levels is too difficult or impossible to complete, please skip it by going back to the Level Selection menu and selecting another level.


Summary of the generation process:

The generation beginnings with a set of graph grammar rules, below is an example of what these rules look like:

Example of a Grammar rule system

The rules are then used to create a mission map by evolving and mutating a graph called host, this process evolves finding subgraphs in the host that match the left side pater of the rule, and then replacing said subgraphs with the pattern on the right of the rule.

The mission map serves as a template for the level's fundamental structure, including details like where the next platform should be placed in relation to the one before it, what kind of platform it is, how often enemies or coins should appear, etc.

Example of a complete mission map

After that, the mission map is utilized to create a space blueprint, during which the mission nodes are transformed into prototype structures like specific kinds of platforms or terrains. Taking into account the player size and movement validations are made in order to find the best position to place these structures.

Finally, the best space map is transformed into the actual level by turning the structure prototypes into the game object that makes up the level.


Messing around with the rules:

If you would like to explore more and change the grammar rule system for generating mission maps and get different results when generating a level in the application, please bear in mind the following guidelines:

Locate the “2D Platformer Generator_Data \ StreamingAssets” folder in the game's root folder.

This folder contains two grammar json files, "MissionGrammar" and "MissionClosingGrammar". The first one is used to build the mission map normally, while the second one is used to finish the generation by converting any non-terminal symbols in the graph to terminal symbols.

Json file rules:

  1. Json holds an object called "Items" which is a list of all rules;
  2. Each rule is composed of an id, a left-side graph and a list of right-side graphs;
    1. The rule Id is important because it's used to reference the rule in the field AssociatedRules (2.3.2);
    2. The rule Left is a graph that contains a list of vertices (3) and edges (4);
    3. The rule right sides or mutations are composed of a priority value, a list of AssociatedRules (2.3.2), a list of vertices (3) and a list of edges (4);
      1. The Priority is a percentage of how likely this mutation should be picked over the other rights, represented with a float from 0 to 1.
        IMPORTANT:  The sum of all right sides' priorities must be 1;
      2. The AssociatedRules is a list of rule ids, this list is used by the application to more easily pick the next rule to apply.
        NOTE: If this list is empty the application will still check to see if it can use this rule;
  3. Each vertex has a type and an alias;
    1.  Type is a string used in finding matching nodes to apply rules, 
    2. A vertex's type can be either terminal or non-terminal. Non-terminal types are just used for match-finding and can be of any kind. However, the host graph must be finished with terminal nodes that are used to convert the mission map nodes into the space map prototype structures. At the moment, they must be one of the following: "coins," "enemy," and "platform";
  4. Each edge has reference to a vertex "Source" and another "Target", it also has a type and a slope;
    1. The edge type is not used right now, all edges are normal, but it will be used to associate a vertex to another with a special link, for example, a lock to a key;
    2. The slope of an edge determines the elevation of the target vertice compared to the source vertice, if the value is 1 the target vertice will be placed northeast of the source, if the value is -1 it will be placed southeast, if the value is 0 it will be placed directly east of the source vertice;
    3. The source and target are references to the alias of a vertice.
      IMPORTANT:  When replacing nodes edges coming into the pattern are associated with the lowest alias and edges going out are associated with the highest alias number.

Credits:

Game Engine used: Unity;

Player art and script behaviour: The fantastic Metroidvania Controller by Aisukaze Studio. 
https://assetstore.unity.com/packages/2d/characters/metroidvania-controller-1667...
 With the attack, shoot, and dash features turned off;

Coins and Enemy art: Modified version of the cute sprites in Simple 2D Platformer Assets Pack by Goldmetal.
https://assetstore.unity.com/packages/2d/characters/simple-2d-platformer-assets-...;

Trees art: Simple Trees by Jestan.
https://opengameart.org/content/pixel-art-simple-trees;

Rocks art: Nature pixel art base assets FREE by Blackspire.
https://assetstore.unity.com/packages/2d/environments/nature-pixel-art-base-asse...

Sound Effects: https://mixkit.co/free-sound-effects/

Music:  Adventure by Alexander Nakarada | https://www.serpentsoundstudios.com 
Music promoted by https://www.chosic.com/free-music/all/ 
Attribution 4.0 International (CC BY 4.0) 
https://creativecommons.org/licenses/by/4.0/

Inspired by the paper: Joris Dormans. 2010. Adventures in level design: generating missions and spaces for action-adventure games. In Proceedings of the 2010 workshop on procedural content generation in games. 1–8.

Generation engine and prototype building: Diogo Soares (me)


Thank you so much for your participation and feedback!

Download

Download
2DPlatformerGenerator_1.0.zip 32 MB

Install instructions

After the download is done, please unzip the contents into a folder and then double click on the file "2D Platformer Generator.exe" to run the game.

If the window of the game is too small or some UI elements are outside of view please adjust the size of the window. 

Comments

Log in with itch.io to leave a comment.

great job! I played through about 7 levels and it not that the levels got too hard but the length of the later levels was a bit frustrating without coyote jump. many times i felt as if I should not have fallen to my death but i was only able to jump once.  Overall though for the system you created. seriously great job, i am building a procedural platformer right now so it was great to see the theory behind your solution!!