Kilburn – Roguelike – Update

One of my favorite game developer conference (GDC) talks is the Diablo postmortem by David Brevik. He details the nitty gritty of game design and development and show cases his original game design document (GDD) he was working on while in high school. I’ve always aspired to learn from the great developers that blazed the trails before me and I’ve been wracking my brain trying to come up with a name for the roguelike game I’ve been working on. David got the name Diablo from the mountain near his California home Mt. Diablo. So to google maps I went and I’ll be naming my future roguelike Kilburn, its a mountain that’s near my home.

Cheers David

Devlog Update

So feature development has been slow, I’ve spent the last two weeks rewriting my procedural map generation, redoing my artwork for my dungeon generator and integrating this work into the project. When I started this rewrite I wanted to do it outside of my active project so I was free of any other code that was running. I wanted to nail down the basics of procedural prefab room generation. I also wanted to publish this procedural generation so other developers could use it.

So, I released a basic version of my code under the MIT license, you can get a copy of it here:

https://github.com/Diaonic/ProceduralMapGen

Here’s what a generated map looks like in Kilburn
Here is a first look at the wall and floor tile set.

That’s all for now, as I continue to work on AI, combat, and work towards a playable build. We’ll be posting more updates.

Cheers

Corey

Unity Procedural Level Generation

I was unhappy with the assets and approaches I was finding for Unity procedural level generation. I had read about some developers taking prefab rooms and generating maps, but I couldn’t find any examples. However, I didn’t want the Binding of Isaac or Zelda dungeon feel. I wanted to be able t customize rooms, then generate a dungeon based on thematic prefab rooms.

Here’s the result

So whats going on here?

We’ll step through some pseudo code.

SpawnStartingRoom()

Spawn a 4-connection point room at a random x, y coordinate on our map array.

  • Store those 4 connection transforms in a list.
    • I also stored the connection transforms as keys to a dictionary of gameObjects, this way when I pulled a random transform, I look it up in the dictionary, get the gameObject.
    • Set all four of these connection points as available for connection, I just used a bool value on the prefab object to keep track of this.

SpawnPrefab()

  • Grab a random key from our available connection list
    • Grab the associated gameobject using the transform as a key for our dictionary of gameObjects
    • Using overlap collider, I check if there is an object present at my random key
      • Iterate over the bool values and find a connection point
      • Instantiate our prefab at the destination transform and apply an offset, so it lines up nicely with the existing gameObject
      • Set some connection flags
      • Rinse -> Repeat

Once we reach the number of rooms we want to spawn. We then initiate a cleanup phase.

CapDeadEnds()

  • This method iterates over all the spawned hallways.
  • It evaluates if the hallway has an open connection.
  • If we find an open connection, we attempt to spawn a large 8×8 endcap, if that fails, we spawn a 4×4 endcap, if that fails, we use a 2×2 endcap.

I ran into some issues here with detecting overlap and it resulted in a better generator in my opinion. So, the prefabs were built on entirely the same layer. So, I added another layer just for the floor, now when I get weird overlapping issues, its cutting into wall space and creating some interesting room configurations.

  • The intersected wall objects are removed.

I know this post probably isn’t for everybody, but I wanted to show some of my work and my nontraditional way of tacking level generation. I could probably add some more cleanup to remove oddities such as low value tiles spread throughout the center of the map. This is a good base I believe.