I want to make a rougelike

Rougelikes have been fascinating me latley. The main reason is Pixel Dungeon on Android, a really cool 8-bit retro looking rougelike. Its loads of fun but HARD. Only once in the last twenty or so plays have I gotten past that damned blobb on level 5.

Enough rambling about Pixel Dungeon. The various rougelikes have been luring me to play for far to loong, so I’ve finally decided decided to try and make a simple rougelike myself. It seems like a rather limited game mechanic with few rules, but fun to play.


So where do I begin? Well with map making of course. Random maps is great for replayability if you ask me. Never will you face the same map or obstacles. My approach so far have been focused on cave like maps. I start out with generating a noise map that is pure black and white. After that I run the map through a few steps the algorithm from game of life. The algorithm looks something like this:

  1. For each cell in the map grid.
    1. Count the neighbors that contain walls in all 8 directions.
    2. If the current cell is a wall.
      1. If the neighbor count is below 3 remove the wall.
    3. If the current cell is empty.
      1. If the neighbor count is above 4 add a wall.

The thing here is to manipulate a copy of the original map for each step then swapping them. If the original map is modified directly the algorithm produce a strange result.

This produces a something like this:

Looks like caves doesn’t it?

The next step will be to connect all the rooms, we don’t want places you cant reach. I begin this with identifying each room. I do this by flood filling each room with a unique id (or color in this case). This produces the following result:

Each room is given a target position, which is randomly chosen within each room. Each target position is connected using the A* algorithm. I currently let the A* algorithm use a cost of 1 to move inside existing rooms, and a cost of 5 to move through walls. This produces short paths through walled areas. Once every room is connected I fill the map with the room ID from the starting target following the path. Here are two images showing the first generated corridor and another image when all corridors have been made:

map_path_0
map_path_6

Next I will try to make the corridors between rooms more interesting by using a Perlin-noise cost map overlayed on the map, i.e. something like this:

map_path_cost

First thing first though, currently my A* implementation is way to slow so I will speed it up before I introduce the Perlin-noise cost modifier.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.