Dungeon Level Generation from image in Unity

I was thinking about Dungeons and dungeon generation and also about how to give players the ability to make their own Dungeons and share them with each other.

Well a map can be saved as a 2D matrix, I have even done it with a list of values or 1D matrix.

Here you can see an example I made for a platformer, using a 1D matrix to make square levels (you can edit the level during runtime, play it, save it and load it):

But how does someone edit, share and transfer those easily? How could I make a quick editor or even edit maps outside the game? How could I send new maps to my players fast and make sure they don’t break the game no matter the version?

Well an image is a matrix and we can have RGBA info, so we can hold multiple values in one image for one map and also edit and also transfer them easily.

What do we see here:
This is basically a couple of hours worth of work as a proof of concept.

I made a script that takes an image as input, identifies what each pixel represents and instantiates it. It makes levels of arbitrary sizes, it can spawn empty, floors, walls, columns, enemies and the player.

I also wanted to be able to make sure to use NavMesh and even though Unity is going to add runtime generation in 2017, this was done to prove that if you don’t fight Unity you can even do things it’s not supposed to do.

So the enemies have a NavMesh Agent and the NavMesh is carved using NavMesh Obstacles and as you can see from the delayed generation mode below they can follow you upon spawning even if the level hasn’t finished yet.

I added a delayed generation version because generation was so fast I couldn’t see my work in action, it was hit play, see level, so I put my code in a coroutine and added a small delay to see things being built.

What will I do with this:
I don’t think I am going to use it for Dominus Infernus, I have another game idea it might be more useful for, since in Dominus Infernus I want a higher standard of graphics, which will be achieved using 3D pre-rendered backgrounds.

First Gameplay Test

What do we see here:
Click around to move, click on enemies to attack and deal damage. Enemies can attack you and deal damages as well.

What do we do now:
At this point I wanted a decoupled camera, so you could fly around, but in the next iteration I will make the camera follow you, as it seems less confusing and you need your other hand to use potions, abilities etc.

Isometric setup test, combining 2D background and 3D characters/items

What do we see here:
I had this idea that I could easily combine 2D background with 3D characters and still use Unity’s NavMesh and NavMesh Agent without issue. So I built a quick prototype in which I was not going to use tiles, but a background that is distorted in order to render correctly through an orthographic camera at a 45 degree angle.

I wanted it to match up with the 3D items not just approximately, but as exactly as possible.

I brought in my trusty Nazi guinea-pig, my trusty biped and checkers.

So you see that 2 squares on the checker are 1 meter in 3dsmax and the box on the ground is 1 meter in Unity, but the background although a 2D images is rendered at a 45 degree angle.

I figure with this system I can make RPGs or even Turn Based Strategy games like Commandos.

Astaroth – High poly progress

This guy started way back in the day, I had made a base mesh for a gargoyle character I wanted to make. I did a couple of sculpts, but other things got in the way, I didn’t have a clear idea for what I was going to do with him.

So as I was working with the idea of Dominus Infernus in my head when it was still just Ex Inferno, which means ‘From Hell’ in Latin, I was thinking about Diablo 2 – which is a game I remember fondly and part of why I am making DI. I wanted a character that would be the antagonist and I wanted Hell to be a central part of the story, so I decided to dig up my gargoyle and see if I could turn him into a Demon.

His armor isn’t filled with skulls and bones, because that’s not his backstory, m vision for him is not a grime version of the lord of hell, but rather that of a fallen hero.