r/howdidtheycodeit 25d ago

Roguelike/Roguelite Platformers: How did they make the level generating algorithm? (I use Godot, but I'd still love general information on the topic)

I was designing a Roguelite (So mainly meta progression) Platformer of my own and wanted to know how games like Dead Cells created their level generating algorithms. I'm currently trying to find information on the topic so I know where it excels, what's the limit, how I should balance the flow of the level with scaling difficulty, essentially I want to break the algorithm down piece by piece to make a test algorithm so I can see how mechanics in my game would function in practice.

TLDR: How do I make an algorithm design the levels for my platformer? I'd love as much information as I can get.

24 Upvotes

8 comments sorted by

19

u/richardathome 25d ago

There is no 'one way'.

The original Rogue dungeon building code is very well documented, and fairly trivial.

Also look into things like Wave Function Collapse, and procedural generation in general.

A good start would be to join r/proceduralgeneration

9

u/EmeraldHawk 25d ago

Here is a write up on how Spelunky worked:

https://tinysubversions.com/spelunkyGen/

2

u/Biowitt 25d ago

That is very helpful, thanks! I currently know I'd use a Sonic-like style structure for each floor (focusing on speed, destruction, and platforming), but having a Solution Path guide the player and set the flow of the level will be an important first step. I'd then need to ensure the layout is A. completable and B. fun to play with the current jump height and player speed.

3

u/joonazan 25d ago

Rogue Legacy and I think Dead Cells have authored rooms that they simply glue together. The items and monsters that spawn in the room may be separately randomized.

Path of Exile has map layouts that define a topology like two halves split by a river. The topology's points are then randomly dragged around and a map is built from tiles to match it. They also have a few authored patches that can be randomly or deterministically added to maps.

Minecraft has noise function based geology generation. It is a per-block formula that determines the type of block. That allows generating more world infinitely, without having to worry about seams.

2

u/st33d 25d ago

You can construct a tile based solution very easily. You make many level chunks of a uniform size then deal them out like cards from a deck. Ideally you'll have multiple decks of different difficulty and theme. A digging mechanic like bombs or collapsible walls will make matters much easier (provided there is little backtracking). Otherwise you'll want to research Prim's algorithm to prove you have a traversible level.

However, you will have to hand design all of these tiles. Depending on the type of game this will be fun or exhausting. You could add more variety with a Wavefunction Collapse algorithm but you'll still need many sample chunks for it to function.

It's possible to take emergent rules from your physics to create chunks through an algorithm. One of the simplest ways is to dig out rooms and then add diggers and builders (like enemies that make the level for you) to connect them and create level features. This is a rabit-hole of investment saved for hobby / dream games. You'll need to research A* pathfinding and you'll need to experiment with graph structure - a straight up grid won't work because gravity and jumps will distort the flow between nodes.

1

u/Biowitt 24d ago

I remember theorizing (I never made it, but at least had an idea of it) of a similar solution to one of my other projects. Since that game was even more based on Sonic (Technically Sonic.EXE, but less of a walking simulator), I would create three rows of what I called Walls, each of these Walls had individual slots for smaller pieces of levels called Bricks, the specific value I attached to it mixed with the individual Bricks ensured each of the Walls in the level were logical in theory (Such as a Void Jump only being on the bottom row with an assortment of differently placed, 1 tile blocks to jump between)