Procedurally generated rooms (Binding Of Isaac Style)

I am currently working on making a RogueLike similar to The Binding Of Isaac and have sunk multiple hours in trying to find some code or a tutorial of some sort helping to code this sort of room generation but to no avail. I want to create a procedurally generated dungeon where all rooms are side by side same size with no hallways and since I’m relatively new to C# and Monogame I’m in real need of help. Does anyone have any ideas on what I could do?

This is a question of the same caliber as “how do i maek a game lul”. Ask concrete questions, split the problem into a bunch of smaller subtasks and solve them first. Ask concrete questions, and you’ll get concrete answers.

The way Binding of Isaac works is that they have a lot of presets, so there’s not actually any room generation going on aside from the random entities that spawn in.

If you’re really new, you could just hardcode the values of the room in through a string.

Something like;

        const string level =
            $"00000000000" +
            $"0  0     00" +
            $"0  0   0  0" +
            $"0         0" +

And then you could iterate through that string you made as you load it, where a ‘0’ is a rock (or whatever) and a ’ ’ is nothing.

Later on you could come up with some “level editor” approach, but that might be overkill for something as simple as a couple rocks in a room.

I would load these up into 2D arrays at the start and use them as needed.

char[,] rocky_floor = new char[11, 5];


var rocky_floor = LoadFromString(level);


char[,] LoadFromString(string level) {
    // Parse level string and convert to char array here
1 Like

He’s asking very specifically about room generation. I don’t see a problem with that, if you had nothing to say then you didn’t have to post lul


And how is that specific? : )

Because Binding of Isaac works in a very specific way

He’s going down the road of randomly generated rooms when he just has to make a couple templates that are randomly selected if he wants to replicate it.

Thank you. I see ill look into this and see if I can replicate something like this in my project I appreciate the advice

My apologies, my question may have not been clear as jamie_yello said I had issues with the room generation itself. : )

Imagine a cross in the center of your game world. You have 4 directions: up, right, down, left.

Now imagine a blocky snake would crawl from the center of the cross to each direction for a specific time.


  • The snake can’t go backwards, but all other directions
  • If the snake bite herself it just replaces this specific segment or just crawl over without replacing.
  • If a certain length is reached, the snake cut off her tail and moves her head back to the center of the cross and starts creating new segments for the new direction.

Special Segments & Parameters:

  • A special segment (boss room) will be created if certain parameters are fulfilled. For example “crawl_length==6”,
  • Each segment contains information like the normalized direction of the snakes head during her crawl do determine if there is a connection (door) to an adjacent segment.

Post Build:

  • Fill the corresponding connections with elements like doors and/or decorations.
  • Be nice to your snake :slight_smile:

This is at least a basic room generation algo, which produces your desired layout.

On game time you would need to fill the corresponding segment with enemies, chests or what ever you like before the character enters the specific segment (room).

You could do that by placing a grid in each segment which goes from 0 to 99 and pre-define spawn presets for everything the good old string-table way like in the post from @jamie_yello


Thank you for your advice I’ve been working on creating something based on your response
: )

1 Like

saw this on twitter, might be relevant!

1 Like