Holidy project: Zombie simulator E-mail
Wednesday, 23 December 2009 07:56

I recently purchased Protoype for the XBox 360 when the price dropped to a reasonable level, and I've been enjoying the game, and in particular, fascinated with the infected areas of the city.

It's quite entertaining to just watch the mayhem, zombies killing pedestrians with cars driving through the middle of it, having accidents. All the while, the military is blowing New York up.

Unfortunately, since the game is on a console, there's limited memory, so if I walk away from a battle zone, then come back, everything has reset and there's no permanent damage on the buildings.

It got me thinking that maybe I should try to write a zombie invasion simulator?

Kind of like a anarchist's Sim City.

What I want

  • People: a city with hundreds, if not thousands of people.
  • Destruction: buildings that can fall down.
  • Permanency: if a prop falls down, then I want it to stay down, not magically stand back up when I look away.
  • Chaos: Entities are to respond believably ie. panic, fighting, etc.
  • A life: each person and zombie is a defined entity

I started all this last week by designing a low poly (153 vertices and 208 triangles, sans hair and collar) human model in Blender that is reasonably poseable. The model can handle the basics like running, walking, crouching without distorting too badly.

Keeping it simple

The last time I looked in the mirror, I wasn't a development team comprised of dozens of people, so I need to keep things simple.

Since I want thousands of people to inhabit my city, I won't be able to display them all as 3D models without jumping through hoops or requiring really high-end hardware, so I'm going to have to cut corners and pre-render them.

Pre-rendering means that I'll need to create one sprite image for every angle that the camera can look at the sprite, for every animation frame of every entity type. That's a lot of sprites! So, again, to keep it simple, I'll be restricting the camera's movement to a fixed Y position, which means that I'll only need one frame for every horizontal viewing angle per per animation frame per entity type.

This engine is supposed to provide an overview of the action, so I'll want to be looking down on the city. To avoid perspective issues, I'll be going for an isometric projection, which is typically seen in pseudo-3D RPG games.

Rather than manually designing a city in 3D, I'm going to use something similar to the heightmap method that is often used to generate 3D terrain. I'll create a bitmap image, with different colours defining the features of the city, such as roads, houses, offices, etc. The engine will then construct a complete 3D city based on the bitmap. It might sound complex, but it's actually easier for me than having to manually design more than one city from scratch. I can simply use a paint tool to quickly draw something up and let the engine figure out the details.

The tools

Blender and Gimp are used of course, as is Irrlicht, which I recently explained how to install. I'll be developing in C++ (that's what Irrlicht is written in) using Code::Blocks, and I've also included the Boost C++ library, which contains a lot of useful C++, albeit complex functions. Irrlicht can't read blender files unfortunately, so they'll need to be converted to Direct X format using this handy Blender plugin, which, although old, works perfectly in the latest Blender.

I'll also need to write some bash scripts to automate texture creation and a few custom tools, starting with something to generate some sprites, which I've already hacked together to refresh my Irrlicht knowledge.

Sample sprite output from the sprite tool

blog comments powered by Disqus