A RogueLike game with map procedural generation we made in a group of 6 people as the last project of the year at ENSEEIHT.
I created this in a group of 6 persons.
I was both the Game Designer and the Development architect.
As in all RogueLike games, we were needed that the map was always different, but always interesting. In fact we have several
criteria :
- the character can always reach the exit from its starting point
- the exit is as far as possible from the character
- the map has to have several paths that can lead or not to the exit
- the map have to contains patterns that seems like walls, corridors, rooms ...
- and we don't want to create these walls, corridors, rooms manually, so they have to be entirely generated !
We will first subdivises the big map into submaps.
We will empty (cells become accessible for the player) all the cells of the submaps.
We will fill (cell become not accessible) the 4 borders of all submaps.
We place the player in one submap.
We generate a Labyrinth with submaps : Starting from the submap of the player, we will "open" one of the walls from the submap that the
player can already reach except if when we open this map we create a cycle.
We continue until we can't open more walls.
Openning a wall is : for each pair of adjacent cells of the wall, we will empty both with a probability p, else wi will open only one
of them or none of them. And we ensure that at least one pair will be open.
Now we can reach the exit.
For each submap, we will fill it.
To do that, we will apply the methods of cellular automata with precise inputs.
For each cells of the submap, we will fill if : it has strictly more than 4 close walls (distance <= 1) or it has strictly less
than 3 distant walls (distance <= 2). Else we empty it !
We do that about 100 times !
Now we have a realistic map.
But maybe we broke the invariant : the character can always reache the exit.
So for each submap, we will joins the gates (a cell from where you can enter the submap) together.
We will start from one gate, create the set from all its accessible cells.
For each other gates, if it is not in the set, we will dig toward it until we reach it ! Then we update the set.
Now we are sure we can reach the exit !
Now we have a playable map.