Town Hall Defense

Town hall defense is a game created in the subject Artificial Intillegence(IA) made by Eric Navarro and Victor Tirado. In our game, the user should have to manage resources in a city.

How to Play

The main goal is to defend the city. To do that the user must distribute resources well to be able to create new buildings and new soldiers. The soldiers are the ones to protect the city from the rebels.

By creating new buildings, which are the worker’s houses, you receive new of them who will provide you more resources. Whenever the user wants, he is able to click in any of the worker’s houses and change the path of the worker of that house so he can give more importance to the resource that he want.

The farmer gives a random between 8 and 12 corns and the user starts with one of them, creating a new farmer house gives one more farmer.

The textile worker gives a random between 8 and 12 corns and the user starts with two of them, creating a new farmer house gives two more textile workers.

The platter gives a random between 8 and 12 corns and the user starts with two of them, creating a new farmer house gives two more platters.

Creating the farmer house costs 25 corns and 50 metals. Creating the textile worker house costs 35 clothes and 50 metals. Creating the platter worker house costs 65 metals.

To build, click in the Build button to show with green squares where you can create new worker houses. When the green square appears, click inside it and it’s going to show three types of houses that you can build.

build

You can level up the worker’s houses that come up when you start playing and that gives one extra worker for each house. The buildings can be improved up to a maximum of 3 levels.

Leveling up all the worker’s houses costs 25 corns, 25 clothes and 25 metals.

levelup

There is three types of soldiers.

When the soldiers attack, they have a chance of the 70% of hitting damage.

In the case of the Simple Soldier, the damage is a random between 8 and 15.

In the case of the Punisher Soldier, the damage is a random between 15 and 20.

In the case of the Rambo Soldier, the damage is a random between 20 and 25 and has more range of shooting.

levelup

In the game there is a game win/loss condition. If the player remains alive 10 rounds, he wons the game. If not, caused because of the rebels may have destroyed the townhall, the player loses.

Behaviour Trees

In our game we have created three diferent types of Behaviour Trees according to the three types of archetypes that we have.

The first one is the Worker’s Tree, who use it the farmer, platter and textile. This three types of workers do the same job, they only work when the sun is up, they previously check if they have gone at the orchard/factory, because if they have done that, they have to go to the farm/warehouse to store the resources. An example of this is, if they are picking up resources and the sun goes down, they stop what they were doing and go to sleep, then at the next day they go first of all at the farm/warehouse to store the resources previously picked. If they don’t have resources to store, they do their normal job. Their routine is to pick up resources, go to farm/warehouse and store them, when the sun goes down they go to sleep and start again at the next day.

Worker's Tree

The second one is the Soldier’s Tree, who use it is the three soldiers that are, Simple Soldier, Punisher Soldier and Rambo Soldier and they only work at night. First of all checks if the sun is down so they can woke up and do his job, then they go directly to the rebel so they can kill him, the soldiers follow the path of them. When the soldier has low HP he goes back to the barracks so they can heal up. When the soldiers are healed up they go back to work and protect the city until the sun goes up.

Soldier's Tree

The third and the last one is the Rebel’s Tree, who uses it only one type of Rebel and only works at night. First of all checks the same as the Militar, if the sun is down he can do his job, then he checks if any type of soldier is in range to kill him, if that happens, the Rebel starts shooting the Soldier, if not, the rebel does a random between choosing a normal building or the townhall and then he starts to destroy it.

Rebel's Tree

Team

Victor

Eric

Copyright <2019> <Eric Navarro & Victor Tirado>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.