RTS/Tower Defense
I like reading blogs and Josh has been the only one spamming them recently (j/k I know we all love hearing about LE3) so I figure other people like reading blogs too. So I thought why not make one about what I'm working on.
Over the last month or so I had pathfinding working using basically a 2D grid over a terrain using A*. Being able to move actors around like that just feels so inspiring and feels like the sky is the limit which what you can do with that. I had so much fun with just that alone. All along I was thinking about what could I make with this that wouldn't be to much to do for 1 person, would keep my attention, and would have some nice "replayability".
I really wanted to make a tower defense game, but most of these are pretty meh. I recently got back into Age of Empires 3 and would build up a nice big army only to crush the AI (even on the hardest mode). Often I had to go to their base to even get somewhat of a challenge as they never came to me with anything of value, and pretty much never on multiple fronts. It wasn't satisfying for me at all. There was no challenge there.
I like gathering resources (for some reason) and I like building up an army and placing them in strategic locations preparing for a big invasion and then having an "epic" battle. So that's the task I've set out to do. There won't be any "ages" or levels of progression. The game will be about the waves of enemies getting bigger and badder. You'll have some time between waves to manage your resources and prepare your armies for the next wave. Waves will start coming from multiple fronts. The music for each wave will get more intense and epic. The game will be about if you can survive all x number of waves.
The setting is a medieval style so some of the units will be knights, assassins, wizards, and some towers. You'll have orcs tarus, undead, and other creatures with each wave. Also some mini "boss" of sorts mixed in for each wave.
I have the pathfinding complete. When you start the game you place your "town hall" anywhere you want on the map. I have trees for wood, gold and stone mines. Still need to work on food like bushes and animals. Currently you can select your units and move them around the map and make them chop a tree for wood.
I created a task system much like The Sims. When you give commands Tasks are pushed onto a queue for the Actor. Each Task includes the Actor doing it, the GameObject being done to (if there is one), and an Action doing the actual work. I have Actions like MoveTo & Chop. If I select an Actor and right click a tree, the game will find the closest open node to that tree, then push a MoveTo & a Chop passing the tree in question to that Actors queue and the actor will move to the location, then pop that task off, then start doing the chop. When the Chop tasks starts it registers itself to an OnResourceDepleted event from the ResourceProvider (tree) so when that tree no longer has any resources it notified all Actions working on it, which will inform the Actors indirectly to stop, or pop that task off. It works pretty slick and adding new actions that can be done is really fast, easy, and organized.
Next on the plate:
==============
1. I don't want actor collision so they aren't considered in the pathfinding. However, when sent to gather a resources I want to spread them out around the resources so going to make an array for the grid of where villagers are. It'll be used when searching for the closest "open" node next to a resource when the user sends a villager to gather from that resource. Currently it finds the closest open node which means they all pretty much stack up on top of each other if they were all coming from the same general direction.
2. If a resource is depleted while gathering a villager will look for other resources in an AABB around it of the same resource type to just automatically MoveTo and start gathering to reduce the amount of micro managing requires for the villagers.
3. Basic UI in place so I can start making other buildings with resources by clicking on these buildings.
So far going pretty strong with this game. Pathfinding makes all the difference with me. Seeing a game have some kind of life moving around is exciting.
- 2
2 Comments
Recommended Comments