FPS Tower Defense Toolkit

**FPS Tower Defense Toolkit Tutorial: How to use Towers without Tower Bases [v1.9 edition; For the latest version, check out: **FPS Tower Defense Toolkit Tutorial: How to use Towers without Tower Bases]

The FPS Tower Defense Toolkit lets players construct mazes using Tower Bases to control the paths of AI bots. The same Tower Bases also act as platforms for placement of Towers, which help prevent the AI bots from reaching the Power Core. However since most Tower Defense games allow players to directly place towers on the ground instead of a separate platform like Tower Bases, I’ve received a few queries about how to implement the aforementioned design with this toolkit. This tutorial goes over the modifications required for achieving the same.

BP_TowerManager:

  1. Set the variable ‘TowerZOffset’ to 0.0. This variable determines the offset of the towers along the z axis relative to the ground location. The offset ensured that towers were spawned physically on top of the Tower Bases. Since we’re not going to use Tower Bases in this particular scenario, a value of 0.0 ensures that the towers are spawned directly on top of the ground.

  2. Now head over to the ‘Destroy Tower’ function & replace the value of ‘Grid Status’ input parameter for the ‘Update Grid Data Array’ function call from ‘Tower Base’ to ‘Empty’ [check screenshot below]. Having it set to Tower Base ensured that when a Tower is destroyed, the grid status would revert back to the Tower Base on which it was placed. In our case, we can directly set it to Empty as we’re not dealing with Tower Bases.

  1. Remove the function call ‘Add Tower Base Entry to Selected Tower Data Array’ within the ‘Create Selected Tower Data Array’ function & connect the nodes as shown in the screenshot below:

BP_AttackTowerActual_Parent:

  1. Within the Construction Script, add the segment marked with red border in the next screenshot [check below]. This code ensures that the nav paths are rebuilt every time a tower is placed in the level. Since towers used to be placed on tower bases, we only had to do this when tower bases were spawned. And now since towers are going to be placed directly on the ground, we’re calling the same functionality here as well.

  1. In the Event Graph, add a new ‘Event End Play’ node & add the segment marked with red border in the screenshot below. This performs the same function as last step, the difference being that we’re requesting the nav mesh to rebuild itself everytime a tower is destroyed.

  1. Now add a ‘Box collision’ component to this class. This will act as the nav modifier volume that can block enemy AI paths, thus forcing them along alternate paths. Update the parameters of this component from it’s details panel to match the information specified in the following screenshot.

BP_TowerBaseHolo:

  1. Now go to the folder ‘Holographic Towers’. You should see separate holographic tower classes for Tower Base & Towers. All holographic towers currently inherited from the ‘BP_AttackTowerHolo_Parent’ blueprint.

Now the easiest way to modify the Holographic Towers based on our requirements would be to have them inherit from the ‘BP_TowerBaseHolo’ class. We choose to do this because this class already checks if the tower/towerbase can be placed on the focused grid cell based on the availability of paths from the enemy spawn points to the power core. And with towers being placed at the ground level, this has become a requirement for us.

However, we still need to make a couple of minor changes within the blueprint. Go to ‘Evaluate Tower Resource Requirements’ & replace it’s logic with the nodes shown in the screenshot below. Basically we’re replacing the check for availability of tower bases with a check for availability of tower points.

[Note: You can copy paste these nodes from the same function implementation in ‘BP_AttackTowerHolo_Parent’ blueprint.]

  1. Within the ‘Create New Actor Transform’ function, replace the ‘TowerBaseZOffset’ with ‘TowerZOffset’ as shown in the screenshot below:

BP_GameInstance:

  1. The ‘Tower Data Array’ variable contains user specified information about all the Towers. If you expand it’s elements, you would notice that the first element is a Tower Base entry. Delete this element first.

  2. Now expand the array element associated with the Laser Tower & set it’s ‘TowerHoloClass’ parameter as the new holographic laser tower we created a while ago [check next screenshot]. Similarly change the same parameter for every other tower element within the array.

Alright, so now you should be able to use Towers without the need for Tower Bases in your projects. Just make sure to remove references to the Tower Bases & associated enums/blueprints if they’re not required. And finally here’s a sample screenshot with the final result:

Update 10 (v2.0) has gone live on the Unreal Engine Marketplace. This is a v4.14 exclusive update & listed below are the main changes introduced in this update:

  1. Added a new component to handle the ‘Lock-on System’ for Towers. The core functionality of the towers remain the same, but moving the aforementioned feature out of the tower using a modular component based approach should significantly improve the workflow involved in adding new custom Towers.

As of this update, towers like the Laser Tower, Machine Gun Tower, & the Sniper Tower, that focus on a single target are equipped with the new Turret Lock-on system.

  1. Added a new component to handle the Tower Stats display when the player focuses the cursor on a tower. As a result, the tower blueprints themselves do not have to contain the logic required to handle HUD updates. All that’s required of them is to have the ‘Tower Stats Display’ component, implement the necessary interface & provide the information requested by the component through interface functions.

  2. Added a new blueprint function library to act as a container for custom math functions that are required across multiple blueprints.

All changes within the blueprints are marked with the boolean variable ‘Version2.0’ 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:


Changes in the Content Browser:

  1. Added new actor components: BPC_TowerStatsDisplay & BPC_TurretLockOnSystem.

  2. Added new interfaces: BPI_DynamicPostProcessSettings, BPI_TowerStatsDisplay, & BPI_LockOnSystem.

  3. Added new blueprint function library: BPFL_MathFunctions.

Update 11 (v2.1) has gone live on the Unreal Engine Marketplace. This is a v4.15 exclusive update & listed below are the main changes introduced in this update:

  1. The Holographic Tower Display implementation has received a complete design revamp focused on a more data driven approach, while removing the multiple layers of inheritance based class system present in the previous versions. The Tower Holograms are now split into two categories: Holographic Tower Constructor Hologram & Holographic Tower Highlighter.

The Holographic Tower Constructor displays a Hologram of the tower model that has been designated by the player for construction. The physical attributes of this Hologram including the mesh types, their world coordinates, etc are set dynamically using a data driven approach that relies on the information specified by the designer in the new ‘Holo Tower Constructor Data array’. The Hologram itself will be displayed as long as the selected tower model can be created at the focused location. However, based on the construction pre-requisites like availability of tower resources & valid navigational paths, the hologram may change it’s color to reflect the feasibility of constructing a tower of the selected variety under the given conditions.

The Holographic Tower Highlighter, on the other hand, displays a Hologram based on the focused actor. As long as the focused actor meets the requirements (in this case, being a tower class entity), the Hologram will dynamically alter itself to match the physical properties of the aforementioned actor. This highlighter uses a different color coding system to make it visually stand out from the constructor hologram, as there can be scenarios which require display of both types of holograms.

Apart from these modifications, a Grid Cell Indicator has also been added as a visual cue to identify the grid cell (if any) associated with the focused actor. This ensures that player always receive a minimal amount of feedback based on their interaction with the grid systems, even when Holograms are not displayed due to the particular grid location not meeting the pre-requisites for construction of the selected Tower class.

  1. The Tower Stats Display system has also received some modifications as well as new additional new features that improve upon it’s previous iterations.

In conjunction with the display of Holographic Tower Constructors, the Tower Stats Display will now present the Setup Cost information for the selected Tower model.

The previous Tower Upgrade Stats system has been extensively modified to facilitate display of information about the Current Stats, Upgraded Stats, as well as Recycle Stats for the focused Tower, using a new dynamic design model that requires minimal amount of hand crafted HUD changes.

  1. The Holographic Tower Display system is now driven through a component based approach in order to increase it’s modularity & thus facilitate easy implementation with new custom player character classes.

  2. Fixed a bug that allowed placement of towers even when navigational paths was blocked, as long as the player were to initiate tower placement before the nav mesh updates finished processing.

Free gameplay demo for the v2.1 FPS Tower Defense Toolkit (Windows) can be downloaded from: https://www.dropbox.com/s/a4myd6m1ocqkojc/FPS%20Tower%20Defense%20Toolkit%20Sample%20Game%20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version2.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.


Changes in the Content Browser:

  1. Added new actor component: BPC_HolographicTowerDisplay.

  2. Added new enum: EFocusedActorType.

  3. Added new interface: BPI_HolographicTowerDisplay.

  4. Added new blueprint: BP_TowerHologram.

  5. Removed the blueprint BP_TowerHolo_Parent & all it’s child classes.

  6. Added new structs: Struct_HoloConstructorData & Struct_UnitStat.

  7. Added new member SetupCost_TowerBases & renamed TowerCost to SetupCost_TowerPoints in Struct_TowerData.

  8. Added new widgets: Widget_BinaryStatModule & Widget_TowerConstructor.

  9. Renamed widgets Widget_Stats & Widget_TowerUpgradeData to Widget_UnaryStatModule & Widget_TowerStatsDisplay.


The v2.1.1 update has gone live on the Unreal Engine Marketplace, & introduces the following changes to the toolkit:

  1. Replaced the depth of field post processing effects for the Loadout, Tower Selection, & Mission Summary screen backgrounds with the new UMG background blur system introduced in the v4.15 Unreal Engine update.
  2. Moved the entire target acquisition logic into the Turret Lock-on system, thus making it more easier to integrate it with new custom towers.

[All changes within the blueprints are marked with the boolean variable ‘Version2.1.1’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes.]

FPS Tower Defense Toolkit Basics: Holographic Tower Constructor

Note: As of v3.13, this system has become legacy content since it’s been integrated into the DT_TowerData data table to facilitate customization for both real and holographic towers through the same parameters.]

The Holographic Tower Constructor represents the part of the Holographic Tower Display system that displays Holographic models of the tower designated by the player for construction. The Holograms are created & updated at run time through the ‘BPC_HolographicTowerDisplay’ component (attached to the player character) using information specified in the ‘Holo Constructor Data’ array, located within the Tower Manager. Listed below is a brief explanation of the different parameters that drive the Tower Constructor:

  • The ‘TowerType’ enum identifies the data associated with the tower model selected by the player for construction.
  • The ‘Tower’ parameter determines the base mesh (same as the mesh model for the actual tower) used to create the tower hologram.
  • The ‘LocationOffset_GridCellToTower’ controls the translational offset of the tower hologram relative to the location of the focused grid cell.
  • The ‘UsesGridCellOrientation?’ flag decides if the hologram will be partially or fully aligned with the grid generator. For example, the Trap holograms have this value set to true, since their spatial orientation completely match that of the underlying grid generators. The remaining towers (including the Tower Base) on the other hand, have this value set to false, since they only partially align (along the XY plane) with the grid generator.
  • The ‘HasTurretAttachment?’ flag determines if the tower has a turret attached to it.
  • The ‘TurretAttachment’ determines the mesh (same as the turret mesh model for the actual tower) for holographic display of the Turret (if any).
  • The ‘LocationOffset_TowerToTurretAttachment’ controls the translational offset of the turret mesh hologram relative to the tower mesh hologram.
  • The ‘RotationOffset_TowerToTurretAttachment’ controls the rotational offset of the turret mesh hologram relative to the tower mesh hologram.
  • The ‘DisplayTowerRange?’ flag determines if the constructor needs to display the effective range of the tower.
  • The ‘LocationOffset_TowerToTowerCenter’ stores the offset between the tower location & the central point of the tower mesh (specified based on the said offset in the actual tower class)
  • The ‘AffectsNavMesh?’ determines if the placement of the tower affects the navigation mesh. This flag is set to true for the Tower Bases since the AI bots will have to path around them. As a result, the holograms for Tower Bases keep updating their color to convey the availability of valid navigational paths based on the tower placement location.

The Hologram itself will be displayed as long as the selected tower model can be created at the focused location. However, based on the construction pre-requisites like availability of tower resources & valid navigational paths, the hologram may change it’s color to reflect the feasibility of constructing a tower of the selected variety under the given conditions.

Thanks for the toolkit; great job! I just picked it up today and it’s awesome. I am finally stumped, though. How would I go about adding a delay to the mission success screen? If it’s with a delay node, I can’t figure out where I would plug it since the mission success is always called in a function. Does anyone know how to accomplish this? It seems like such a simple thing to do… I guess while we’re at it, how would I do the same thing for the Tower Selection Menu? I think it could use a 1 or 2 second delay before activating. Thanks in advance!

Thanks for the feedback :). As you’ve already noticed, there is a dedicated function ‘DisplayMissionSummary’ that handles the necessary protocols before the actual Mission Summary HUD is displayed. You cannot call a delay from within a function, but you can do so if you create a custom event.

What you could do is create a Custom Event within the BP_PlayerController blueprint & move out the nodes upto ‘UpdateHUDState’ function call (from the original function) into this event. You can then add a delay & call the ‘DisplayMissionSummary’ function from here after it. Now all you have to do is to replace the all instances of the function call with the new event that you created. And just make sure that you set the same value for the boolean flag ‘MissionSuccess’ while calling the new event.

As for your second query, I’ll get back to you in a while.

Alright, the process for adding a delay to the Tower Selection Menu is very similar to the previous solution. So basically when you start a level, what happens is that the BP_GameMode class requests the HUD to display the Loadout menu. Since this is handled through a function in the Player HUD blueprint, you will have to add a delay before calling this function. But adding a delay creates the problem of letting the player send input to the player character which is probably not desirable. There are two ways to prevent this: either by spawning the player character manually after the delay or just pausing the game during the timespan of the delay. Since the toolkit spawns the player character automatically, I’ll show you the second approach.

Create a custom event within the BP_PlayerController class. Add a ‘Set Game Paused’ node followed by the delay & then use the pause node again to unpause the game. Now call the ‘DisplayLoadoutMenu’ function from the player HUD class. The last step would be call the new custom event from the Game Mode class as shown below:

Thank you for answering me so quickly! I had fiddled around with this for a while but I still can’t get it to perform the way I’d like. It actually doesn’t seem to do anything different even with the delay lol. Can you offer further support on this via e-mail??? I’m sure it’s just something simple I’m not doing correctly. Thanks!

Sure, you can always contact me through the support email: rohitmohan.k@outlook.com. Also, if you send me a screenshot of the above mentioned event graphs/functions, it should be easier to figure where to make the changes.

The v2.2 update is now available for download from the Unreal Engine Marketplace. This update adds support for using Object Pooling with Bullet Projectiles. For more details, refer the change log below.

v2.2 Change Log:

    1. Added the option to activate Object Pooling for Bullet Projectiles. The pooling system uses a free list (of array indices & not pointers) to chain together unused objects within a fixed size pool, & thus removes the need for iterations through the array.

To turn on the object pooling system, select the Object Pool Manager actor & set the ‘Pool Bullet Projectiles’ to true. The pool size itself can be modified through the ‘Pool Size_Bullet Projectile’ variable as shown below:

  1. Added a Projectile Manager class to act as a bridge between objects requesting for creation/deletion of projectiles, & the Object Pool Manager.

  2. Removed projectile lifespan restrictions & added Level Bounds Volumes to assist in the removal of projectiles.

All changes within the blueprints are marked with the boolean variable ‘Version2.2’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.3 update for FPS Tower Defense Toolkit has gone live on the Marketplace. The update primarily focuses on the introduction of a new dedicated weapon control system. For more details, refer the changelog below:

v2.3 Change Log:

  1. Added a weapon control system driven by component-based design. In its current iteration, the system facilitates the creation of ballistic hit-scan weapons by adding components that control the targeting/firing mechanisms. Using components to control individual functionalities will ensure that new types of projectile and hit-scan weapons can be added through future updates with little to no changes to the base weapon blueprint.

  2. Added Assault Rifle & Shotgun weapon classes based on the aforementioned systems.

  3. Added a weapon backpack component to store the weapons in player’s inventory. It also uses interfaces to act as a conduit for managing the equipment & selection of said weapons.

4, Modified the folder structure to make the assets more self-contained.

  1. Added world context object reference as an input parameter to functions within the blueprint function library, as part of v4.17 compatibility requirements.

  2. The wave spawn information display now projects the information onto the screen space (instead of world space), to improve readability at long distances & remove the blurring effect associated with the movement.

Free gameplay demo for the v2.3 FPS Tower Defense Toolkit (Windows) can now be downloaded from: https://www.dropbox.com/s/a3vcl1orat…20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version2.3’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.4 update for FPS Tower Defense Toolkit has gone live on the Marketplace. The update primarily focuses on the introduction of new types of weapons. For more details, refer the changelog below:

v2.4 Change Log:

  1. Extended the weapon control system introduced in the previous update, to enable the creation of weapons that can fire Penetrator Rounds. New dedicated components have been added to handle both target acquisition as well as fire control systems for the same, with additional support for features like Damage Falloff & Max Number of Penetrating Hits per Shot.

  2. Added Sniper Rifle & Railgun weapon classes using the aforementioned systems.

  3. Added a new component to handle bullet FX (both visual & aural) for ballistic hitscan weapons.

Free gameplay demo for the v2.4 edition of FPS Tower Defense Toolkit (Windows) can now be downloaded from: https://www.dropbox.com/s/bptszphtca…20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version_2_4’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.5 update for FPS Tower Defense Toolkit has gone live on the Marketplace & introduces new weapons to the player’s arsenal.

v2.5 Change Log:

  1. Added two new hit-scan energy beam weapons: Laser Rifle & Scatter Laser.

ScatterLaserOptimized.gif

Free gameplay demo for the v2.5 edition of FPS Tower Defense Toolkit (Windows) can now be downloaded from: https://www.dropbox.com/s/53taapz6b4…20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version_2_5’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.6 update for FPS Tower Defense Toolkit has gone live on the Marketplace.

v2.6 Change Log:

  1. Extended the weapon control system to support projectile based firing solutions. New sample weapon: Plasma Rifle.

PlasmaDDSopt.gif

  1. Added a floating text-based damage display system.

  2. Added event dispatchers to decouple logic associated with enemy spawn, damage reception, & deletion based events.

  3. Project updated to Unreal Engine v4.18.

**Free gameplay demo for the v2.6 edition of FPS Tower Defense Toolkit (Windows) can now be downloaded from: ** https://www.dropbox.com/s/u619b7webh…20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version2_6’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.7 update for FPS Tower Defense Toolkit has gone live on the Marketplace.

v2.7 Change Log:

  1. Added new projectile based weapon within automated target acquisition & homing capabilities: Seeker Rifle

SeekerRifleForum.gif

  1. Removed the Unit-based wave spawning system, as the Batched wave spawning system can achieve the same results in a far more user-friendly manner.

  2. Segregated the wave spawning system into two child classes: one to control batched wave spawns & the other to handle AI threat level based waves. [Note: The Threat based system will be getting an upgrade in the upcoming update to include weighted AI spawn management]

  3. Integrated the pre-wave resource allocation data into the wave spawn data structures.

Free gameplay demo for the v2.7 edition of FPS Tower Defense Toolkit (Windows) can now be downloaded from:****https://www.dropbox.com/s/d22r3gkm3q…20Demo.7z?dl=0

All changes within the blueprints are marked with the boolean variable ‘Version2_7’ [sample screenshot below] in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

The v2.8 update for FPS Tower Defense Toolkit has gone live on the Marketplace.

v2.8 Change Log:

  1. Added a new hit-scan beam weapon: Arc Rifle.

ezgif.com-optimize.gif

  1. Added variable damage for all weapons based on user-defined min/max range.

Free gameplay demo for the v2.8 edition of FPS Tower Defense Toolkit (Windows) can now be downloaded from:** https://www.dropbox.com/s/7rj9boc87n…20Demo.7z?dl=0**

All changes within the blueprints are marked with the boolean variable ‘Version2_8’ in order to easily identify the workflow changes introduced with this update. Comments are also written to describe the major changes. The new variables, functions, interfaces, & components added to existing blueprints are also marked within their event graphs.

any interest in modifying this to work in VR?

Hi Dansiff, there are no plans to add VR compatibility at the moment.

Hi, I just bought this pack and it seems perfect for my needs. I want to know if it is a way to make the game jump right into the game, without having to create a level and wait for the countdown?
Also, how do I switch weapons? Hope you have time to reply :slight_smile:

EDIT: Found out how to switch weapons. But Im having abit trouble on building towers, the tower wont place itself.
EDIT 2: I changed my mind about the countdown, but where do I find the blueprint for that? I need only 5 seconds to start my game.
EDIT 3: Found the countdowner :slight_smile:

Hi Frequia, you can jump directly into the sample map provided with the toolkit by playing from the editor. If the default map has for some reason been changed to the Main Menu map in your case, just make sure to open up the ‘Map_SampleLevel’ map from the Maps folder.

Glad to hear that you’ve figured out how to switch weapons & edit the countdown. As for the towers, they can only be placed on Grid Generators placed across the level. Each generator creates a user-specified number of grid cells (controlled by the GridCountX & GridCountY variables in the details panel) along its local X&Y axis as shown below:

By default, all grid cells turn invisible when the game starts, instead relying on holographic tower projections to guide the player. If you would like to display the grid cells in-game (similar to how it’s displayed in the editor above), just make sure to set the ‘DisplayGridCells?’ variable marked above to True for all Grid Generator actors in the level.

You should ideally be able to see the tower holograms displayed on the grid cell (blue vs red color based on whether a tower can be placed on the said grid cell) when you start the sample map. Just remember that towers require a Tower Base to be placed first. The Tower Bases are essentially a type of tower itself under the hood, but their sole purpose is to reroute enemy traffic and act as platforms for placement of towers. However, if you’re still having trouble with tower placement, just let me know. We’ll figure where the problem is.