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

Author
Message
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
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!
blink0k
Moderator
7
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
Moderator
14
Years of Service
User Offline
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

xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
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).
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
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.
tiresius
17
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.
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
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.



xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 22nd May 2020 14:50 Edited at: 22nd May 2020 14:51
Update 22/05/2020

So my last post was almost exactly a year ago. I sort of abandoned the project, but recently decided to get back to it.
It took me some time to get the code up and running again, but now that's done, and I've started cleaning up some code and adding new features.

Here is a short video showing the current status of the game. It might not look much different than before, but there are many hours of coding behind very small changes, and fixing some of the architecture!
(Parts of the video are fast-forwarded. The last 40 sec shows the "mega tower".)



The changes since last year are the following:

TOWERS
Each tower is one of the following classes:
- AimTower: can aim at a target, and will shoot when target is in range and in sight
- AimlessTower: shoots only direction, shoots all the time as long as a target is in range
- MultiDirTower : can not aim, but rotates and shoot in X number of direction as long as there are mobs in range (forgot to put this in the video)
- BlockTower : not implemented, doesn't aim or shoot, but will be used as a support tower, for example increase range or damage of other tower. TBD.

Any of the above tower classes can have different bullet types:
- Normal: shoot straight towards a target, does not curve to follow a mob
- Follow: follows a target
- AreaSpawn: not really a bullet, but an effect that can spawn on a cell and affect the mobs passing it. Used for example for giving debuffs to passing mobs.
- Spread: not implemented yet, but will be a sort of area effect around the tower
- Chain: not implemented yet, but will be a chain effect that goes from the tower to a target, then to other targets, as a chain...

- Any of the tower classes, with any type of bullet can have a bullet hit effect:
- Damage: standard, takes damage of a hit target
- Debuff: the hit target receives a debuff that affects its properties, only speed reduction is implemented, but it could also affect max health or armor etc.
- Teleport: not implemented, but would move the target x cells behind
- TimeDamage: not implemented, but cause damage over time
- AreaDamage: not implemented, but would cause damage to surrounding mobs of a target (for example explosion)


The towers available in the game are defined in an input file, where I set, for each tower, a tower class, a bullet type, a bullet hit effect, and attribute values (damage, buff duration, range etc.).
The input file is read when the application is started and the different towers are defined. Which tower upgrades to which tower is also defined in the file.
This makes it very flexible for me to make different combinations and create a wide variety of towers with different effects.


UI
The UI is fixed a little:
- A frame shows mobs in current wave, and in next wave.
- A button shows the time until next wave. Can be pressed to send the wave immediately
- A frame shows button such as Menu, Pause, Sound on/off, Display debug info (for me only)
- The top frame is changed (added lives)
- When a tower is selected its range is shown

DEBUFF
- Added a system to handle debuffs on mobs
- This handles applying the debuff, removing it when its duration is over, what happens if two debuffs of the same type is applied etc.

OTHER
- Towers can now be sold/removed
- When a tower is placed on a cell, it will automatically fade in the direction with most cells. The facing direction of the tower can be changed.

TODO:
There are many things left to do:
- Define appropriate mobs and tower attribute for good game play (now speed, damage, life, is a bit random)
- Need better design of mobs, towers and map
- Money interests when a wave is cleared
- Create more tower types and make it more clear for the player what towers can do what
- Much more...

If anyone want to give feedback that would be great. What I am trying figure out right now, is a style for the game. I need a to decide how my towers, mobs and map should look.
Should it more tech style, or fantasy style? A mix? I need a better design, any suggestions are welcome.
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 23rd May 2020 17:06 Edited at: 23rd May 2020 17:07
Update 23/05/2020
Just a small updates since yesterday. Tested with some new tower models. Bought a cheap asset pack of turret 3D models online, and rendered sprites out of those:
Virtual Nomad
Moderator
14
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd May 2020 18:31 Edited at: 23rd May 2020 18:33
Quote: "What I am trying figure out right now, is a style for the game. "

personally, i like the primitive, cartoon-y look of the yellow and blue turrets you had before and would vary the simple details on those for progression:



otherwise, i'll be content with whatever you end up doing as soon as you release a demo

Attachments

Login to view attachments
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 23rd May 2020 18:56 Edited at: 23rd May 2020 22:03
Thanks for the feedback!
Yeah, my initial intention was to have simplistic sprites for the towers. Then I got caught up in looking for something cooler.

With simple sprites its easier to show what is special about each tower.

Now I tested something with the new towers; use some sort of colorful marker around the tower.
The idea is that the colour would show the level of the tower, and the shape show the type of tower.


Spent a lot of time setting up those new tourets, but I'm still not sure what to go for.
Anyway, I will probably spend more time on game mechanics than art for a while.

EDIT:
Here is another test; the new models with simple colors:


I kinda like this style..

xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 26th May 2020 23:33 Edited at: 2nd Jun 2020 08:15
Update 27/05/2020
I've been working on defining "debuff" effects from some tower and gave them some animations.

The video shows a freeze and burn debuff (slowing and taking damage over time). I also made the missiles explode, and a small bullet hit effect from a simple tower.

The debuff system I implemented had some complications; for example that some should be stackable and some not. I want to write more on this, but it's getting late. I will edit this post tomorrow I hope.

EDIT:
Here is some information that could be boring for many, but I thought I'd write it anyway, just for myself anyway for better understanding what I'm doing!

I spent a lot of time on this debuff system. It didn't seem something complicated to begin with, but I had redo it many times, as certain difficulties came up.

In the game I want to be able to track the total damage and total number kills the tower has done. For normal bullets this is OK; the tower has a reference to its bullets, if one hits or kills, the tower class handles it. A debuff is not referenced by the tower, if it was, it made the code architecture more complicated. A mob may have many debuffs from different towers, and every time a mob receives a debuff, I need to check if it already has that type, and if it is stackable or not. If its not stackable, I check if the new debuff is stronger or not (a stronger debuff overrides a weaker one).

Its difficult to explain, but making the towers "own" the debuff, or the "mobs" own the debuffs, made the code architecture really ugly with lots of cross-references between classes which I didn't want references between.

What I ended up making, is a MobDebuffControll class, handling all this. Every frame, every tower that applies a buff to one or more mobs, gives some information to this class.
After all towers have done this, this controller class, checks for the information received (mob pointer, tower pointer, debuff data) if the debuff should be applied to the mob or not, if it can be stacked, or if it overrides a previous debuff. (A mob can have many debuffs, either different or stacked, but can not have a debuff of the same type multiple times from the same tower.)
This is a lot of checking, and I'm planing to be able to have a lot mobs on the map, so I needed an effective way of doing all these checks.

An "applied debuff" is represented by struct with:
- a pointer to the mob
- a pointer to the tower
- a debuff object (handles how the debuff is applied, removed, processed and displayed)
- an ID (integer generated based on the above 3 fields)

I have a std::unordered_map where Mobs pointer are the keys, and the values are std::unordered_maps where"debuff type" is the key, and the value is a vector of "applied debuffs".




This way, every time a mob is in an area that gives debuff, or hit by a bullet that gives a debuff, I do the following:

I will continue writing this later...


GarBenjamin
AGK Developer
3
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 27th May 2020 05:02
Nice work! I can see you've put a good amount of effort into this so far. I also think the new "simpler" models are great. They give it all a much cleaner look.
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 27th May 2020 19:57 Edited at: 27th May 2020 20:59
Thanks GarBenjamin. Yes there's a good amount of hours, but it goes slowly; lots of learning, and at same time I'm trying to make the code so that its to later easy add more content.
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 4th Jun 2020 13:02 Edited at: 4th Jun 2020 13:19
Implemented a new tower effect; "chain effect"

Currently this effect does not affect the mobs in any way, I only fixed the visualization part.

The tower shoots a sort of beam to a mob, after a specific time, X new beams goes to X other mobs from the first target. Then the beam to the newly affected mobs can split again. The beam will continue to chain/split over to other mobs.

I can control the time before split, the range, the number of splits, and the number of "nested splits" (how many times a chain of beams can split). In this case, the tower will shoot at one mob, then the beam will split into to two new beams, and continue splitting into two from the next hit mobs. No limits on how many times it splits; a chain will stop if a target mob is out of range.

The beams are created using a shader.

I will play around with different beam styles and colors and how they affect the mobs; take damage, stop, slow down, etc.

Conjured Entertainment
AGK Developer
14
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Jun 2020 15:29
Quote: "This is my first game I've created (in AppGameKit or any other engine), without counting smaller projects that I gave up on."

Congratulations.

It looks great, and starting out in Tier 2 gave yourself a challenge, which you have conquered.

Well done.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 6th Jun 2020 14:08
Thanks Conjured. Yes, played around with Tier 1, which was fun, but most of my programming experience is with C++. I feel more confortable using Visual Studio and C++ so went over to Tier2
xtremi
1
Years of Service
User Offline
Joined: 26th Aug 2018
Location:
Posted: 17th Jun 2020 21:18 Edited at: 17th Jun 2020 21:25
Update 17/06/2020

Limited time to work on the project. The time I got went to fixing and fine tuning the debuff system and the "chain"/"laser" tower shooting.

The video below shows some example of chain styles with different shaders I've been playing with. In the video, they each have different effects on the mobs.

I also added a loading screen (first ting in the video) when opening the app.

Login to post a reply

Server time is: 2020-08-15 04:23:41
Your offset time is: 2020-08-15 04:23:41