Tuesday, 13 November 2012

Kicking off a new project - Tower Defence!

I've started working on a new game... Yayness!

This game will be a little more involved than my previous offerings, and to get it right could easily take weeks or even months of spare time. That said it won't be super advanced in any way, the slow progress will have more to do with the fact that I'm an amateur developer learning as I go than anything else!

The plan is to make a tower defence style game for android. I've got a few themes floating around my head at the moment (swords and sorcery, space sci-fi, WWII battlefield, cute zombies, scary zombies, etc) but to start with I'll just work with abstract shapes and get the mechanic up an running, theming can wait!

So, what do I have in mind for this game?

The world won't be confined to the screen, levels can be any size (within reason) and the player will be given the ability to pan around the world at will. I'm thinking swipes of the touchscreen to scroll around, and maybe even pinch/stretch gestures to zoom in and out.

Levels will be tiled and read in from map files (nothing new here), and will be multi-layered (this is something new to me) allowing me to create a visual layer (grass, path, river, tree, base, etc), and an invisible layer (controller objects like enemy spawn points and directors that push the enemies along the path, etc).

Levels will support multiple spawn points, some levels will have just the one spawner, others maybe three or four. So far I'm planning on protecting just a single base per level, but I guess I could handle multiple bases too. Spawn points will spit out enemies periodically, and each spawn point could have a different spawn rate, in fact the rate could potentially be modified mid-level, either at the end of each wave, or even during a wave.

I think it would be cool to have different enemy classes with different strengths and weaknesses. Rather than having turrets that deal X amount of hp damage per hit to enemies, I think enemies having for example a strong fire defence and a weak ice defence and having fire/ice turrets would add a lot more depth to the game. A level could start out spewing fire elementals that a smart player would build ice turrets to deal with, and in a later wave turn the tables on the player by spouting ice elementals (meaning you'd want to replace your ice turrets with fire turrets). I could get particularly evil and have fire attacks restore the health of fire elemental enemies (a la final fantasy). There could even be mixed waves of various elementals spawned from the same point to really shake things up! I'll need to ensure as the complexity increases the game doesn't become more frustrating than fun - balancing the difficulty will be key. I'll just start with the basic X amount of hp damage per hit approach for the prototype, the added depth can wait, but I do think it would be cool to do eventually...

I'm considering an experience based purchasing system, not just resource based. In game you'll receive bounty for killing enemies, this money can be spent on turrets (or wizards or tanks or whatever). Completing a wave or level could award you with XP, these points could be spent on weapon unlocks, allowing bigger and better attack units to be built next time you play (a nice side effect of this is that if you are a bit rubbish at the game you still get XP for the few waves you do complete, this allows you to use upgraded weapons next time you play, meaning you will eventually progress through the levels if you keep at it, natural difficulty smoothing sounds great and will make the game accessible to all types of player).

A lot of developers allow the shortcut of in app purchases to prematurely unlock beefier weapons. I *might* consider going this route, but to be honest I think it would result in game-breaking builds so probably won't go for it, I'd rather make a free version available with a limited number of levels and a full version with extra content for £1 or something rather than use in app purchases. Often the in app purchases can feel like a bit of a swizz, you wonder if the developers artificially increase difficulty to force you down the purchase route etc, that's not really my style.

I will want to go for an achievement based level rating I think. Maybe one star for surviving all the enemy waves in a level (next level unlocked), two stars for surviving all waves and base still at 50% or more hp, and three stars for a perfect game without any damage at all to the base. I'm a sucker for 100% completing games, and I know I'm not the only one. This approach would keep me coming back for more over and over again, but it also caters to the less OCD players out there that would be happy to survive a level and just progress on to the next.

The players attack units will be upgradeable. I'm thinking increases in range, rate of fire, and damage would all be good. Maybe it would be fun to have a points based system where at upgrade level 1 you have 10 points that can be allocated to these three stats, at upgrade level 2 you have 15 points to allocate as you wish, etc. This sounds interesting, BUT I don't really want players bogged down in menus for most of the game, it should be a fast and furious frantic game experience, not a highly strategic puzzler. I think it would probably be better to go for a simple "upgrade adds 10% to all stats" approach to be honest.

Finally, it seems most tower defence games choose from one of two pathing options for enemy AI, either waypoint based (enemies stay on the path) or algorithmic pathfinding (enemies follow the most efficient path, avoiding obstacles). The A* pathfinding approach looked a little daunting on first glance, but to be honest I don't think it would be impossible for me to implement. Having played my share of tower defence games though I must say I prefer playing the waypoint path based style, so that's what I'm going to be using in this game. I could always do an A* version in the future if I want :)

I will be deviating from the standard waypoints approach in my game in one respect - instead of having a set path through a level from start to finish, I'll use director objects to add an element of randomness to the levels. When an enemy occupies the same space as a director, the director object will force the enemy to change direction. By weighting potential direction changes and making use of a random numbers I can set forks in the road that add an additional level of chance/strategy to the game. One fork might split enemies along two potential paths at a 50/50 split, another might have a 90% chance of sending the enemy left, and a 10% chance of sending the enemy right - the player might opt for less defences on the less traveled path, which seems sensible, but they'll have to react quickly if their luck is running low and a boss enemy ends up travelling along the poorly defended route! This should mean that repeated playthroughs aren't going to be too predicable.

So that's it, that's the plan. There's a lot to do. So far my prototype consists of a single level map loaded in from file, rendered to screen (using horrific placeholder graphics), and consisting a single spawn point, a single base, and a number of director objects that push the enemies along the one and only possible path between spawnpoint and base. As for player experience, the keyboard controls allow the player to pan around the level and zoom in and out, and that's it. No turrets exist or can be placed, so all you can do is helplessly watch the enemy hordes destroy your precious base, and then on game over the level restarts, repeat ad infinitum in one endless nightmarish infinite loop. Plenty left to be getting on with then!!