Tuesday, June 25, 2013

Adding A Little Ambiance To The Zombies Arena

I'm sick, I'm exhausted, my eyes hurt from staring at multiple computer monitors, but I'm grinning from ear to ear right now. I've spent a large block of my free time working towards a better Zombies Arena for BlitzBotz, and my work is really paying off.

After several days of fighting with my own scripts, I finally got the zombies to attack correctly about a week ago. The trouble with the attack system was that I needed the server to handle all attacks and damage, since my main goal is to keep the client as just a graphical representation of the data on the server, even in single player modes. The zombie model I purchased from the Unity Asset store came with some great animations, so once the attack request scripts and the damage calculations were completed, adding some visual effects was relatively simple. Zombies now chase down the player and, once they are within attack range, automatically deal damage to the player; they then wait momentarily, and if they are still within range will attack again; if not, they'll start chasing them down again.

The next step was to add some extra functions to the 'Wave' system, which is responsible for sending a certain number of zombies each level. I also wanted to make the zombies move faster, attack with more damage, etc. as the player progressed through the levels. This work was a welcomed relief from the attack system, since most of this work was nearly completed and just needed some tweaking. The result is what finally feels like a game, wherein the player gets points for kills, and as they mow down zombie after zombie they progress through the waves, the challenge increasing with each new level. The game gets pretty hard pretty quickly, but I will be tweaking the settings once everything is setup... for now I'm happy with things just the way they are. I also put some time into the website to track high scores for players, which is now displayed on the zombies leaderboard. The system automatically keeps your personal high score, the number of games you've played altogether, as well as how many zombies you've killed in your BlitzBotz career.

My next problem came from the way the zombies move through the arena. For the standard Arena, I went with the familiar octagon shape, but I found it very easy to use this to your advantage during the zombie levels; players could basically run around in circles and the zombies would crowd together as they chased them down, ultimately lining up like ducks to get mowed down easily. My solution was limit the areas that the player could move around, and to ensure that zombies would be attacking from all sides as much as possible. I figured a cross, or plus-sign, shaped arena would work best. The player would spawn in the center, and zombies would start appearing at the top, left, right and bottom of the screen, effectively surrounding the player. The player can run East, West, North or South to try and get away from advancing enemies, but as they do, they will position themselves closer to a zombie spawn point. This has created more work for me in the end than expected: I now need to design an AI pathfinding system to prevent zombies from moving outside of the designated play area, shown as the fences in the following screenshot:

View of the new Zombies Graveyard Arena via the Unity3d Scene window

After browsing through the Asset store, I found an amazing free package that had a lot of assets for use in a graveyard scene. Needing a break from programming, I decided this morning to begin building a graveyard arena that felt more applicable to the zombies level. I exported items that I wanted to use from the package (unfortunately I can't find the package in the Asset Store now to provide a link, but will do so as soon as I can) and imported them one by one. I did things this way to try and keep my project folders clean and free of assets that I wouldn't be using. At first, I was worried that my frame rate would take a huge hit with the inclusion of these new assets, but a test on my Samsung Galaxy Proclaim revealed that the frame rate drop was minimal, and since this is a single player (co-op two player at max) level, I'm confident that the frame rate will remain consistent.

I'm excited to begin work on the pathfinding system to prevent the zombies from walking through the fences, but I'm overdue for a break from programming. I'm hoping to have the finished single player version of the new zombies levels available to the public soon, and co-op will follow shortly there-after. Until then, I'm going to go pwn some more zombies on the Nexus 7.

No comments:

Post a Comment