Procedural Generation - Diving Deep into Dungeons
Rogue-likes and Rogue-lites are well-known for their replay value. Thanks to the environment changing every time the player restarts, they can play the same game over and over and still find new life in it . I have been given the task of creating the dungeons for Void and creating every single environment by hand would take an exponential amount of time along with an increasing amount of effort needed to come up with a different layout every time. That's where procedural generation comes in.
To put it simply, procedural generation uses algorithms to create new sets of data with the assistance of a collection of user-defined variables. It is used in a majority of games seeking to generate an infinite amount of content such as Minecraft and No Man's Sky. This is also how The Binding Of Isaac, a dungeon-crawling rogue-like, creates the layout of it's dungeons. Every time the player enters a new floor or starts a new game, the dungeon changes into a new series of connected rooms that are aligned along a grid. Each floor has a boss room at the end of a chain of rooms and the other rooms containing treasure or enemies randomly placed throughout. I used this as inspiration for the design of the dungeon in Void, but I had to come up with a way to script this behaviour.
After researching different methods I decided to adopt the "Drunken Walk" technique. You create a grid of "tiles" that each represent a potential room. You then create a "walker" that starts on a tile, picks a random direction each iteration, then moves to the next tile in that direction. During this you record it's path and turn every tile on that path into a room. To turn this new set of rooms into a dungeon, randomly pick a room with a dead-end to have a boss in it, then run through some weighted probabilities to determine if the rest of the rooms will have enemies or treasure. All of that was an abstracted version of what the code actually does, but it's easier (for me at least) to explain it this way. Either way, this creates a near endless amount of different configurations of rooms and passageways. To visualize all of this, I created a class that takes the newly generated set of room data and displays the corresponding sprites and objects in the scene.
Developing Void has presented quite an enjoyable challenge that taught me more about the rogue-like genre and game development itself. n the future, I plan to make something along the lines of a sandbox or open-world game, so learning about procedural generation will definitely prove useful.
Leave a comment
Log in with itch.io to leave a comment.