Tower Defense Starter Kit

The v2.28 update has gone live on the Marketplace.

Change Log:

I. Made modifications to the Weapon System component to create a unified framework that works not just for Towers, but also the Friendly AI, Hero, & Enemy Units. This basically means that you can now create new custom weapon system components that should work with all of the above types of classes.

For example, I’ve created a very basic melee component that simply applies damage to the active target. Now all AI classes (both friendly & enemy) except the ranged unit use this component to attack their targets.


The new weapon system will make it easier to integrate the XP system used for leveling up Towers to be used by Hero units, which will be the main focus of the upcoming v2.29 update.

Bug Fixes:

I. Fixed a bug that prevented Hero units from responding to new player orders while it was already executing a player move order.

Upcoming Features:

  • XP system for Hero units to level up through combat
  • Option to customize Target Prioritization setting for Towers
  • Hero selection through the pre-mission Loadout Menu

I’ve created a new & updated tutorial for creating new Towers in the toolkit based on the new features added in the last couple of updates. If you’re interested in creating your own custom Tower, you can do so by following the steps in this tutorial:

If you have any doubts regarding the workflow, feel free to reach out.

The v2.29 update has gone live on the Marketplace.

Change Log:

I. Added an XP-based leveling system for Hero units.

ezgif.com-optimize

The XP system is essentially the same one used by Towers but with slight modifications made to now accommodate other units as well. As a result, the workflow is pretty much the same, but I’ll post a tutorial soon on how to set up the system including configuring the xp target requirements, HP & weapon stat modifiers, etc.

II. Added a selection ring decal to be displayed when a Hero unit is under player control.

Upcoming Features:

  • Option to set Target Prioritization setting for Towers
  • Hero selection through the pre-mission Loadout Menu
  • Ability System for AI units

The v2.30 update has gone live on the Marketplace.

Change Log:

I. Restructured the data table design for both Tower & Enemy AI. While previously weapon stats like damage, rate of fire, range, crit chance/dmg, etc were all part of the data table, these stats are now all defined directly within dedicated weapon system components.

The data tables, on the other hand, have a new entry to specify the weapon system used by Towers and enemy units.

Instead of the previous method of having to define common stats in the data table and individual weapon-specific stats within each weapon component, now you can define all of them directly within the component itself. The data tables merely need to know which component you are using and it will be added when creating the Tower/Enemy units.

Additional Notes:

  • The aforementioned changes will slightly reduce the number of steps required to create new Towers. I will share a new tutorial for the same based on the new workflow.

I’ve updated the tutorial for creating new Towers in the toolkit based on the new features added in the v2.30 update. If you’re interested in creating your own custom Tower, you can do so by following the steps in this tutorial:

The old tutorial still holds up if you’re using versions prior to 2.30 edition of the toolkit, but has been moved over to Google Docs. A link for the same is provided at the start of the tutorial.

If you have any doubts regarding the workflow, feel free to reach out.

The v2.31 update has gone live on the Marketplace.

Change Log:

I. Added Target Prioritization modes for Towers. Towers can be set to 1 of 4 different target prioritization modes during gameplay:

Default: Chooses the first valid target based on the order of detection
Closest: Chooses the target that is closest to the Tower
Lowest Health: Chooses the target with the least amount of Health
Highest Health: Chooses the target with the highest amount of Health

ezgif.com-optimize (1)

Upcoming Features:

  • Ability System for AI units
  • Hero selection through the pre-mission Loadout Menu

I wish this would get more updates :confused:
I know you are working on other things as you mentioned on this thread and thats totally fine.
But this seems to be the most advanced TD on unreal market, so kinda my only way to go if i want to start from something solid. I feel like only a few updates are left to cover most of the Features i need.
No rush tho, i will just keep checking this thread until you dropped good news haha.

Glad to hear that you’re interested. I’m working on new updates, currently trying to create a dedicated ability system for AI units. If you have any suggestions for features you’d like to see in future updates, feel free to share them.

Hello, been playing around with this for a few weeks and have been loving it.

I was wondering though, is there a way to change the camera angle to look straight down? I tried reorienting the camera in BP_Player_Pawn, but ran into an issue where the map disappeared when I tried to zoom out (thinking it’s related to draw distance but not sure).

Side question, for the weighted spawn mode, is there a built-in way to start a countdown timer for the next wave once the current wave finishes spawning?

Hey, glad to hear that you’re having a good time. :slight_smile:

Sure, you can change the camera angle through the spring arm component in BP_PlayerPawn. Try setting its Pitch value to -90 degrees as shown here.

As for the countdown timer for weighted spawn mode, the default map uses a weighted wave spawning system, while the second map uses hardcoded/batched wave spawning. In both modes, the countdown timer should be enabled by default.

But if you want to customize the timer between waves, just open the default map Map_StaticNavMeshPathDemo, then select the BP_WeightedWaveSpawnController actor, and change its Wave Spawn Countdown Duration parameter.

If it still doesn’t work, let me know and we’ll look into what’s the issue.

Wow!!! Firstly, thanks a lot for the template and especially for sharing so much knowledge throughout the years! You are amazing.
I was wondering how do I make the tower placement not restricted by the squares on the ground? In a way that the player would be able to place the towers anywhere on the map, except for enemies’ path, of course

The spring arm component worked like a charm, thanks!

To clarify my second question, I was wondering if there was a built-in way to start a countdown after a wave finishes spawning instead of starting a countdown when the last enemy of a wave is defeated or escapes.

For example, wave 3 finishes spawning the last enemy, then a 20 second countdown begins for wave 4 start.

Thanks for the generous feedback :slight_smile:

Placing the towers on the ground in a freeform would most likely require changing quite a bit of the tower build logic. I’m swamped with work this week, but I’ll try it out and let you know by early next week.

There isn’t a built-in option for that, but it’s a good suggestion. I’ll try it out and get back to you on that. If it works out fine, I’ll add support for that through an update next week.

Alright, so this is going to require completely changing the way the player interacts with the world for building Towers, and where the tower creation/upgrade UI pops up.

Since the toolkit is based on the idea of using grid cells to store data about the status of each cell, like whether a tower is placed there, what kind of tower it is, etc, all of those functions will have to be modified to instead use the actual location focused by the player.

And additional collision checks to see if a Tower already exists within the building range of the targeted location since you can’t bring up the grid data and check it out.

If it were more in line with the default design of the toolkit, I would have happily shared a step-by-step tutorial. I can however point you out toward where to start.

So there are two main functions to determine what lies at the focused location and to determine what happens when you click there. These are DetectGridCells & ManageSelectedActorInteraction functions within BP_PlayerController.

In the first function, you’ll have to store the trace hit location in a new vector variable & remove the part that the highlights the focused grid cell. Then within the second function, if the clicked actor is a grid generator, you’ll have to pass in this location instead of grid cell information to the InitiateTowerCreationSystem function call, then follow that flow of code till the UI blueprints, replacing grid cell data with the hit location. These primarily determine where the tower creation UI will pop up, and ask it to use the hit location rather than the grid cell location.

Once you’ve gotten the UI to show up based on the location, now we have to change the Tower spawn logic to reflect that. So head over to the SpawnTower function in BP_TowerManager and have it use the hit location you stored earlier to spawn the tower instead of calculating it with the grid cell data which it is using by default.

There are more steps involved when it comes to upgrading a selected Tower as well as doing collision checks before spawning. But this should get you started in the right direction. If you have any doubts regarding what’s happening in these functions or the flow of logic, just let me know.

Hi,

Ive just been tried this out, and its very interesting, however, im already facing 2 issues.

  • Some enemies dont die on reaching 0 hp, thus leading to a un-finishable game
  • When in ‘simulate’ to look at the enemy’s information when it happens, i cant select tiles to build a tower, thus i cant replicate the bug. Note that this might be due to my more limited knowledge of unreal

Thank you

Simulate mode is not an actual representation of the what the game would be like. I’d suggest trying it out in either the Selected Viewport, New Editor Window (PIE), or Standalone Game mode.

As for the 0HP issue, I cannot replicate it at my end. So any help in trying to reproduce it would be appreciated. Which version of Unreal are you using, and is it unique to a specific enemy type? Is it happening in a new project downloaded from the marketplace, and in the PIE mode? Also if you could share a video, that would be very helpful.

That would be on 5.3, no changes apart from playing around a little with grid and grid sizes. Played in PIE.

Its inconsistent. I might be able to play a round, sometimes the literal first enemy bugs out. Had it happened with sniper being able to snipe at spawn, mostly. Especially in 2x speed.

Maybe they get oneshot before they can die ?

I was asking about the simulation as i dont know another way of pausing to click on the bugged enemies to check/debug, if you might have a suggestion there, i would appreciate it

Apparently i cant upload directly here, so instead, i uploaded it as an unlisted video on youtube

Awesome! It’s definitely the Sniper firing at an AI unit before it gets registered with the wave spawning system. I had fixed it a couple of years ago, but maybe some of the recent changes brought it back in.

I’ll work on an update and publish it later this week. Thanks a lot for sharing this info.