itch.io is community of indie game creators and players

Devlogs

Procedural Map Generation [1]

Py-Py-Pyramid
A downloadable game

Took some more time during the week to learn about different ways of generating the map! In the end I decided to try out a binary space partitioning tree first because it's super straightforward.


▬ Binary Space Partitioning

  1. Split the map in two parts at a random point either horizontally or vertically. You get two child nodes.
  2.  Now do the same for both of the new child nodes
  3. Repeat for each child node until the areas are of the smallest size you'd like to have
  4. Add a room to each leaf node at a random position
  5. Connect the room to the sibling node's room
  6. Move up to the parent node and connect to a random child node of the sibling node

After tweaking the values these are some of the results I got:

It's fine I guess. There is not that much variety because of the way BSP works and my room sizes being very limited. I don't want the rooms to be unnecessary big or small. What I don't like is the backtracking in some of the maps. Maybe it could be fun tho with a ⛏️-item (dig wall tiles one by one) or a 🧨-item (blow up several tiles at once) etc.

There is even some unintentional "concept art" (pff) I did for this:



Anyway doesn't mean I have to use only one algorithm to generate floors. Could also use this one for some floors and for other floors hand crafted maps with puzzles to have some variety. But that's something for the future mappi. Right now getting the basics done has priority!


▬ Next step

Gonna have to improve the generation process (like add a min. room count --- oops! lol (because there is a small chance of not generating a room inside a leaf node)) and add stairs! After that the player will be able to explore the pyramid without distraction... f o r e v e r--


Read comments (2)