Rooms and Mazes: A Procedural Dungeon Generator
Another cheap and very effective technique for procedural level and maze generation is to create a "walker" or series of walkers that start at some point, walk in a direction and then turn at random intervals, leaving a path of corridors and occasionally rooms in their wake. This is how Vlambeer's Nuclear Throne generates its levels, and there's a good article from Jan Willem Nijman, it's developer, here: <a href="http://www.vlambeer.com/2013/04/02/random-level-generation-in-wasteland-kings/" rel="nofollow">http://www.vlambeer.com/2013/04/02/random-level-generation-i...</a><p>If you'd like a more academic look into procedural 2d game generation, there's a nice research paper here, that describes a method and talks about Spelunky a lot (the king of procedural 2d level generation, in my book):  <a href="http://games.soe.ucsc.edu/sites/default/files/cig10_043CP2_115.pdf" rel="nofollow">http://games.soe.ucsc.edu/sites/default/files/cig10_043CP2_1...</a><p>Additionally, Derek Yu open sourced the code to the original Spelunky, and Darius Kazemi created a great breakdown of its level generation techniques here, also with interactive examples: <a href="http://tinysubversions.com/spelunkyGen/index.html" rel="nofollow">http://tinysubversions.com/spelunkyGen/index.html</a><p>The action roguelike genre, particularly the roguelike FPS, is a vital new area being explored by indie game developers. It reminds me of the way 2D platformers were mined, explored, and iterated upon starting around 7 or 8 years ago.<p>Right now, it doesn't take much to stand out from the herd, as many of the most popular games in the genre don't do much beyond generating a bunch of square rooms and connecting them with doors and short, straight corridors. In my opinion, developers in the genre should take more cues from Doom, and less from original Zelda dungeons moving forward.<p>And, from a more holistic perspective, nobody <i>really</i> cares about mazes, room placement on a grid, and connective corridors when playing a game, beyond a brute mechanical level. A more useful framework for thinking of generating levels might be to go one level of abstraction higher. Think about a level as a story for your player, and generate setpieces or 'acts' that you want the player to experience as they play. Keep in mind the basics of a good story: an escalation in tension and difficulty, spaced with breathers for rhythm and flow. Place those sets on a path in a map, then figure out a way to connect them together at the lower level with rooms, objects, enemies, and corridors.