Pyramid Plunge

Pyramid Plunge

xenonii  [developer] Nov 28, 2020 @ 8:43am
How to edit Room Templates (v0.6.7 +)
In update v0.6.7 you can edit the room templates used for the level generation. This is the first step toward creating a level editor for the game. But for now, notepad will be the level editor :)

Overview of Level generation
If you read the book of Derek Yu on Spelunky, you will see there are similarities here.
The level is generated by creating a grid of "rooms", e.g. 4x4 rooms.
The entrance is placed in one of the rooms at the top, and the exit is placed in one of the rooms at the bottom.
E___ ____ ____ __X_

The above level has 4x4 rooms, each represented by a character. The E represents the entrance and the X the exit.

It will randomly make a path that goes from E to X. We will put a 1 if we go to the left or right (to the sides), 2 if we down to the next level and 3 if we land in the room. We'll keep 0 to mean that we didn't visit that room.
1100 0200 0322 0013

Now that we have the above grid of rooms, for each room we will take random template from the appropriate set. We have 4 sets
0 will take from Random set
1 will take from Sides set
2 will take from Drop set
3 will take from Landing set

Once the level is generated as a set of characters, it will verify that the level is actually solvable, i.e. you can get from the entrance to the exit. If it's not solvable it will randomly remove some tiles at the edges and try solve it again. If it's not solvable for n tries, it will start level generation from scratch.

What is a room template
A room is made out of 10x8 tiles, and so a room template will be make of 10x8 characters, where each character will represent a tile.
0 means empty space, 1 means a wall, etc.
Here's a simple example:
0000000000 0000001001 0000001001 0011001111 0000000000 1111000100 0000000100 1111111111

File Structure
The text file starts with a comment encapsulated by /* and */. It gives a brief description of what each character will mean when actually generating the room.
The file has 4 sets of templates. Each template represents a room. Currently each set has 4 templates, but you can add more if you wish. The random level generator will pick up templates from this file to generate the file.
The groups are Random, Sides, Drop and Landing (See above for more info).
Make sure to have a single carriage return between each template, and also make sure too keep the sets headings (e.g. //Random, //Sides, etc).

Every time you change the file, you will need to restart the game.

If you have any difficulties feel free to ask on Pyramid Plunge discord:

Feel free to share your templates here too.
Last edited by xenonii; Sep 6 @ 7:26am
Date Posted: Nov 28, 2020 @ 8:43am
Posts: 0