Tower Defense Starter Kit

The v2.18 update has gone live on the Marketplace. This is one of the biggest updates in quite some time, focusing primarily on improving the Tower side logic. As a result, I’ve released it only on 4.26 (and hence the long delay for 4.26 compatibility) and the previous version of the toolkit is still intact & available if you download the 4.25 edition of the toolkit

Change Log:

  • Added a new Team ID system that streamlines the threat detection and damage application logic. Instead of checking through a list of enemy classes, you can now directly call the IsTargetAnEnemy? global function to determine if a target actor is an enemy or friendly.

  • Revamped the Projectile blueprints to make it easier to create child variants with different Hit Response logic. Also integrated the new Team ID system to prevent friendly fire damage.

  • Moved the overlap based Target Detection logic for Towers to the parent class. This makes it easier to create new types of Towers without having to implement the same logic again. Works for both offensive towers and support towers (like Boost) alike.

  • Revamped the Tower Functions to greatly reduce the amount of scripts to be added to the Tower parent class when adding a new ability. Also added a new parent blueprint class (BPC_TowerFunction_Parent) to act as a template for creating new Tower Functions in the future.

    For reference, here are the functions that were added to implement the Overdrive & Repair Tower Functions in v2.17:

    And here is the implementation for the same in the new v2.18 version of the toolkit:

  • Added new Getter & Setter functions in the Tower parent blueprint for accessing both default and active values of all major Tower attributes.

  • Created a new component-driven design for handling the Tower firing systems. This includes both offensive modules like Laser, Machine Gun, etc and support modules like Boost (Mining Tower not included). As a result, creating new Towers will involve very little in the way of making changes to existing logic in the Tower blueprints.

    Again for reference, here is the blueprint for the Laser Tower from v2.17.1:

    And here is the same blueprint from v2.18:

    As you can see, the child Tower only needs to notify the component about a particular event. And you implement the firing system logic through dedicated components (*which can be inherited from **BPC_TOM_Parent *for offensive modules) and activating/deactivating them as required.

  • The Lock On System has also been revamped to make it far easier to understand. Dealing with various support tickets over the years, I’ve generally gotten the idea that this was an area that was difficult to understand for a lot of new users. So I went ahead and completely rebuilt it from scratch. Gone are the endless series of functions and in its place, you get to see the flow of logic directly when you open up the **BPC_LockOnSystem **blueprint.

    Again this is easier to explain with comparison screenshots. And here is the 2.17 version:

    Here is the new improved blueprint in v2.18:

  • Finally, added Unreal Engine v4.26 compatibility to the toolkit.

And with that, we’ve come to the end of change log for v2.18 edition of Tower Defense Starter Kit. I’ll be soon posting a more detailed account on some of the new changes in my blog. So stay tuned for that! And feel free to share your feedback on the new changes.

Really excited to see the new update. The changes you’ve made definitely make things cleaner and easier. I downloaded a clean 4.26 project and ran through the test levels, and I saw a few instances of the laser tower getting stuck firing, or not appearing to fire when I would expect them to. 4.26.1, clean project from marketplace, no modifications, no plugins enabled (other than the default stuff).

Hey, thanks for pointing that out. I believe that is happening in some instances when the Tower is deactivated by a nearby Tower Disabler. I’ll be releasing a hot fix update along with some minor changes to the Global Abilities later today.

The v2.18.1 hotfix update has been submitted to the marketplace.

Change Log:

  • Added fixes to prevent Laser Beam Emitter from getting stuck in place when the Tower gets disabled.

  • Added support for Global Abilities to be deployed on Landscapes. Previously deployment of Global Abilities relied on checking if the target surface implemented a specific interface. Since this workflow didn’t support non-blueprintable actors like Landscape, it was not possible to use Global Abilities on the same.
    Now the interface check has been replaced with an Actor Tag (default = GATarget) check specified through the Global Abilities Manager as shown below:

    So in order to make an actor targetable for Global Abilities, just make sure that it blocks the **GlobalAbilityTargeting **trace channel and add the **GATarget **actor tag to it.

Additional Notes:

  • Search for Version2_18_1 in the blueprint editor to identify the new changes in this update.

Hello and thank you very much for your project. I’m currently taking my first steps on Unreal Engine and I’m using your project to learn. I wanted to know if you would have the possibility to integrate the coop functions

Hi there, congrats on making the first steps into UE4. Glad to hear that you’re using the toolkit for your project. Unfortunately, I do not have any experience working on the networking side of UE4 and hence there are no plans to add coop/multiplayer support. If you have experience working on coop projects, it should be possible to add it but I’d assume that it would require a lot of changes.

Hello can you tell me how to extend the limits set for camera movement pleas. I would also like to know the new way to add my turret since your update

You can extent the limits by selecting the **BP_PlayerMovementBounds **actor from the level and increasing the X/Y values for its Trace Blocker Extent parameter. This is the maximum extent at which any sort of player interaction can happen. The actual camera bounds is basically this value divided by BlockerBoundsToMovementBoundsRatio. For the default value of 3, that means if you have Trace Blocker Extent of 10000, the extent for camera movement will be around 3333.

As for adding new Towers, it follows the same process as before the update. You can follow this tutorial for that:

If the new Tower is going to function similar to one of the existing Towers, I’d suggest duplicating that Tower instead of creating a new child in step 1. If the functionality is different, then the process would depend on what exactly the Tower does. As a general principle, you’ll have to implement the following functions in the new Tower:

The first two blue functions (see BP_MachineGunTower) are almost always going to be required. That’s where you say what happens when the Tower acquires/loses a target.

The first two green functions (LockOnConfirmed & LockOnCancelled) will be required if you are using the LockOnSystem to keep tracking a single target, like with the Laser Tower. By default, the former is used to Activate the firing logic while the latter is used to Deactivate it.

The remaining two green functions at the bottom are only required if your Tower has a turret that rotates to face the target (like with the Machine Gun Tower).

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

New Features:

  • Tesla Tower: The Tesla Tower fires powerful bolts of lightning that can arc from its primary target to all nearby enemies, thus making it effective at thinning out crowds of enemy units.

Loving the Tesla tower type add. But I can not get enemies to spawn after adding per video steps with only one change. Added audio to be played instead of print string.

I am using UE 4.26 and 2.18.2 version of kit / Just now getting to focus more on enemies unfortunately I am being tripped up after following the video for adding new enemy (the only different step is I added a small 2D sound .wav to spawn attach with it) attempted to run a test, after count down none of the enemies will spawn. With console message: WARNING: [Class: BP_WeightedWaveSpawnController] Message: AISpawnWeightDistributionArray generated with zero elements

Using debug tool I still could not see how to correct this.
The only items I noticed were inside the BP_WeightedWaveSpawnController > Prepare AISpawn Weight Dist Array for New Wave /this is where everything seems to stop.

So I replaced the DT_EnemyAIStats with a Non altered copy by shutting down UE and the launcher removing the CampaignProgress.sav file and put a copy of the DT_EnemyAIStats from another project TDS kit with nothing edited ran test again after checking new data table file and making sure it was not the old one and same error occurred.

I have sent a few videos of what I see.

Hi Phil, it’s good to see you again. I went through the video you shared via email and noticed that the execution flow is breaking when encountering a Branch condition for “CanBeSpawned” parameter in the PrepareAISpawnWeightDistArrayForNewWave. So this is most likely where the issue lies. Could you try setting the **CanBeSpawned **parameter for all elements in the **AISpawnWeightingDataArray **to True, and see if that makes any difference?

Edit: Also below is an example of what you can try as values for the array. You can ignore the “DataTableRowName” parameter and leave it as “None”, since it will be automatically retrieved from the Data Table for each enemy type.

Following this part definitely resolved that issue. I will update if I determine what causes the data to become erased, since this occurs with each new enemy added.

So if using—> Tower Defense Starter Kit Tutorial (v2.12): How to Create New Enemy Types : Use to resolve broken enemy spawn–> " Could you try setting the **CanBeSpawned **parameter for all elements in the **AISpawnWeightingDataArray **to True, and see if that makes any difference?

Edit: Also below is an example of what you can try as values for the array. You can ignore the “DataTableRowName” parameter and leave it as “None”, since it will be automatically retrieved from the Data Table for each enemy type."

Thanks Again!

Hi Phil, glad to hear that you got it working. I’m guessing this was the glitched-out post you mentioned in your email. It probably became fixed when Epic upgraded the forums.

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

New Features:

I. Added a new Global Ability: Regen Field. All Towers within the field regenerate their HP over time.

II. Added unique deployment options for Global Abilities. “The DT_GlobalAbilities”
data table now has a new parameter “TargetVerificationTag” that enables each Global Ability to be individually configured for activation only on certain types of target actors.

To enable an ability to be deployed on certain actors, just add the same tag to their list of Actor Tags as shown below:

An example use case for having unique tags would be to enable the Airstrikes ability to be deployed only on enemy paths, while activation of Regen Field can be limited to only tower grid cells.

Additional Notes:

I. Search for Version2_19 in the blueprint editor to identify the new changes in this update.

Edit: Posted a tutorial going over the process of using the new Target Verification Tags to set up Global Ability Deployment: Tower Defense Starter Kit Tutorial: How to set up Global Ability Deployment

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

New Features:

I. Added a Hero unit: In addition to the existing reinforcements ability, the toolkit now supports Hero units that offer a more permanent defensive solution compared to the temporary reinforcements.

II. Added a Hero Manager: The Hero Manager is tasked with spawning the Hero and passing on player commands to the Hero. The feature set will be expanded in the upcoming updates to include support for selecting a Hero of your choice from the Loadout menu.

III. Added Hero Movement Commands: The player can override the default Hero AI behavior by issuing movement commands for the unit. This can be used to deploy the Hero unit where it is most required as a defensive option. Here is a short preview of it in action: (2)

Other Changes:

I. The Tower Function activation logic has been streamlined thanks to the new Add Component by Class BP function introduced recently to UE4. Instead of having to manually add components for each Tower Function separately, the system now directly retrieves the associated component class from the DataTable and spawns in a component of said class.

For comparison, here is a screenshot of the old workflow from v2.19:

And shown below is the new workflow from v2.20:

II. Moved all HUD update requests to the Player HUD class.

Any request to update the HUD will now be passed to this blueprint, which will then pass the required information over to the active widget.

Bug Fixes:

I. Fixed a bug that had caused some units to survive in spite of their HP being depleted. This happened in rare instances when a powerful single shot tower like the Sniper damages a weak unit like the Rusher just as it is being spawned, before the AI unit has finished its Begin Play execution. Now a new check ensures that the Towers only damage units after they have finished their initialization protocols.

Known Issues:

I. When a Hero unit gets destroyed when you’re controlling it, the movement targeting system doesn’t turn off automatically. This will be fixed in the upcoming update.

Additional Notes: Modifications to existing blueprints are marked with the boolean variable ‘Version2.20’ to easily identify all the changes introduced with this update.

Upcoming Features: HP Regeneration and Respawning system for the Hero unit. A UI button to select the Hero as an additional option besides clicking on the unit directly.


How to modify the movement speed of AI in the game?

Inside the data table DT_EnemyAIStats, you can find a MaxMovementSpeed parameter. You can edit this parameter to set custom movement speeds for all your enemy AI.

Sorry, I didn’t express what I meant. During the game, if I want to press the key to change the AI movement speed, which variable should I modify?

If you’re using Unreal’s navmesh for AI pathfinding, then you can change speed through the Character Movement component’s Set Max Walk Speed.

If you’re using the custom Spline-based paths for AI, then it can be set through the MaxSpeed variable in EnemyAI_Parent class.

Increasing the value of maxspeed has an effect, but decreasing it has no effect.
I hope I can press the key to make the AI go slower