Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / [WIP] Tower Defence Android

Years of Service
User Offline
Joined: 26th Aug 2018
Posted: 9th May 2019 10:37 Edited at: 9th May 2019 10:41
This is my first game I've created (in AppGameKit or any other engine), without counting smaller projects that I gave up on.

I'm only a programmer by hobby (but doing more and more programming at work now), and only work on this on my spare time, so it goes slowly but it's starting to look like something.
I use AppGameKit Tier 2 (C++) and create it for mobile (Android for now).

It's a Tower Defence map, but with a rather large map. Here is a short demo of what I have so far:

Some details:

- There are currently about 24 different towers. On an empty cell you can only create the first type of tower. This tower can then be upgraded to either "aimless" or "aiming" tower. "Aimless" will only shoot straight in the its direction (the direction can be changed). The "Aiming" tower will aim at the "mobs" that are in range and have traveled the furthest.

- This is a render from the 3D modeling tool showing all the towers. So the color defines the level of the tower, and the different branches shows how they can be upgraded.

- When the game starts, mobs are coming in waves from the start, and will end at the endpoint (if not killed).
For each wave, the endpoint will move by one cell. So basically for every wave, the path is longer. As you can see in the video, part of the map is dark. This part get available as the path end point is moved. You cannot build on a grayed out grass cell.

- I use a 3D modeling software to design all the towers, and then with a script, I render 2D top view images of each tower. These images are used both for the display of the tower, and for the buttons for creating them.

- I use Excel spreadsheets, to define my tower's, mob's and bullet's properties, as well as the definition of each wave.
This is all exported to CSV files. Then I have a little tool (created in C++) that will read this, clean it up a little, reference the appropriate images, and write .json files. These .json files are then loaded to the game as input.
I don't know if that sounds complicated, but now I can use this in my workflow to very easily add or modify for example towers and mobs.

- As the map can become very large, I need to make sure that the performance will be OK with a lot of towers and mobs.
This is something I've spent a lot of time thinking about while developing, and will have to stress test.

- In the code, for each frame, I have done is so that I know which cells contains mobs, and which mobs are within each cell.
Whenever a tower is created, based on its range, the tower will have references to the "road cells" that are in range.
So for all bullet to mob collision, for each tower, I only check the for collision in the cells that are in range and have mobs.

- The map is semi-randomly generated (with a seed). I can tweek it to have more or less turns and so on.

- I have two projects. One in Visual Studio 2017 and one in Android Studio. Both projects share the same files. So most of my testing and debugging is done in VS, where I create a Windows application (which is much easier). And every once in a while I test with Android Studio to make sure it works on mobile. The only difference between the two, is the zooming and panning methods used.

Things to add/do:

- Nicer towers. The towers are now very simple.

- Realistic properties on mobs, towers, waves. For now I haven't spent much time on tuning the difficulty.
The damage towers do, and the mob's health are just testing values.

- Money. Need to tune the reward of killing a mob, cost of tower and upgrades.

- Lives. There is no concept of losing or winning yet. Need to make it so you loose points/lives when a mob goes
through the path.

- Other buildings/towers: some ideas are; towers that has specialties such as freezing or AOE.
Maybe buildings that are expensive but will generate money. Buildings that can be built near towers
to improve their stats.

- Not sure yet, but I want to make it so that if you have 4 towers of the same type near each other (in a square),
you can merge them to a "mega tower" that takes up 4 cells, but with greater stats.

- Saving and loading the game.

- UI

- Mob movements. Originally they were all moving along straight line in the center of the path.
I just implemented a method so that I add a varying offset to the center line. (In the video you may see they are not moving straight). This is now based on perlin-noise, but currently all mobs use the same offset values.

- Much more!

Anyway, I just thought I'd share this. Always happy for comments, good or bad!
AGK Developer
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th May 2019 23:07
Very impressive, especially your excel spreadsheet for th properties. Seems like it has a lot of depth gameplay wise as well
Virtual Nomad
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th May 2019 03:53 Edited at: 10th May 2019 03:54
looks fun to me, xtremi

does the noise movement affect how long a mob takes to get from cell to cell, or is it just for show?

and, i like the mega tower idea along with the "bank" and buff towers.

looking forward to your next update!

i used to be a TD junkie but it's been awhile; i'll be playing this when you make it available

Years of Service
User Offline
Joined: 26th Aug 2018
Posted: 10th May 2019 06:59
Thanks for the comments guys!

@VirtualNomad The speed of a mob defines how fast it travels along the center line of the path. The offset is just an orthogonal offset to that line and will not affect the speed along the path. So it's just for show, but it may make it more difficult for the "Aimless" towers to hit them (they shoot along the center line of the path).
Years of Service
User Offline
Joined: 26th Aug 2018
Posted: 10th May 2019 14:15
Did a little test with more towers (around 170 towers) and mobs (max. 60-70, not that many, but they move faster than normal).

In the video, the red road cells/blocks means that they are in range of a tower. This is just for testing purposes.
There are also a few different explosions when mobs are being killed. These are chosen randomly, I haven't decided which to go for yet.

So on my Android, the FPS stays pretty much at around 60 when I'm zoomed in, but if I zoom out and see the whole map, it goes down to 45-50.

I guess the FPS is not low because of the time it takes for towers to aim and shoot and collision detection, and mobs to move, but the rendering of the whole scene slows things down. I'll have to look into how to fix this.

Also, whenever a mob dies, it explodes. I plan to make it so the animation of the explosion is not done if its not in the view.
Years of Service
User Offline
Joined: 13th Nov 2002
Location: MA USA
Posted: 14th May 2019 18:39
All those guns not being able to aim quickly enough, just sitting there wobbling, will become frustrating to the player. Hopefully there is a way to upgrade their aiming speed.
Years of Service
User Offline
Joined: 26th Aug 2018
Posted: 15th May 2019 08:34
Yes, so this video was just to test how the FPS behaved with many towers and mobs.

All the stats such as tower's rotation speed, bullet speed and damage and the mob's health and speed are somewhat random in the video.

Login to post a reply

Server time is: 2019-11-19 00:58:50
Your offset time is: 2019-11-19 00:58:50