Tag Archives: dungeon

3D loader for android, first roaming zombies

A 3d game needs 3d models, so I wrote a simple .obj (wavefront) model loader, and it was surprisingly easy with java. It took me roughly 30 minutes and is no more than 50 lines of code (including declarations and comments). So the “game” (still no gameplay in) can now display 3d models, and since it’s a zombie game, I’ve put in a (drum roll please) zombie! But it’s not just visual, but also backed by an NPC class that makes it move (more or less randomly) around the dungeon in a turn based manner.

device-2014-01-28-135250 device-2014-01-28-135411 device-2014-01-28-135538

Next on my list are 3d models for the doors, which are currently plain textured (and two-sided) quads that you can simply pass through. And replacing them with 3d models will allow me to add opening animations (think of the first resident evil games), and I also plan to use doors as a gameplay element that’ll hold back zombies that chase you. I’ve also implemented a simple gesture based model viewer that I’ll use to display items to the player (weapons and such).

After adding the doors I’m going to implement color picking for touch inputs, so that the player can interact with the objects in the 3d world, for e.g. opening the doors by touching them (or gestures for locked doors), hitting enemies or picking up items. Since it’s OpenGL ES 2.0, all the rendering is done using shaders anyway, and just adding shaders for color picking and reading pixel colors should be an easy task, especially as I’ve been using that technique in several other games too.

As far as the model format is concerned, I plan to use .obj just in the beginning. It’s ASCII based, so it’s taking up lots of space, is slow to parse (compared to a binary format), and the most important drawback is the lack of animation. It supports neither keyframe animation, nor bones or anything else do store animations. I guess I’ll go the same route for android as with my Delphi projects and create my own binary 3d file format that’ll implement animations.

I’ve also already gathered dozens of gameplay ideas, including randomly generated zombies from a pool of different body parts (heads, upper and lower parts, arms, weapons) and I even think about taking photos of your friends or relatives, that can then be used as zombie faces. Should make up for a pretty nice moment if a zombified friend of yours is trying to rip you apart 😉

Zombie infected random dungeon crawling

2014 started off pretty busy and I haven’t had that much time to work on my current (and first) android project. But at least I wrote down the first pages of the basic game design draft, and I plan on doing a randomly generated, zombie themed dungeon crawler with not your usual zombie story.

device-2014-01-11-110401  device-2014-01-11-110513  device-2014-01-11-110614

So in terms of gameplay it’ll be a traditional dungeon crawler (think of “Eye of the Beholder“, or more recently “Legend of Grimrock“), with semi-realtime movement but with a modern horror theme based on a zombie infection (yeah, I know, zombies are all around nowadays, see the success of DayZ, but I always wanted to do something with zombies anyway). It’ll have RPG elements like health, stamina, skills, experience and an inventory sytem and I plan on having the items generated procedurally like the dungens itself. I even though about randomly generated enemies with random body parts that can be comnnected at random, though I’m not certain if that’ll work out as I want it to be.

I already got the basic engine up and running, and did the first performance optimiziations (visibility checks), so it’ll run smooth and nice on even lower end devices (like my Huawei Ascend G510, it “only” has a dual core with 1,2 GHz and a mere 512 MBytes of memory). I added smooth animations for turning and moving, and wrote a nice looking shader for per-pixel based spotlight shading with distanc attenuation, which is basically a low-powered flashlight that makes up for a an eerie and claustrophobic atmosphere. What you can’t see on the screenshots : It’s animated and sways around and flickers, and I plan on adding some kind of touch or sensor based way of having to regenerate the batteries from time to time to add some suspension to the gameplay.

As soon as things have settled, I’ll post more information on this project, including some of the technical aspects of the “engine”.

Dungeon Crawler Demo with Source released

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.

The demo with complete source can be found here

Omni-directional lights using cubemap shadows

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).

First dungeon crawler prototype (HD Video)

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 :

Random Dungeon Generation

After deciding to take a small break from working on “Phase 2” for Projekt “W”, I decided to do something I’ve been thinking about since I played my first dungeon crawler (Eye of the Beholder) over 15 years ago :  a random dungeon generator. Back in that time I already gave it a shot but nothing really ever came out of it, so I decided to try again. But this time it worked out really nice and I now have a fine random dungeon generator, creating nice random dungeons that could be used in a game. Actually I even have an idea for a game using this, though if it ever sees the light of the day it will be a very unique take at the “genre” and it won’t be a big project (cause at some point I’d like to release “Phase 2”).

And since just telling you that I made something like a random dungeon generator wouldn’t really be worthy of a whole news posting I also wrote a rather extensive article on that subject. It’s not a tutorial or including the source code, but it’s rather a journal on how I started from scratch trying to create a random dungeon generator. So maybe it’s interesting to some, but since I also talk about how I do it people may also get some ideas out of that article on how to do their own random dungeon generators. Note that the generator is neither finished nor that my solution is the perfect one, but I think it’s a nice take on the whole subject.

Read the “Random Dungeon Generation” article.

And also note that this is my first article, but I hope to write more articles concerning game programming, game design and such in the future.