Thursday, January 1, 2009

Game Cow Week: Day 4

Today wasn’t quite as productive as the other days. But I still got some good stuff done. I had to do a lot of debugging, and code refactoring. I expect that I’ll have to do more of that as time goes on because the code base is getting a lot larger, and more complicated. Additionally, when I wrote some earlier code I was making assumptions that no longer hold true. It’s been interesting producing so much code in such a short time.

I spent a fair amount of time reworking the defender classes. I added some methods to calculate line of sight so that I could have the defenders hold their fire until they can actually see a zombie. I also modified the defenders so that when they are standing on buildings they can’t shoot immediately around themselves. This is a gameplay move, it gives you a reason to put defenders out on the streets, because they can shoot zombies that are up close, rather than just ones that are farther away. I also added some code so that the defenders have accuracy stats, and their weapons also have accuracy stats. This along with some other changes allowed me to implement three different defender classes. There’s the rifleman, they fire in three round bursts that do decent damage, and their accuracy isn’t great, but it’s okay. There’s a sniper, that has a really long range, good accuracy and damage, but they shoot slower, and only shoot one bullet at a time, so they can only hit one zombie at a time. Then there’s the saw (squad assault weapon) soldier, he sprays the bullets, with low accuracy, and pretty crummy damage, but he puts out a whole lot of fire.

Today marked the first day where it really started to feel fun. As I was setting out the different troopers, and trying to figure out the best spots to put them to stop the zombie hordes it was really fun. Hopefully I’ll be able to improve on that as I add more features in the coming days. I’m hoping to finish up the humans tomorrow, adding experience points, and morale to the mix. I’m also planning on reworking how soldier deployment works some, and putting limits on how many soldiers can be deployed. If time allows I’m also going to be working on polishing up the interface some. Adding some menus, and adding methods to display story text, and information about individual soldiers.

Instead of a screenshot today, I have a video. Putting out the troopers was so fun, that I decided that there needed to be sound effects, so I added some gun sound effects. The whole thing was so fun to watch that I decided a screen shot just couldn’t do it justice and downloaded a cool open souce video maker and made a video. I stuck on youtube, you can watch it here. I recommend watching it in high quality.

Labels: , ,

Wednesday, December 31, 2008

Game Cow Week: Day 3


I stopped early today, about 5:30, because it was new years, and because I was starting to get burned out. Although after nearly thirty six hours of programming in just three days, it’s not much of a surprise.

I got some good stuff done today. I added barricades, two varieties, that can easily be expanded into three. I set it up so that when you place a barricade it barricades all four sides of the tile, with an empty space inside which you can place defenders. The defenders can then shoot out of the barricade at the passing zombies. I also got the zombies to chase defenders, so if a zombie sees a defender it will attack it, meaning that packs of zombies will move out and swarm around defenders. So if you have a defender behind a barricade, then the zombies will swarm the barricade and beat on it until it falls apart. The path finding works so that the zombies will sometimes decide that it is faster and easier to beat their way through a barrier, rather than going around. Also at times the zombies will be going around a barrier, except for a few who are trying to get at a defender who is inside. When they finally get through the barrier the other zombies will start following the shorter route opened up by the destruction of the barrier.

I also added a water tile. Water tiles slow zombies down, so they will avoid them if possible. I’m thinking it would be fun to have zombies randomly get washed away in the current, and that shouldn’t be too hard to implement. Maybe I’ll do that tomorrow.

Another new feature is two additional types of zombies. Now there are the standard slow zombies, a faster variety that moves about three times as fast, and a big powerful zombie that moves slower than the others, but is much tougher. The big zombies are giving me a little bit of trouble, because they move slower they don’t flow through the level as nicely as the other varieties. I’m going to have to play around with them some to see what I can do to get them to work better.

Tomorrow I’m going to dive into developing the humans more. I think it could be fun to have the human units be unique, something like your units in Fire Emblem, which would better facilitate a story and be pretty unique for a tower defense game. But I don’t know if that will work out. Usually tower defense games require you to have lots of towers out on the play field, and if I have the units be unique I’m probably looking at only about thirty or forty units total over the course of the whole game. A possible solution might be to have a mix of hero units that are unique, and generic grunt units that aren’t unique. I guess time and playtesting will show what will work.

Labels: ,

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: ,