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