Devlog #2 | Random Seeded Dungeon


The concept behind this is to allow the player to choose a seed from the main menu and play the game with that seed, or let the game generate a random seed.

The game will pass some data to the function, which will fully customize and generate the dungeon based on that data.

Starting with basic parameters like width and height, as not every dungeon has the same size.

image.png

And the content of the dungeon:

image.png

Once the data is sent, the function will begin generating the dungeon.

Here’s the procedural method it follows:

  1. Generate a matrix of the specified size and fill it with floor tiles.
  2. Fill the map’s border with walls.
  3. Create a labyrinth-style layout using walls (wall positions are determined by the seed).
  4. Place a door on a wall.
  5. Check if the door has walls on top and bottom to place it vertically, or walls on the left and right to place it horizontally.
  6. Place the key on the floor.
  7. Place the player on the floor (ensure the player can move to the key and door via the floor).
  8. Place enemy spawners on the floor.

The result looks something like this:

[ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ]
[ 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1 ]
[ 1,1,0,0,0,0,1,5,0,0,1,0,1,1,1,0,1,1,2,1 ]
[ 1,0,1,0,0,0,0,4,0,0,0,0,0,0,4,1,0,0,0,1 ]
[ 1,0,0,0,3,1,1,1,0,0,1,0,1,1,0,1,0,1,0,1 ]
[ 1,0,0,0,0,1,0,0,0,1,0,0,1,0,0,1,4,1,0,1 ]
[ 1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1 ]
[ 1,0,1,1,4,0,0,0,0,0,1,0,1,1,0,0,0,0,1,1 ]
[ 1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1 ]
[ 1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1 ]
[ 1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,1 ]
[ 1,1,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1 ]
[ 1,0,0,4,0,1,1,1,0,4,0,0,0,0,1,0,0,0,0,1 ]
[ 1,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,1 ]
[ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ]

Note: The wall placement is not perfect yet—currently, walls are placed randomly (using the seed) rather than following a pattern that reflects how a real wall would work.

Get Shadows and Sorcery

Leave a comment

Log in with itch.io to leave a comment.