Creating a suitable dungeon layout is one of the primary roguelike tasks. Some dunegeons resemble mazes, while other look like a cavernous system, dugged out by a group of goblin dwellers. The brown slash sign (present on some of the maps below) represents (open) doors.
This algorithm works in two phases:
The main goal of this algorithm is to mimic a living digger, who creates a system of interconnected tunnels and rooms. I use many ideas from an excellent article Dungeon-Building Algorithm, written by Mike Anderson.
A fast and simple way to create a maze is to use a Recursive division algorithm. It is best suited square mazes, but works pretty well with any rectangle.
Cool mazes with configurable regularity can be created using this algorithm, taken from a Rogue Basin wiki.
For a full explanation of this wonderful Eller's algorithm, please see http://homepages.cwi.nl/~tromp/maze.html. Not only it generates a Perfect maze (every two cells are connected by exactly one path), but it only requires 2*N memory to generate a maze of N*N size!
Click on any non-empty cell in the map above to highlight the region visible from a given point. This area is computed using the Discrete Shadowcasting Algorithm.
While roguelike games are not played in real-time, proper timing also must be taken care of. Individual beings, or actors, take turns in their actions. Every actor has a speed rating – a dimensionless relative value, which determines how frequently can the actor perform his duties. A speed of 200 means twice the amount of turns, when compared with speed of 100.