Some of you might remember my article on random dungeon generation that I released back in 2010. I recently took a look at the demo and sat down to finish it up and release it to the public along with the complete source code.
The demo comes with full source code, including the source for random dungeon generation (with practically no limit for the dungeon size) and implements a simple OpenGL renderer with per-pixel-lighting. It also uses the Newton Game Dynamics physics engine for proper collision and physical reactions by using the built-in character controller. I tested and compiled it with Lazarus 0.9.30.4 and Delphi XE2, but it should work with other versions too. Currently it’s only windows, but the dungeon generation itself is not bound to any OS, and changing the OpenGL renderer to use Linux or Mac OS should only be a matter of a few lines.
And though I’ve got several ideas what to do with a random dungeon generation, including a complete (albeit small) design document with a not-so-standard game idea (or something horror-releated would also be a nice idea I guess), I don’t think I’ll be able to do something with this in the near future, so I decided it would be a good idea to release it to the public.
So if some of you decide to use this as a base for your projects I’d really like to see what you do with that random dungeon generator.
It looks like my dungeon crawler prototype isn’t actually evolving into a game, but much more into a personal testbed for more-or-less current rendering techniques (due to Projekt “W” I’ve been lacking in the field of recent rendering techniques a bit). And so one of the things I always wanted to implement were shadows for omni-directional light sources. I’ve been doing that with stencil shadows years ago, but stencil shadows aren’t the preferred way of doing this nowadays due to their limitations, including sharp edges (yes, there are ways to get around this, but they’re expensive in terms of computing) and a high demand for fillrate.
And I’ve also done shadow mapping some time ago, but back then only for a spotlight, and that’s pretty easy (basically it’s just a way of projecting something onto the scene). But omni-directional lights are a step further and It took me some time to get them to work. One of the hardest things holding me back were troubles using depth cubemaps in my shader. So now I’m using a normal cubemap (RGBA) for the light source and each face stores a custom calculated depth value (done in a separate shader) that’s then used in the final calculation to apply shadows to the scene (done in the same shader that does lighting and parallax mapping).
Although it took me longer than expected I recently got a first prototype of a dungeon crawler, based on my recenlty published random dungeon article, polished up far enough to show it to the public. Actually one of the biggest issue holding it back were the textures. It uses parallax (bump) mapping for giving flat surfaces a realsitic 3D look (it’s pretty much an extension to bump mapping), and for that technique you not only need a color map and a normal map but also a heightmap for each texture. After not being able to find good ones around the net I decided to quickly do the textures myself.
A quick overview of what’s in this prototype : As always it uses OpenGL and let’s you walk around a randomly generated dungeon. Lighting and parallax mapping are done using shaders (so there is no real limit to the number of light sources) and all physics and collision stuff is handled by a recent beta version of the Newton Game Dynamics engine. One of the new features is an included character controller that allows you to setup a physically correct playerbody that interacts with the environment within a few lines of code. But that’s not the only use of Newton in that prototype, as I’m also using it’s raycast functionality to determine visibility for the map. That was a pretty natrual choice as I already submitted the geometry of the dungeon to newton for creating a static physic body, so adding raycasting for visibility check was pretty easy and works fine.
Other than that, there is not much to say about this very early prototype. I’m still not sure if I’ll ever make a game based on all that random dungeon stuff, although I already wrote down a nice and basic game design that’s not your traditional dungeon crawler.
So in the meantime enjoy this video I just uploaded, and please watch id in HD. Sadly it’s only 30 fps (originall recorded with 60fps) but it should be sufficent to get an impression :