FPS Tower Defense Toolkit

Hey Magneto, I’ve been going over some ideas about how to include interactive 3D widgets as part of the HUD. After trying out some of the solutions, I believe that the best way to add this feature without making a mess of both 2D & 3D HUD logic coexisting with each other would be to use both types for different scenarios. For example, I decided to keep the static in-game HUD & the tower selection menu at level start as 2D HUD elements, while converting the in-game interactive elements like Tower Upgrade/Sell Menu into a 3D widget [There are plans to add some weapon selection options in the future as well, & that could also use 3D widgets]. This way, I can demonstrate the working behind both methods of interaction without making everything too generalized & complicated to understand.

However I’m not confirming this as there is an in-engine bug in v4.10 that causes problems while interacting with 3D widgets. If it get’s fixed in v4.11 & it seems to be fixed in the preview version, I will try looking into the 3D widgets in the coming updates. So it would be better if you wait for the v4.11 update, which will be submitted as soon as the engine hit v4.11 stable release.

Work on the next update is finally over. I’m waiting for v4.11 Engine release for further testing. Meanwhile here is a preview video for the new Tower Selection Menu:

Using the Loadout menu, the user can specify the maximum number of tower types that the players have at their disposal for a particular level, while the Tower Selection menu enables players to add towers to the Loadout menu. The Tower Selection menu also provides description for all available towers. The In-Game HUD logic has also been updated to reflect the towers selected by the player in the Loadout menu. The tower buttons are now displayed dynamically based on the player selection & hence do not need to be modified manually using the UMG editor.

Looking good! Don’t worry too much about making 3D menus work if you’ve got more important updates to do.

FPS Tower Defense Toolkit Basics: Enemy Spawn Points

While the Wave Manager does the majority of the work related to spawning enemy units, it is the Enemy Spawn Point class in FPS Tower Defense Toolkit that creates the spawn points for the creeps. The toolkit supports placement of multiple enemy spawn points in a level thus creating multiple avenues of approach toward the Power Core. This class is also responsible for displaying information about the upcoming waves so that players can change the maze layout & tower placements to best counter them. To further aid in this regard, the spawn points dynamically update the spline based nav path display towards the Core based on the placement of tower bases in the level.

With customization in mind, this class is also equipped with Spawning Volumes that can spawn creeps anywhere in the specified region apart from the default functionality of spawning at the exact actor location. To save runtime operational costs, users can also choose the option to enable usage of cached spawn transforms, thus creating a specified number of random spawn points within the spawning volume at level start. The public variables ‘UseCachedSpawnTransforms’ & ‘NumberOfCachedSpawnTransforms’ control this aspect of the Enemy Spawn Points.

e534cc07f453e61931f5e323acf3bd0e0dd6b604.jpeg

The upcoming update v1.6 will add a new variable ‘SpawningVolumeRadius’ [as shown in screenshot above] to directly control the spawning volume dimensions of each Enemy Spawn Point placed in the level.

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

The v1.6 update will be submitted to the marketplace on this coming monday. Meanwhile I’ve added a few new improvements related to how the Tower Upgrades work. While most of them are based on improving the workflow under the hood, the tower stats menu is also getting a new sweet visual upgrade. :slight_smile: Instead of the v1.5 menu which just shows the existing stats & upgrade cost, the new stats menu will show upgraded stats alongside existing stats.

Preview Video:

Submitted the v1.6 update files to the marketplace. This is a v4.11 exclusive update as it brings about a lot of changes to the toolkit, both in terms of features as well as the workflow. So if anyone wants to get the v1.5 project files in the future, it will not be replaced as the v4.10 project files will remain intact.

Update VI (v1.6) [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.5 implementation, the update has been released only for Unreal Engine v4.11. This ensures that anyone who wants to keep using the v1.5 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 Tower Data Array. [Preview video: https://www.youtube.com/watch?v=uqLN_pxcR5k]

  • The new Tower Data Array can be used to set the list of available towers for each level as well as basic tower initialization attributes like Tower Cost, Tower Class, etc. This essentially removes the need to keep separate variables & checks for each tower & paves the way for a much more dynamic workflow when other parts like the HUD system are interacting with the Tower Data.

  • Blueprint interfaces added to handle resource points management during tower setup/destroy events & grid data retrieval for trace hit actors.

  • 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 tower stats display in order to prevent clipping of text between widgets.

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

  • Tower upgrades now improve the rate of fire & tower range/resource cap alongside the normal output increase. The improved tower upgrade menu showcases both current stats as well as upgraded stats.

  • 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.

  • The Holographic tower spawn logic has been moved from the Tower Spawn Manager to their respective classes, thus reducing the need for unnecessary checks & improving the code modularity.

  • 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.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 as well as functions added to existing blueprints are also marked in the event graph as shown below [Moved to attachment view]:


Changes in the Content Browser:

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

  • New interfaces: BPI_GridLink, BPI_GenericHUDUpdates & BPI_TowerFunctions.

  • ‘Struct_GridGeneratorData’ renamed to ‘Struct_GridCellData’.

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

  • ‘BP_TowerSpawnHandler’ & ‘BP_WaveHandler’ renamed to ‘BP_TowerSpawnManager’ & ‘BP_WaveManager’ respectively.

  • New struct: Struct_TowerData.

  • New default HUD class added: BP_FPSTDHUD.

  • New widgets: Widget_LoadoutMenu, Widget_TowerButton, Widget_TowerListBox & Widget_TowerSelectionMenu.

  • Navmesh runtime generation changed from dynamic to dynamic modifiers only.

  • BP_PlanarGridGenerator moved to GameplayActors folder.

  • Removed ‘BP_FloorGridGenerator’ & ‘BP_WallGridGenerator’ blueprints.

How Do i deleted the first person controller and only allow the camera angel to be Third Person?

The toolkit already has the support to switch between first and third person [only running & jumping animations included] views. The associated logic lies within the BP_FPSTDCharacter blueprint as shown in the screenshot below:

If you only want the third person view, you can do the following steps [within the BP_FPSTDTCharacter blueprint]:

  1. First remove that ‘SwitchCamera’ logic marked with the red box in the screenshot. You won’t need that if you’re only using third person view.

  2. Then remove the ‘Mesh1P’ skeletal mesh component & any references to it within the character blueprint.

  3. Replace every instance of ‘1PCamera’ camera component with ‘3PCamera’ camera component & then delete ‘1PCamera’. Tick the ‘Auto Activate’ property of ‘3PCamera’.

  1. Now select the ‘Mesh’ component, & untick the attribute ‘Hidden in Game’ as shown below:

  1. With that, you should be able to get the third person view working. Apart from that, there is only some code clean up to do. So just search for the variable ‘FPSMode?’ and disconnect the part that’s only connected to it’s True execution pin.

Just bought it due to not only because the kit seems brilliant, but you seem to give it fantastic support, and I love seeing that. I’m looking forward to digging into this, it looks great already!

Edit: Hey, I’ve been playing around with it and realised that I can’t walk through the “range display sphere”. My player collides with it as if there’s a wall there. Any idea what could be causing this? I’m testing with the same character it came with, although I did migrate the files to my personal project. Thanks!

Hi @itsalwayssummer Thanks for expressing your interest in the product. I do not have access to my computer till the 1st of June, but could you try checking out the range display sphere collision details for the actor that’s causing the problem. Could you check if it’s set to block the player?

I’ve checked and it seems like it should work fine. Here’s how it looks.

Alright, perhaps the object channels do not get transferred when you migrate it. Because I remember adding some new channels for the tower/range spheres. You could check the collision options under the project settings for the default toolkit project and add the same object channels into your new project. Then maybe do a double check in the different tower classes to see that it’s not blocking the player. I believe that should fix the issue.

Ah, that was it! It works now, thank you!

The v1.7 update has been submitted to the marketplace. This update will add support for v4.12 of the Unreal Engine. Alongside this update, both the v4.10 & v4.11 project files are getting minor updates focused on bug fixes.

Update 7 (v1.7) has gone live on the Unreal Engine Marketplace. This update adds support for v4.12. Listed below are the main code changes introduced in this update:

  1. Added a new function library BPFL_GetterFunctions to easily retrieve references to all the core gameplay actors. As a result, getting a reference to the Tower Manager or the Tower Data Array is now as easy as getting the player controller or the game mode.

Preview Screenshot:

  1. Gameplay states such as Tower Build Mode, Combat Mode, etc have been separated from HUD State which now purely deals with high level HUD updates [transitions between loadout menu, in game HUD, mission summary, etc]. Furthermore all changes to the Gameplay state are now handled directly through the BP_GameState class while changes to the HUD State are handled through the BP_GameInstance & BP_PlayerHUD classes.

Preview Screenshots:

  1. The BP_PlayerController class now manages all low level HUD requests [updating independent UI elements like player health, ammo, tower points, etc within the In Game HUD] thus acting as a single conduit through which all updates pass through.

Preview Screenshot:

  1. Added a new Grid Manager class to handle default grid properties & updates to the Grid Data Array.

  2. The BP_GameMode now handles initialization of all core gameplay actors from a single central location using a well designed workflow instead of the actors having to rely on Begin Play events or initializing each other. This ensures improved code clarity from the get go as shown in the screenshot below:

  1. The Tower Build HUD, Tower Upgrade HUD & Combat HUD have been combined into a single unified In Game HUD, while increasing the modularity of their individual UI elements. The design of the HUD has also been modified to reflect the changes.

Preview Screenshot:

  1. Updates to the number of Tower Bases & the amount of Tower Points are now handled through the BP_PlayerState class.

  2. The Tower Data Array has been moved from the Tower Manager class to the BP_GameInstance class. This ensures that implementing tower unlocks & any other sort of modifications to the Tower Data will be as easy as editing this single instance of the Tower Data Array without having to worry about the instances of the Tower Managers within every single level.

  3. Getter & Setter functions implemented throughout all classes to ensure that accessing/editing variables are always handled in a structured manner.

  4. The Wave Manager now uses a single Wave Data Array for all 3 types of wave generators, instead of relying on 3 separate arrays formed out of three different types of structs. Based on the wave generator requirements for the projects, the user can remove the unnecessary struct members from the Struct_CreepSpawnData. [FPS Tower Defense Toolkit Basics section updated with the new changes to the Wave Manager at: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit&p=349206&viewfull=1#post349206]

  5. Fixed a bug that caused towers to stop functioning occasionally when it loses sight of the active target.

  6. Other changes include improvements in code structure & modularity across most blueprints in the toolkit.

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

  • New Blueprints: BP_GameInstance & BP_GridManager.

  • New Blueprint Function Library: BPFL_GetterFunctions.

  • Removed certain elements from the Enum EGameplayState.

  • New Enum: EHUDState.

  • BP_FPSTDCharacter, BP_FPSTDController, BP_FPSTDGameMode & BP_FPSTDHUD renamed to BP_PlayerCharacter, BP_PlayerController, BP_GameMode & BP_PlayerHUD respectively.

  • BP_FPSTDGameState & BP_FPSTDPlayerState renamed to BP_GameState & BP_PlayerState respectively.

  • BP_TowerSpawnManager renamed to BP_TowerManager.

  • New Structs: Struct_CreepSpawnCounter, Struct_CreepSpawnData & Struct_WaveData.

  • Deleted Struct_GroupBasedWaves, Struct_ThreatBasedWaves & Struct_UnitBasedWaves.

  • New Widgets: Widget_HealthBar & Widget_TowerUpgradeData.

  • Widget_TowerBuildHUD, WidgetBP_EnemyTypeData & WidgetBP_GameOverHUD renamed to Widget_InGameHUD, Widget_Stats & Widget_MissionSummaryHUD respectively.

  • Deleted Widget_CombatHUD.

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

  1. Implemented a new & improved component based Threat Detection system for the Creep AI. The four new components - Visual Perception, Damage Perception, Threat Analyzer, & Threat Response together form a modular system that enables creation of new AI as well as extending features of existing AI with ease. Here is a brief overview of the components:

Visual Perception component: This component uses a combination of distance, angular, & line trace based checks to provide the parent class with information about it’s spatial relation to all potential targets.

Damage Perception component: This component keeps track of incoming damage from all potential targets & relays the information back to the owning actor. It is also responsible for controlling the relevance of damage inflicted over a long period of time. This allows the owner to focus on the immediate threat instead of focusing on an actor that may have inflicted some damage 30 seconds ago.

Threat Analyzer component: While the previous two components focus on gathering data, this component focuses on retrieving the aforementioned data & evaluation of potential targets based on it. It also allows the designer to specify the relative importance of visual perception weightage vs the damage perception weightage for the parent actor. For example, if you want a creep that generates more aggression toward damage causing agents than closer targets, it’s as simple as improving the maximum weightage of the damage perception while reducing the same for visual perception within this component. The component also makes sure that the active target gets special preference over other targets to prevent the parent actor from rapidly shifting focus between targets based on weightage changes. The evaluated results are passed on to the parent actor through it’s associated interface functions.

Threat Response component: This component comes into play once the parent actor has acquired an active target. It determines whether to move to/attack the active target based on the distance to it. The final decision is then relayed back to the parent actor for execution. For example, an attack order to melee parent actor would be executed in a different manner when compared to the execution by a ranged parent actor.

The components act independently & are not aware of the existence of other components. They are only aware of their own existence as well as that of the owning actor. Any information that is being relayed between these components happen through the parent class & interface functions. This facilitates creation of new creep types with different combination of components [along with their associated interfaces]. For example, both the melee & ranged creep classes will now be equipped with all 4 components by default, while the corebomber class will only use visual perception component in conjunction with some custom logic in the parent class tailored to it’s requirements. Similarly if you do not want a certain type of creep to not respond to damage causing agents, just add all components & interfaces excluding the ones related to damage perception.

  1. All static Tower parameters are now retrieved dynamically from the Tower Data Array, thus reducing the number of variables that need to be stored in each tower actor. Only parameters that can be changed at runtime, such as DPS, Range, etc are stored within the tower actors.

  2. The Selected Tower Data Array which served the purpose of storing all data pertaining to the list of towers available to the player, has been replaced with an integer based array which only stores the Tower Class indices of the selected towers. This ensures that data is not copied around unnecessarily & ensures that accessing information related to the Towers happen solely through the Tower Data Array, provided that entity that requires the said data can provide the Tower Class index.

  3. The Grid Snapping system which enabled placement of towers in the Unreal Level Editor, has been simplified.

  4. Removed unnecessary collision responses for all actors in the toolkit.

  5. The Power Core now calculates a set of perimeter locations, which are used by the creep actors for navigation purposes, thus acting as a middle ground between the previous implementations which either relied on usage of completely random locations or the creeps grouping together in one region. The number of locations to be calculated can be adjusted easily through the editor using a globally exposed variable.

  6. Added a new Creep AI Manager class that keeps track of all potential targets for the creeps, thus freeing them to only focus directly on the targets. It gets alerted everytime a potential target has been spawned or destroyed anywhere in the map. The Creep AI Manager then relays this information to all relevant creep actors in the level, so that their target weightage information always remain up to date.

  7. Fixed a bug that prevented the towers from returning the tower resources when it’s associated tower base is sold.

  8. Fixed a bug that caused the wave generator to stop functioning due to event access conflict when multiple groups of the same creep class are spawned from multiple enemy spawn points in the same time frame.

  9. Introduced a new Focus Fire system that enables the player to request all relevant towers to focus fire on a designated target. This system is driven by a component based approach, thus facilitating easy integration into any new towers that maybe added in the future.

The Focus Fire component has been added to the Laser Tower, Machine Gun Tower & the Sniper Tower by default as these are the three towers capable of focusing on a single target. Along with the associated Manual Target Override interface, this component serves the purpose of overriding any active target & focusing on a new target specified by the player, provided the target is within range.

With this new system, the player will be able to play a more tactical role during the combat phase of the game.

All changes within the blueprints are marked with the boolean variable ‘Version1.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 as well as functions added to existing blueprints are also marked in the event graph.

The v1.8.1 update has gone live on the Marketplace. This update adds support for v4.13 of the Unreal Engine & introduces the following minor changes to the product:

  • Reduced the number of nav path validation queries required while using the holographic tower bases, thus providing a small performance boost under the said situation.
  • Fixed a bug that caused newly spawned holographic towers to flicker once between it’s default spawn location & the player’s focused location.
  • Fixed a bug that caused the holographic tower base actors to leave small artifacts in the nav mesh when the player focuses on a location outside the grid generators.

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

  1. This update introduces a new Mission Stats system that provides the player with the following information at the end of a level: Damage inflicted by the player/towers & Kills scored by player/towers.

The stats are collected through the ‘Game Stats Updater’ component which then sorts through the information & relays it over to the Game State. This information is later retrieved while displaying the mission summary screen as shown below:

  1. A basic Main Menu system has been added to the toolkit.

Gameplay demo of the v1.9 FPS Tower Defense Toolkit (Windows): https://www.dropbox.com/s/sryobzdcejf9ohw/FPS%20Tower%20Defense%20Toolkit%20Sample%20Game%20Demo.7z?dl=0

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

  • Added new actor component: BPC_GameStatsUpdater

  • Added new widget: Widget_MainMenu

  • New item added to enum ‘EHUDState’.