Tuesday, December 30, 2008

Game Cow Week: Day 2

This morning started off a little rougher. I realized that I needed to rework some of my underlying systems, so I spent most of the morning doing that with little visible result. But the change will pay big dividends in the next couple of days.

What I was doing was having each of the objects using their own timers to update things. This made it really difficult to script anything, because the zombie spawners couldn’t be controlled, and the zombies themselves couldn’t be paused or anything. So I set it up to have one class that has a timer, and it sends tick events to all of the objects that need to be updated. Certainly not anything new, but it works well, and it allowed me to easily implement a pause function. It will also make it easy to put in story events.

The reason I had to add this in today was because I was working on making it so that the user gets a bit of time at the beginning of the level to choose which building to hole up in, and where to place defenses. The way it was working zombies would just start spawning as soon as the level started, but now I’ve got it working on a schedule.

Which brings me to the new features. As seen below in the screen shot you can select which building you want to hole up in. This also necessitated some path finding for the zombies, since they might need to head anywhere in the level. Rather than implementing AI for each of the hundreds of zombies on screen at any time, I set them up to use a technique called potential fields. What I do is use Dijkstra’s algorithm to find the shortest path from any point on the map to the target building. Then I set up each tile on the map with a force vector to push the zombies towards the next closes tile. Almost like the zombies are little scraps of paper being blown about in the wind. It works pretty well for herding hundreds of zombies towards their destination, and assures that even if one gets off the normal path it can still find its way.



I also added in human defenders. In the second screenshot you can kind of see a couple of little blue guys, and you can see some of their bullets that they are shooting at the zombies. They work pretty well, too well in fact. I’m going to have to do some balancing, five or six guys strategically placed can take out thousands of zombies no problem. I’m hoping to tackle that problem some tomorrow.



I’m planning on having the human defenders be subject to attrition, over time their morale drops, and they need to go back to the base for a while. That should make it interesting as the player constantly has to move defenders around, to keep fresh ones near the front lines. Also, at the moment zombies don’t even touch the human defenders, I’m going to have to fix that as well, that will require some interesting programming I think to get nearby zombies to head towards humans. Additionally I’m hoping to implement an experience system. In most tower defense games you level up your defenses by spending resources gained from killing baddies, I’m thinking instead that I want the defenders to level up as they kill zombies, which again will figure into the attrition thing.

So, tasks I’m hoping to look at tomorrow include: zombies attacking defenders, adding in barricades that the player can set up in the streets, different classes of zombies, and different classes of defenders.

By the way, if anyone is curious I’m using the Torque Game Builder. I’ve been really impressed, especially at the speed that I’ve been able to learn it. I looked at it a little bit about a year ago, but it’s been pretty easy to get up to speed on. I don’t actually own a license yet. I’m going to be buying one when I finish the week out.

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home