nomsmakesgames
nomsmakesgames
NOMSMAKESGAMES
3 posts
Don't wanna be here? Send us removal request.
nomsmakesgames · 1 year ago
Text
PROCEDURAL DUNGEON GENERATION (PART 2)
If you need a recap take a look at part one of this short saga.
This time I came prepared. The goals aren't as simple but here is a breakdown:
A room roster of multiple types (entrance, room, hallway, dead end, exit)
Each room has an entrance and an exit point marked
Starting with an entrance, generate the next room or a hallway untill a given room count is reached
An exit room is placed on a random leftover exit point
Any and all leftover exits are patched up with dead end rooms
AND IT ACTUALLY WORKS!
really tired, ill elaborate tomorrow
Enjoy a working generator generating 2000 rooms.
0 notes
nomsmakesgames · 1 year ago
Text
PROCEDURAL DUNGEON GENERATION
Where do you start when you know nothing about a given subject? Reading material? Tutorials? My big head went straight to trial and error, figuring it would be the most robust way to learn this.
The goal is as follows: Write a script that selects a premade room from a roster, plops one down, finds an exit and places the next room at that location. Ad infinitum. Then I just make a bunch of rooms and plug them in the roster. I also decide to stick to a grid to make things easier.
Instead of writing a single scrpit to handle all of this I decided to bless each room the power of creation. Each room gets placed then it decides what and where to place next. This seemed like an okay way to proceed but little did I know it would come to bite me in the ass sooner than you think.
Obviously some rooms can have more multiple exits so we end up with some basic room shapes:
"I" shape
"T" shape
"+" shape
"L" shape
Tumblr media Tumblr media Tumblr media
The red arrows mark the exit points.
So far so good. Except it isn't and we are just getting started. The first run of the script gave me a pile of overlapping meshes. I need to check for collision. Is there something in the way?
There is also a problem of actually gamifying the dungeon. In other words, the dungeon cannot just be a maze like the ones you find on the back of a newspaper. It should have a start and an end, and some flow to it.
It was at this point I realized I was way in over my head.
So I set the number of rooms I want it to generate, and once the number is reached we place an end room. I set up 'primary' and secondary exits. That way it knows which path to prioritize and where to place dead ends. I also modify the "randomness" and make some rooms spawn more often than others.
Here you can see the script in 'slowed-down' action.
Tumblr media
It works but has a lot of drawbacks, main one being that more often than not the script fails to actually generate the given number of rooms due to the way it was written. It winds it self up like in a snake game. The easy solution is to run the script again untill it succeeds.
Also, remember how I said that not making a single script would come to bite me in the ass? Well here we go. The way I set this up meant I have little to no controll over the room size. Therefore I cannot place larger room since the room that does the spawning has no idea how large the next room is. I just hard coded the room size to be the exact same every time.
In short this was a good exsersize but ultimately fell short of my expectations and goals. I am to rewrite the script and learn from these mistakes. Cue part two where I start over.
Enjoy a few more gifs of the script running.
Tumblr media Tumblr media Tumblr media Tumblr media
0 notes
nomsmakesgames · 1 year ago
Text
Hello_world!
Starting TODAY, I've decided to document my progress in making video games. It's mostly for my own sake but feel free to join in.
0 notes