Thursday, August 30, 2012

Dungeon Rendering

Since generating dungeons in Unity seems to work just fine, I started working on rendering the dungeon.

First, I added random colored lights, so each room would have its own feeling to it:

Random colored lights

The next thing I added was a basic character controller (the model is still a placeholder), so that I could walk around and see how everything looks.

I put in some walls and rendered it from an orthographic camera in 3D:

Orthographic perspective

At this point, you would be able to look into every room, even if its not in your line of sight. This is very boring from a gameplay perspective and it looks very strange, too. So I quickly programmed a "fog of war"-like visibility system. Due to the fact that this is just a test, I currently use ray casting for this. This will be replaced by a much more efficient approach later on.

This little video shows everything I mentioned so far:

I also started adding more parameters and randomness to the level generator to make the levels more interesting. Writing code to create random dungeons is not very hard, but doing so that you get predictable and consistent yet interesting results isn't that easy.

Sunday, August 26, 2012


I always wanted to try out the Unity Game Engine, but becoming acquainted with a new tool often takes a lot of time. This wasn't the case with Unity though.
I played around with Unity a little bit and I really like it. It is more suited for 3D games than it is for 2D though, but it makes things so much easier. Today I ported the dungeon generator to see how well that goes. I also made some bugfixes and did some code cleaning. So far everything seems to work pretty smoothly. The level generation seems to take some more time than on the Java implementation, but the rendering seems fast enough and should improve further as soon as I implement some optimizations.

Here is a screenshot of a generated dungeon layout in the editor (no textures yet):

Random Dungeon in Unity

I also made a very basic gameplay prototype that I will be integrating into this, so that I can try out some gameplay mechanics (I know it looks crappy :) ):

Very first gameplay testing prototype