is killing me. I can't seem to do it. I've looked up so much info on this, played with examples and it seems my low math skills and lack of programming experience cause me to fail every time. The only thing i need to do to finish my rpg is finish the dungeon generating code. I've tried different methods multiple times and i can't get the results i need. i can hardly understand most examples i found on the GMC. The BSP method made the most sense to me but i suck at using data structures such as grids which are needed. i can only write the most basic of code with them.
I don't think i can even ask for help at this point… again another project of mine comes crashing down completely due to my lack of skill… i really don't know what to do. i REALLY wanna finish this game but i just don't know what i can do. it's one of the most frustrating experiences i've forced myself into. Everything else is done for the game too. Town generating, all the graphics, items, weapons, classes, etc. All i need is to generate dungeons, it can't be a full game without it and at this point, i can't hand make the dungeons - that would contradict every thing else in the game.Does anyone have any good advice for randomly generating dungeons, or no of tutorials or examples for idiots like me?
The method I'm using in my game 'lanarts' is pretty simple in concept. I place random rooms as rectangles, and then connect them with tunnels that attempt to dig until a certain depth, and then backtrack completely and try again. The dungeons turn out looking fairly decent, although I am looking into expanding this approach.
I'll dig out my old 3 hour Halloween entry.
Edit: Here we go.Few notes:1) Don't judge me on my code. This was done in 3 hours (actually, this was only 2 hours). The generation code is in Alarm[0] in controller_obj. I left in some bugs by accident before uploading here. You can go track them down by yourself, I guess, it's not a complex game by any means.2) The simplest solutions are often the best. Consider this: Do you need to have a complex branching structure? You can create artificial branching paths by using multiple locked doors/stairwells that move between levels rather than having them within the levels themselves. This often better as it more easily delineates areas from each other.3) A big issue with procedural generation is the AI. Most AI systems work on nodes and set-pieces, neither of which are easy to implement in proc gen. Nodes can be used but it demands pre-programmed rooms of some sort which damages the illusion you're trying to create.4) Try to get the setting to fit the limitations in your coding - at least until you become a better programmer.5) Dress your rooms well. Pretty rooms can be rectangular and no one notices that they're easy to generate and kinda dull by themselves.6) Create enough random content that's believable so that repetition is infrequent. Make a list of events and situations that have been generated within the last few dungeons so that the player sees the full breadth of your design. To that end, consider theming your dungeons.7) Play test, play test, play test. Create a debugging system that can force certain things to generation. Output debug reports with the seed of each dungeon so you can recreate bugs easily to track them down.8) Make your challenges scalable; be it in the traps that are used, the frequency of friendly encounters or the strength of opposition within the dungeon. The length of the quest is also an important factor.And kinda general notes on making dungeons:9) Don't be afraid of using words. If the player finds nothing in a chest, don't just have an empty chest. Put something useless in it and/or have some text. Examples: "This chest holds nothing but antique dirt."; "The musty smell suggests this chest has long been disused."; "A sudden puff of bitter dust falls from the wardrobe. These used to be garments long ago." Immersion is cheaper than you'd think.10) Make sure the player doesn't get lost. Giving them a map isn't enough. Try to make each room notable, maybe even have a little discrete title for the room pop up when the player enters a room. Every location must have flavour.11) Make the player feel emotion by modifying game play as much as possible. If the player is a mighty warrior and you want him to feel powerful, send many weak enemies. If you want to humble him, send a single vile beast. The player is determining his worth based on his strength - another challenger with sufficient strength to test the player is going to evoke an emotional response. Sending a mage to kill the player is never going to be as emotional because there's always the feeling of "that was bound to happen." Being out-muscled will be more pertinent. Procedural generation, incidentally, gives designers a rare opportunity to exploit this.12) The excitement in combat games comes from a simulated "Flight or Flight" response. Most games emphasise the fighting but rarely, if ever, allow you to run away in relative safety. Always let the player make mistakes and get away with it if he decides to run. On the flip-side, make sure your AI isn't so stupid that it doesn't react sensibly to hit-and-run attacks.13) Dungeons and Dragons is the best RPG system ever created because it has very flexible rules. Strive to create a similar feeling. Play DnD to understand the importance of description and intrigue without being explicit. Let the player assume things but correct him when he's wrong.14) Don't be afraid to have a sense of humour. A character sneezing because of harmless pepper-fungus is funny, the Hobgoblins attracted by the noise isn't. Together, it makes for a fantastic story. Remember: the essence of drama is the combination of mirth and misery.In the 64Fools comp entry I made, I worked with rectangles. Basically, I stored an array of rectangles, and each of those became a 'room'. Then, in order from the first rectangle in the array, I drew passageways from one to the next.
I didn't mind if two rectangles overlapped, because it made rooms with unusual (L-type) shapes.Juju has some excellent points up there, even for people who aren't interested in procedural generation. Great stuff.
@ Juju: wow that's one long post. You could have made a whole blog with that one xD i do agree with it though, it's very good advice. Luckily i know more about game design than i do with game programming but there were still some things you mentioned that i didn't think about. Thanks for taking the time to post it.
I could have done but I didn't want it to sit out of context with regards to the RPG contest.
I've got some nice algorithm you could use… it's called "Artificial Dungeon Generation" since you don't actually create tiles, so it's actually more useful for text-based dungeons. But it's of course possible to make a dungeon made of Zelda I-style rooms and just have one in memory at a time.
Anyway, here goes: