So I’ve decided it’s finally time to show some Zombox development progress!
Earlier this year I released a mobile game called ‘The Quest Keeper’ (on iOS and Android), which took up all of my development time for a couple of months. It was a much-needed break from Zombox that also allowed me to perform real-world tests on various Zombox tech (for example, the world in ‘The Quest Keeper’ is procedural, and uses the geometry batching system I originally developed for Zombox).
Anyways, for the last few months I’ve been back at Zombox, chipping away at my long todo list (which is slowly getting shorter!). Here are the highlights of what has been going on:
- The game world code is finally fully unified. If you saw previous update posts, you’ll know that the game world has things like sewers, NPC bases, zombie traps, etc. Those things were previously coded as ‘special exceptions’ to the normal procedurally generated city tiles. For example, in the old code when you entered a sewer, you would be moved to a special sewer tile outside the range of the normal city tile grid. In that special sewer tile there were different ‘rules’ governing how geometry was generated, where NPCs would be placed, etc. Each set of ‘rules’ were particular to which sewer you were in.
Coding those elements in that manner was a quick and dirty way to get them into the game, but it was also a horribly confusing and cumbersome system to manage, update or augment. The reason for coding them that way originally just boils down to naivety on my part. But with all the experience I’ve gleaned over the years from developing my games, I realized it was finally time to clean up all that horrible code (we’re talking many thousands of lines of code, spread out throughout all of my source files…ie, very messy!).
The result of doing that cleanup is that the game world is now much easier to manage and keep track of. For example, I was able to add 15 new NPC shops to the city sewer system in a matter of minutes, rather than the hours and hours it previously would have taken to sort and manage all code exception cases for each sewer. So hooray for clean code!
- The world mini-map has been updated. Now the color of the zombie markers shows what each zombie is doing. Green = wandering around. Yellow = investigating a sound. Red = attacking the player. This will help players estimate the amount of danger surrounding zombies pose to them, as they move throughout the world.
- Radiation zones have been added to the city. The closer you get to the giant meteor which crashed into the center of the map, the more you’re exposed to its deadly radiation. Certain medications have also been added to the game which can cure you of radiation poisoning, and eventually certain clothing items will protect you as well. Without those items guarding you though, venturing close to the meteor will result in certain death.
- Zombie difficulty is determined by proximity to the crash site. The closer you are to the origin of the deadly radiation, the harder the zombies will be. This means novice/beginner players should stick to the outskirts of the city, while hardcore players can find their challenge near the center.
- Zombie difficulty is visually illustrated by the decay of their bodies. I replaced my old zombie shaders (which were all just varied shades of green), with a new dynamic one that transitions from rotten-looking skin, to completely skinless nastiness, based on the difficulty of the individual zombie. If you’re on the outskirts of the city, where zombies haven’t been exposed to much radiation, the zombies will mostly be spotted and greenish….but if you move closer to the radiation zone, zombie skin will be progressively more decayed to the point where they have no skin at all and look quite ghoulish. This is an easy way to visually signify the difficulty of the zombie you’re about to encounter. This effect, combined with the 60+ varieties of outfits zombies can be found in, makes for a huge amount of visual variation between each zombie.
- Zombies can bust open doors that are not barricaded. Previously, a zombie could not enter through a closed door at all, and would have to destroy it completely in order to move past it. Now, zombies can smash unprotected doors open with a few hits, which encourages players to take the time to barricade all nearby doorways.
- Zombies can break any object in their way. Previously, zombies could only attack doors. Now, zombies can attack any object between them and their target, damaging the object until it’s destroyed (or the zombie gets distracted and wanders off).
- Zombies will no longer spawn inside barricaded buildings. This is a problem that had been bugging me for a while. In past versions of the game, zombies could spawn in any location, so long as that location wasn’t blocked by a prop or in water. This means that if you built a shelter and walked away from it, by the time you return a zombie may have spawned inside of it. But what good is a shelter if it can’t stop zombies from spawning inside of it? The solution to the problem may seem simple at first — after all, why not just tell the game engine that zombies cannot spawn on tiles where the player has built a building? But therein lies the challenge — in a game world where players can build walls in any arbitrary shape or location, how do you even determine where a building is? Or what size it is? Or what shape it is? And how do you perform those types of diagnostic determinations in an efficient way so that they don’t contribute extra lag to the game on mobile devices?
After much deliberation, the solution I found is quite elegant: first, I construct a grid encompassing the entire spawn area. Then, I iterate over all wall objects in the grid area, and mark all grid cells that are located under those wall objects. Finally, I perform a flood-fill over the grid, starting at a known exterior point. Once the flood-fill completes, any non-filled areas are marked as interiors, and zombies are not allowed to spawn on those cells.
If that explanation is not entirely clear to you, here is an animation showing what’s happening behind the scenes. As I construct walls in the game world, notice how they are marked as black lines on the underlying grid (after each progressive update of the grid). Once the walls connect together and enclose a space, the blue flood fill no longer fills that area, and the remaining white area is marked as an interior (which prevents zombies from ever spawning inside in the future). The beauty of this solution is that it requires no complex math or ‘intelligent’ calculations to determine where buildings are and what form they take…it’s really just like using the paint bucket tool in MSPaint.
- Many new craftable traps, weapons and tools have been added to the game. Here are descriptions of them:
The basic turret can be constructed to aid the player in attacking waves of difficult zombies. It has a high rate of fire, and can be pointed in any direction, and has a limited supply of ammo (which can be replenished with a repair tool).
The auto turret is a computer-controller version of the basic turret. Once built, it will automatically attack nearby zombies. It has a low rate of fire, but its bullets can penetrate multiple zombies at once.
Inspired by the propeller traps of Half-Life 2, this trap has four spinning blades which will eviscerate anything in their path. It has limited battery power than can be replenished with a repair tool.
This is a re-usable trap that does a huge amount of damage to any zombie that steps on it. Once it has sprung, a single hit from a repair tool will reset it and make it ready for use again.
This craftable contraption generates loud noises which will distract zombies. It can be used to lure zombies into traps. It has limited battery power, which can be replenished with a repair tool.
This trap slows and damages zombies that walk over it.
Tossing a care package flare on the ground will trigger an overhead military drone to drop a package containing useful supplies down to you. Care package flares attract nearby zombies, but falling care packages can hit and damage zombies below. Care packages themselves are always locked, so they will require a lock-pick to open properly (or you can just break it open with a weapon – but you risk damaging the items inside).
A remote mine is an improvised explosive device, similar to an in-game pipe bomb, that is triggered by a call from a cell phone. Use these to generate explosions from a distance, at a time of your choosing.
The proximity mine is essentially an explosive bear trap. When a zombie steps on it, it will explode — damaging everything around it.
Automatic metal door:
Unlike normal wooden doors, automatic metal doors automatically open/close when you walk through them, and cannot be smashed open by zombies. They are great additions to any shelter.
After a few more small things to do, the next big thing to do is re-do the NPC system…the goal is to tie NPCs into a quest system, so it will take a substantial amount of work to get that done. In the meantime, thanks for your patience!