Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Which type of generation should I use for my game?

A topic by Gub created Aug 28, 2024 Views: 239 Replies: 7
Viewing posts 1 to 5
(+1)

I am making a procedual dungeon crawling game but I can't decide between two different types of generation.

Current generation: each room spawns another room which can lead to some maps being really big or really small but might make exploring a bit more fun.

Restricted generation: use some form of pathfinding so that the level will always stay aproximately the same size which isn't as chaotic as the other generation type but might make it less fun to explore?

Which one would people enjoy more?

Maybe take the reason for the dungeon dive into account. Is there an objective or time/ressource restraint? And is this as linear as you wrote it or is there branching? If each room always only spawns one other room, that is not a map, but a road.

Is there backtracking, can you go in circles? Do you have to go back? Can you get lost? Does the player see a map? Is the map size/length a factor to decide if the player can win the crawl? Will there be more levels? Is the player expected or required to explore the whole level or is it: search the stairs to advance.

Arbitrary/rng artifically prolonged level size typically is not fun. So you should restrict size in some fashion.

I would like it if the player would walk around the level and find loot, like maybe they will find the exit but will want to keep exploring for any loot they may have missed or any enemies they could kill before moving on.

Have a look at Backpack Hero. They have rng maps. But there is a limit in size due to the map being on a grid that seems to be fixed size.

You can judge from there if the concept of your game would benefit from "chaotic" maps or from similar size maps. Ultimately it is a game design choice.

(+1)

I like when random dungeons are allowed to get a little bit crazy. I used to play a lot of ZAngband (roguelike) and sometimes a floor would be super small, which often meant that it was packed with monsters and items. Other floors would have huge open spaces (like almost the entire level). It really helped to break up the monotony of predictably sized hallways and rooms. It made things more fun to explore and also introduced strategic decisions, for example when entering an open-cave style level you could easily aggro too many monsters and get surrounded, so finding a safe spot to use as a home base was more important. 

I think you should try and set up a simple way of testing a few methods of building maps and then viewing or playing through them. I've never released a procedurally generated dungeon game, but I've played around with making a few generators (I love old-school roguelikes).

Depending on the scale of the game, you might want more than one way of generating dungeons and also try to see if you can mix them, like doing one pass with "hooks" that the second pass (a different method) can use, or having "refinement methods" after doing an initial generation.

I know that there are tons of ways of generating dungeons, but I think they mostly come down to a set of functions with rules, refinement methods and a potential fail state, like if not enough rooms are generated; discard and try again (though once again; I haven't made a full game like this, so I could be wrong).

I'm not sure if this is helpful at all, but I made a quick animation to help describe one of the methods I've tried, which is terribly simple, but might help with some ideas?

This method starts with plotting a "room". Each room has a minimum and maximum size, with red pixels representing "open positions". Each time a room is successfully built, it is added to the room counter.
The map is scanned to find "open positions", then selects one randomly.
A path will be made. Paths have a minimum and maximum travel distance, as well as a minimum for when they can turn.
While the path travels, it will place down "open positions" on its sides (keeping a minimum spacing variable in mind) and end with an open position.
A path can intersect with another path or room, but only if it hits on a 90 degree angle, avoiding making paths and doorways over a pixel wide.
From here, we go back to scanning for open positions, but will also attempt to build rooms (if there is enough space). Loop until a condition is met.
A clean up occurs. This locates the ends of paths, then erases them until they hit a connected path or room, leaving a single open position where the last cleaned tile was erased.
Repeat the "find open position and build room or path"-step, with a clean afterwards, keeping a minimum and maximum amount for these steps to loop.
Check if the generation has made at least the minimum amount of rooms... I think I set it as 5 when I was actually playing around with my last demo... You want a number that is at least interesting, but small enough that the generator will succeed most of the time.

Though this is really simple, I think it's enough to start building a dungeon. After this, you can use it to build the fun details. In my quick animation, I then placed walls around the paths and filled open positions with wall tiles, then selected a room as the starting position, marking the room and connected paths as "1", then selecting a connected room as "2"... unfortunately all the path tiles were connected to room 1 (whoops), but I would of repeated. The idea is that you will have a logical ordering of rooms, as long as a room "6" (for example) is not blocking room "5", you can now place keys for rooms on any tile lower than the required door.

Maybe this could also be used to logically place monster and loot with higher levels.

Sorry for the rant there... I'm probably not telling you anything new, but maybe it helps with some ideas or someone else who is thinking about building some dungeons (but wants a simple place to start) might see this.

best of luck.

(+1)

Thanks for the suggestions but I think I will go with a system that spawns rooms onto a grid, each room has an exit on all sides (except for the start room) as I think it will fit the general feel of an open but dark dungeon filled with enemies. 

I am currently basing this off a not very well known (but extremely underrated) game called Barony that I used to play, I like the idea of being able to explore a bunch of different areas without going through many tight corridors which that game does well in my opinion.

I played Barony! Was really bad at it so I didn't get far haha, but it was pretty cool