Tower Defense Starter Kit

Hi, I will not have access to my computer until this coming Monday & hence will not be available in the forums. However I will have access to my mail. So if anyone has any queries regarding the toolkit, you can reach me at: rohitmohan.k@outlook.com

v1.1 Update Dev Log #1:

The upcoming v1.1 update for Tower Defense Starter Kit features a new dynamic Tower Selection Menu that enables players to select towers at level start. Using this new system, the designers can also specify the available towers as well as maximum number of selectable tower types for every level.

The in-game Tower Construction/Upgrade menus have also been revamped with a new modular & dynamic data driven approach that automatically calculates & adjusts the size, position, number of child widgets, etc at runtime & thus prevents the need to make HUD changes everytime new towers are added into the project.

Preview Video:

Great asset!

Preview looks great! Looking forward to seeing these updates. Keep up the good work! :slight_smile:

Thanks SumFX. :slight_smile: Will definitely be adding some cool features in the upcoming updates. If you have any suggestions, please do let me know.

Thanks Reubitron. :slight_smile: Planning to submit it sometime towards the end of this week. Have a couple of small feature requests & then 4.11 testing bits left.

Thanks for making and selling this amazing asset, the code is great and easy to work with, and works very well as the base for my project; a bullfrog inspired tower defense/sandbox/ micromanaging game :slight_smile: Cant wait for the 4.11 update so I can start development on parts of the game that will need more extensive modification…

preview of my AI build queue:

Thank you for the feedback, 2sneaky. Glad to hear that you’re enjoying working on it. :slight_smile: I just went through all your videos on Tower Defense games. It’s really great to see what you’ve done, especially the lightning towers & the core effects in the first person TD game & pushing up to 1000 units in the other one. And I never anticipated the UI based tower spawns to be linked with normal RTS building constructions. And I must say that the FPS TD version looks quite good. My mind has been stuck with seeing the default toolkit template all this time and I really couldn’t picture how cool it would look with some custom meshes & effects. So thanks for that & keep up the good work.

I’ve finished implementing all the features for the first update, just have some testing remaining. I’m currently stuck with this stupid Code 0 download error that prevents the Unreal Engine from getting downloaded without some random manual tinkering every half an hr. Hoping to get it over with soon, but yea the update will bring a lot of new features especially on the HUD front. There’s a new mining tower & improvements for Tower Spawn & Upgrade logic. Basically in a manner of speaking, everything is going to be much more dynamic & modular, which does make the code more complicated compared to the vanilla version, but suitable for projects focused on customizing & adding new features. The 4.10 version will still be available just in case people want to use the base version.

Thanks for the nice reply Stormrage! Glad that you like the stuff I’ve done with your template so far, and if you like the lightning effect I’d be happy for you to use it in the template instead of or optional with the basic laser (perhaps the electric turret attacking up to four enemies simultaneously, as an example of a semi-aoe/crossfire turret?) - it actually is your laser particle with a bit of noise added for the crackly-ness:

As for the 1000 units, it was a lot of fun trying to push 4.11 to its limits with its performance increases to many animated actors on screen, and 1000 seems to be a barrier, the engine runs great up to 500, and decently up to 1000 as soon as it goes past 1000 the framerate drops from ~50 to ~15, at around 4500 the editor stops responding :smiley:
I plan to try making ‘group’ enemies(which is how a few 3D TD games for mobile seem to do it), e.g. 15+ enemy meshes all part of the same actor moving along the splinepath which handles dying of each of its sub-actors separately to reduce overhead due to the spline movement, which becomes very large above a few hundred… Ill post a video when I do!
If it would help you with the release of the new toolkit, I’m also happy to help test it for you if you would like, just let me know! I cant wait to see the improvements you’ve made :slight_smile:

Lastly: for another look at just how different your kit can look with different setups, heres a cartoonized celshaded version:

Thanks for sharing the parameters for the lightning tower. I do want to add some lightning tower at some point, which functions similar to the Tesla towers in Defense Grid. So it will definitely come in handy. :smiley:

I wasn’t aware of creep groups. I will definitely look into that while working on future updates. Also another thing that I came across in the FPS Tower Defense Toolkit thread was object pooling so that we can reuse objects instead of spawning new ones. It might be really useful when we’re dealing with large numbers of machine gun towers & ranged creeps, as it can lead to a lot of projectile actors getting spawned in a very small amount of time. It’s not really something that I want to implement right now, but further down the line once the toolkit has a lot of the standard features seen in Tower Defense games, it might be exciting to try out stuff like these.

As for the new version, I just got v4.11 finally. It was a real pain going through the download process, but yea on to testing now. Hoping to submit all three toolkit updates this Monday. And the updates are quite huge, so it would definitely be great to have an outside perspective on the new version. :slight_smile: I’ll share the files with you later today.

Hello Stormrage256,

Thanks for making this awesome toolkit. This is great base for my tower defense game!

I have few questions regarding this toolkit based on that image:

  1. Do you plan to add logic for Grid that user won’t be able to build tower in case when path would be blocked? On Image I have added simple case when user build towers(green) and tried to build tower(red) but it won’t allow him to do that. Now user can build towers on each grid.

  2. In FPS Tower Defence Toolkit if user builded tower on wave path it was updated to go different path. But in my case even if I builded towers(only green not red) wave is going blue path instead of orange path and I have set dynamic path for waves. What could I do wrong?

Kind Regards!

Hi Abdizriel, thanks for your generous feedback. :slight_smile:

  1. In the FPS Tower Defense Toolkit, the tower construction & combat mode are mutually exclusive modes. So the AI does not need to update it’s path on the move because it has already been determined in the tower construction phase itself. I was checking if the path exists by first placing a holographic tower to block the path & then verify if there could be an alternate path from the spawn point to the core. However, in the Tower Defense Starter Kit, you can set up towers both prior to the wave as well as during the actual wave. As a result, spawning a holo tower to block the path is not an option since it will block the enemy AI as well. Which leaves us with two options: disable tower spawn during the wave, or use a custom pathing algorithm like A*. I can look into the first option in the next update, maybe add it as an optional feature. I will try it out in the coming weeks & let you know. As for the second option, it is something that I want to try, but it’s more of a long term goal for the toolkit.

  2. To enable dynamic AI pathing, first you would have to set the ‘RunTimeGeneration’ parameter of recast nav mesh to ‘Dynamic Modifiers only’ as shown in the screenshot.

After that, set the Navigation type parameter in the Wave Manager to ‘Dynamic’. With both of these options turned on, the AI dynamically alter their path once you have placed a tower in their path. However since the default box extent of the nav modifier volume component in the Towers are set to a low value, the AI units can pass in between towers. If you do not want them to pass through, you can increase the box extent of the nav modifier volume in the x & y direction as shown below:

As you can see, I have increased the box extent in the x & y directions from 75 to 180 [almost close to half the default grid size]. The nav modifier volume basically prevents the enemy units from passing through it. So with a high enough value, now the AI units will have to go across the outer perimeter.

The v1.1 update has been submitted to the marketplace team. I will add more details about the new changes in the coming days.

Thank you for your support Stormrage256. It helped to fix me issue with going throught towers.

I’ll try to implement custom pathfinding algorythm and if I do something I’ll let you know. But for few weeks I may not be able to do anything since I am relocating.

Glad to hear that it’s fixed.

Awesome! Any suggestions in that regard would be really valuable to improving the toolkit. Good luck with your project. :slight_smile:

Documentation (v1.1):

BP_GameInstance:

  • Acts as a centralized hub for storage & retrieval of important information through the Level Data Array, Tower Data Array, Tower Functions Array, & Global Abilities Array.
  • Initiates high level HUD transition procedures.
  • Handles loading of levels, level unlocks & saving information regarding the same.

BP_PlayerPawn:

The default pawn class for the toolkit. It handles all the player inputs which include basic top down camera movement, multi layered step zoom, edge scrolling, grid cell visibility, manual wave activation, tower selection, etc.

BP_PlayerController:

The default player controller class for the toolkit. It manages the creation/deletion of widgets, tower point updates & the logic for identifying & displaying stats about focused actor.

BP_GameMode:

The default game mode for the toolkit. It contains a list of references to all the high level blueprint actors and classes. Since ‘Begin Play’ events are not used to prevent possible conflicting game flow scenarios at launch, most of the initialization events are called from the game mode. The Game Mode initializes all the important actors including the Tower Manager, Wave Manager & Enemy Spawn Points as well as the Game State & Player Controller.

BP_GameState:

The default game state class for the toolkit. Creates the Grid Data Array at level start & handles all further updates to it.

BP_PlayerHUD:

The default HUD class for the toolkit. Handles high level HUD state changes.

BP_TowerManager:

The Tower Manager class is primarily responsible for the management of towers & grid data arrays at runtime. The user defined ‘Tower Data Array’ & ‘Tower Functions Array’ serve as a central hub for specifying all necessary parameters about tower management. For more details, check out: https://forums.unrealengine.com/showthread.php?102675-Tower-Defense-Starter-Kit-Support-Thread&p=485950&viewfull=1#post485950

BP_WaveManager:

The Wave Manager class in Tower Defense Starter Kit is responsible for handling creep wave spawns as well as tower point resource allocation. It also provides optional support for setting up wave timers to give a head start to players. For more details, check out: https://forums.unrealengine.com/showthread.php?102675-Tower-Defense-Starter-Kit-Support-Thread&p=485859&viewfull=1#post485859

BP_EnemyAI_Parent, BP_EnemyAI_Healer, BP_EnemyAI_Ranged, BP_EnemyAI_Runner and BP_EnemyAI_Tank:

The default creep templates available in the toolkit. More details at: https://forums.unrealengine.com/showthread.php?102675-Tower-Defense-Starter-Kit-Support-Thread&p=485985&viewfull=1#post485985

BP_Tower_Parent:

The parent blueprint class of the towers that can be placed in the level, either through editor or during the game. It handles grid snapping of towers placed in the editor as well as damage receive events, 3D health bar updates, HUD stats updates, tower upgrade cost/stats calculations, etc. Child blueprints include BP_LaserTower, BP_ShockwaveTower, BP_MachineGunTower, BP_SniperTower, BP_BoostTower & BP_MiningTower.

BP_BoostTower:

The Boost Tower increases the ‘Output per Cycle’ of all non-boost towers within it’s range.

BP_LaserTower:

The Laser Tower deals continuous instant hit damage to a single unit. Laser beam particle system used to display the offensive functionality.

BP_MachineGunTower:

The Machine Gun Tower rapidly fires low damage bullet projectiles at a single target.

BP_SniperTower:

The Sniper Tower is an extremely long range tower that fires a single high damage projectile at a target. Takes much longer to reload when compared to other towers.

BP_MiningTower:

The Mining Tower slowly generates resources over time until it’s resource pool is exhausted. Tower upgrades increase the rate of harvesting as well as the resource cap.

BP_ShockwaveTower:

The Shockwave Tower is an AoE tower that deals damage to all units within it’s range at periodic intervals.

BP_GridGenerator:

The Grid Generators provide a modular platform for placement of towers & supports easy drag & drop functionality in the editor. Can display grid cells that provide the designer with the visual data of the grid system. The variables ‘GridCountX’ and ‘GridCountY’ can be used to change the properties of Grid Floors from the editor view.

BP_ExitPoint:

Serves as the central objective of the game. Contains logic required to handle creep overlap & end game event calls.

BP_EnemySpawnPoint:

Creates spawning volumes for AI Bots. Also displays information about upcoming enemy wave to the player. This is one of the 5 actors that are necessary for the toolkit to work. All of these actors can be found in the ‘Gameplay actors’ folder. Multiple spawn points supported. The Enemy Spawn Point also handles creation of nav path splines as well as runtime updates of the spline path based on tower placement.

BP_GridCellDetector:

The primary function of the Grid Cell Detector is to highlight grid cells that are focused by the mouse cursor. It also displays range of selected towers as well as the Tower Constructor menu for the towers. The button positions within the Tower Constructor menu are also calculated from within the Grid Cell Detector at level start, in order to a provide dynamic & autonomous HUD setup.

BP_KillZVolume:

The Kill Z Volume actor acts as a safety net to destroy any actors that might possibly fall through the default plane, either due to collision or ragdoll effects. Not required within the current setup of the toolkit.

BP_BulletProjectiles:

The Bullet Projectile class is used by all entities that use projectile based weapons to damage enemy units. It inherits the damage value from the spawning parent.

BPI_GridLink:

This interface is used to get the grid data about the actor that implements it. Used by towers & grid generators.

BPI_TowerFunctions:

This interface is used to implement tower upgrade/sell functions as well as to handle tower points resource updates during tower construction.

BPI_UpdateHUDStats:

This interface is implemented by all actors that need to update the target stats menu in the HUD, when they’re focused/clicked upon by the player.

Widget_GameHUD:

The Game HUD widget displays all necessary information about the state of the game including target stats, tower points availability, wave number, remaining health, game speed, etc.

Widget_HealthBar:

The Health Bar widget is used to display the health of towers & creeps at runtime.

Widget_LoadoutMenu:

The Loadout menu displays the list of towers selected by the player. It also enables the player to select new towers for each of the available tower slots.

Widget_SelectionButton:

Enables selection of new towers based on the associated button index within the Loadout & Tower Selection menus.

Widget_TargetInformation:

Dynamically displays stats about selected/focused actors based on their attributes.

Widget_TowerBuildButton:

Enables construction of towers from the Tower Constructor widget.

Widget_TowerFunctionsButton:

Enables use of tower functions for the selected tower from the Tower Constructor widget.

Widget_TowerConstructor:

Dynamically displays an interactive UI system that enables tower construction as well as use of tower functions based on the player input.

Widget_TowerListBox:

Widget containers that can dynamically add & remove tower buttons based on player driven decisions. Used in the Loadout & Tower Selection menus.

Widget_TowerSelectionMenu:

Enables tower selection at level start. Also displays information about the focused tower.

Widget_EndGameHUD:

Enables level restart & exit functionalities.

Widget_Stats:

Used to display a single stat about upcoming wave & towers/creeps.

Widget_WaveSpawnDetails:

Displays information about the creep units in the upcoming waves.

Hey tanka2d, the Mining tower is now available in the new v1.1 update for the toolkit. You can set resource caps & harvest rate, both of which can be upgraded. Since there were a lot of other huge improvements to the toolkit apart from just adding support for v4.11, the catapult tower will be added in the next update.

Update I (v1.1) [Compatible with Unreal Engine v4.11] project files are now available in the Marketplace. Since this update brings about a lot of changes, both in terms of new features as well as the improvements over the previous v1.0 implementation, the update has been released only for Unreal Engine v4.11. This ensures that anyone who wants to keep using the v1.0 implementation can still download the v4.10 project files from the Marketplace. Listed below is a brief overview of the code changes in the update:

  • Loadout & Tower Selection menus added to enable tower selection at level start. The list of available towers in the Tower Selection menu are populated dynamically based on the information specified in the new Tower Data Array. [Preview video: https://www.youtube.com/watch?v=uqLN_pxcR5k

  • The new Tower Constructor widget enable dynamic tower construction/function in-game menus [right down to button positions] based on the towers selected by the player as well as the data specified in the Tower Data Array & Tower Functions Array. Since the tower constructor can shift between a Tower Build menu & Tower Functions menu based on the context, this ensures that no HUD changes are required when adding new towers/tower functions as long as the necessary information is specified in the aforementioned struct arrays.

  • Data driven tower spawn workflow implemented. Unlike the v1.0 implementation of setting default values within the tower blueprints, this new implementation showcases how to use data stored in struct arrays to control the attributes of the towers. By having all the data in the Tower Data Array, the Tower Manager acts as a central HUB for setting all user defined attributes for towers.

  • New towers: Mining tower. The Mining tower harvests resources at regular intervals until the resource pool gets exhausted. Both the resource cap as well as the harvest rate can be increased through tower upgrades.

  • The new modular target stats widgets can dynamically alter themselves to display relevant information about the focused/selected target based on a combination of data retrieved from struct arrays as well as the new interface functions.

  • Blueprint interfaces added to handle tower functions like upgrade/sell features & target stats display.

  • New HUD class to manage high level HUD state changes.

  • Simplified output boost implementation for the Boost Tower.

  • Added provision to set the scale [number of digits succeeding the decimal point] for target stats display in order to prevent clipping of text between widgets.

  • All Grid Data updates now handled within the Game State blueprint only.

  • Added level boundaries to prevent camera from going offscreen. [thanks to tanka2d for pointing out the issue]

  • Tower upgrades now improve the rate of fire & tower range/resource cap alongside the normal output increase.

  • Stats for all offensive towers now display Damage Per Second instead of the regular output per cycle value, thus providing more useful data to the player when interacting with towers.

  • Setter functions implemented to enable variables changes to occur only from within their parent objects.

  • Improved code standardization & optimization implemented across all classes.

All changes within the blueprints are marked with the boolean variable ‘Version1.1’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables as well as functions added to existing blueprints are also marked in the event graph as shown below:

b35044cf16ac6d18452a96a809943248bf1abb1d.jpeg


Changes in the Content Browser:

  • New enums: EHUDState, EHUDStatsType, ETowerConstructorMenuType & ETowerFunctions.

  • Enum EEnemyType renamed to ECreepType.

  • Member name changes/additions in the enums ENavType & ETowerType.

  • ‘BP_BulletProjectiles’ blueprint moved to ‘GameplayActors’ folder.

  • ‘BP_GridCellHighlighter’ renamed to ‘BP_GridCellDetector’.

  • New interfaces: BPI_GridLink & BPI_TowerFunctions.

  • New functions within the interface ‘BPI_UpdateHUDStats’.

  • ‘Struct_GridGeneratorData’ renamed to ‘Struct_GridCellData’.

  • ‘Struct_MapGridData’ renamed to ‘Struct_GridData’. New member added to struct.

  • New structs: Struct_HUDStats, Struct_TowerData & Struct_TowerFunctions.

  • New tower: BP_MiningTower.

  • New default HUD class added: BP_PlayerHUD.

  • New widgets: Widget_LoadoutMenu, Widget_SelectionButton, Widget_TargetInformation, Widget_TowerBuildButton, Widget_TowerConstructor, Widget_TowerFunctionsButton, Widget_TowerListBox & Widget_TowerSelectionMenu.

  • Renamed ‘WidgetBP_EnemyTypeData’ to ‘Widget_Stats’.

  • New static mesh: ‘SM_MiningTower’.

Awesome, I’ll have to check it out when I get a chance.

I will need to send you my game progress when I have it up and running. I’ve modified to toolkit to create air units and AA towers.

That would be great. I’m also doing some R&D on adding AA towers in the second update. It would be great to see if I can make some improvements to the model that I have in mind.

I went about it in a fairly simple way… I moved the range sphere up several thousand units, and did the same with the spawns that air units used. This wouldn’t work in every game mode though, so it wouldn’t be an ideal solution for you.

You could add an enum for unit types such as air/ground/sea/etc. and use that as criteria for what towers can target.