Wednesday, July 20, 2016

Top Down Stealth Toolkit Tutorial: How to Migrate the Patrol Bots to a new Third Person/First Person project

[The following information is based on the v1.4 of the Top Down Stealth Toolkit & hence may not remain entirely relevant in later versions. For more information about the toolkit, check out the official support thread in the Unreal Engine forums:]

This tutorial goes over the steps involved in migrating the patrol bot AI from the toolkit onto a new Third Person/First Person template.

Since some of the AI classes contain references to the default toolkit game mode, player character, HUD class, etc we need to first remove those references before migration in order to avoid having those linked classes migrated to the new project unnecessarily. They can be replaced with your own custom classes in the new project after the migration.

Apart from that, the vision arcs used by the AI in the toolkit becomes completely useless when you're using the AI in a third person or first person stealth game. As a result, I'll be deleting the functionality associated with it as well before migrating the AI blueprints.

Keeping both these factors in mind, the screenshots posted below goes through the different AI blueprints to depict the changes that need to be made in order to aid in the migration process.


BTT_CallEndGameLogic: Event Graph

BPC_AutomatedLaserTracker: Function 'Processing Lock On Request'

BPC_AutomatedLaserTracker: Function 'UpdateLaserTracker'

BP_PatrolAI_Parent: EventGraph

BPC_DistressSignalBroadcaster: Function 'BroadcastDistressSignal'

BPC_DistressSignalBroadcaster: Function 'CancelDistressResponse'

BTS_VisionCheck: Event Graph

Now that all the necessary changes are made, the only thing left is to right click on the 'PatrolAI' folder & select Migrate Asset into the Content folder of your new custom project. Unreal Engine will automatically transfer other associated files such as the animations, materials & textures, etc. Since we have made sure that references to the Toolkit Game Mode & Player Character are removed, they will not get transferred into your new project, thus leaving you with the option of using your own custom classes for the same.

Once the content is migrated into the new project, just head over to the Patrol AI Parent class & then remove the variable 'MID_VisionArc' & delete all instances of it within the class. Without the Vision Arc, we no longer need the dynamic material instance to update it's color at runtime. Apart from that just make sure that you've added a Nav Mesh Bounds volume so that the bots can move around. Now just drop the Melee/Ranged Patrol Bot into the level & you should be good to go.

If you have any other queries regarding the migration process, feel free to let me know in the comments & I'll get back to you on that.

Tuesday, July 12, 2016

Tower Defense Starter Kit v1.4 Dev Log #2: Tower Abilities

When I started working on the Tower Defense Starter Kit, one of the games that inspired me was Anomaly Defenders by 11 Bit Studios. Even though the game was generally not received as well as the Anomaly Warzone series, it did have one good feature that we don't always see in Tower Defense games: Tower Abilites. 

In Anomaly Defenders, the towers are equipped with Tower Functions, which basically improves the effectiveness of the tower for a short duration. The Tower Functions are activated gradually as the player progresses through the campaign & can be improved further using the skill points received at the end of each level. Some examples of the Tower Functions include an EMP Blast that reduces the shield of nearby creeps, a Rage mode that greatly increases the damage of the tower, etc. 

While the campaign missions in Anomaly Defenders are all based on a limited number of waves, I feel that Tower Abilities would make an excellent addition to Tower Defense games that feature endless wave modes. It could ensure that the players will have some amount of micro management left even after they have placed all their towers in the level. And since the Tower Defense Starter Kit supports endless wave modes, it seemed like a good idea to add Tower Abilities to it. 

Over the past couple of updates, I had been restructuring certain parts of the code to smooth out the transition to this new feature. So I'm finally happy to announce that the upcoming v1.4 update will feature two new Tower Abilities: Overdrive & Repair.

Overdrive: The Overdrive ability amplifies the tower's output per cycle for a set duration. This ability will be available out of the box for all towers. As a result, a Laser Tower on Overdrive would have increased damage, while a Mining Tower would have improved resource mining rate.

Repair: The Repair ability regenerates the tower's armor over set period of time. This ability will be available out of the box for all towers as well.

Listed below are a couple of WIP screenshots that display the updated Tower Functions menu & the new status effect icon:

Tower Functions Menu updated with the new abilities

New Status Effect Icon added to display active ability & it's remaining duration

[Note: More abilities will be introduced through future updates & I think it's safe to assume that atleast some of these abilities would be tailored towards certain type of towers, thus rendering them useless in the context of other towers. As a result, I'm using Composition instead of an Inheritance based approach to prevent unnecessary bloating of the Tower blueprints.]

For more details about the Tower Defense Starter Kit, check out the official Unreal Engine forum support thread at:]

Thursday, July 7, 2016

Tower Defense Starter Kit v1.4 Dev Log #1: Getter Function Library

While working on the latest update for FPS Tower Defense Toolkit, I came across the thought of using a Blueprint Function Library to retrieve references to commonly accessed resources within the toolkit. A few examples of these include retrieving the Tower Data Array which holds the default stats for all towers in the game, or getting a reference to the Wave Manager actor which pretty much handles all aspects of the toolkit related to wave generation & creep spawns.

The basic idea behind this move was to make it just as easy to retrieve these elements as it was to use a 'Get Player Controller' or 'Get Game Mode' functions from anywhere in your blueprints. So instead of forming huge chains of nodes to access a variable/call a function from another class, this function library would enable developers to just use it's getter functions to meet their needs, thus reducing unnecessary clutter in their blueprints. The functions themselves would handle the code for accessing the necessary data. 

Due to the conveniences provided by this approach, I've added a similar system for the Tower Defense Starter Kit as depicted in the screenshots below. This feature will be available in the upcoming update to the toolkit.

Getter Function Library

Calling a Getter Function

[For more details about the Tower Defense Starter Kit, check out the official Unreal Engine forum support thread at:]

Friday, July 1, 2016

Top Down Stealth Toolkit v4.10 Basics: Skills & Gadgets

[The following information is based on the v4.10 of the Top Down Stealth Toolkit & hence may not remain entirely relevant in later versions. For information regarding the implementation of Skills & Gadgets in the latest version of the toolkit, check out this post in the official support thread in the Unreal Engine forums]

The player character in the Top Down Stealth Toolkit is equipped with skills & gadgets to deal with the AI guards. By default, the player can select one skill & one gadget from the 'BP_PlayerCharacter' blueprint before playing a level. The variables 'ActiveSkill' & 'ActiveGadget' can be used to select the active skill/gadget. The default input buttons for the same are 'Q' & 'F' respectively.

Skills: Skills are abilities that can be used unlimited number of times.

1. Whistle: The Whistle skill can be used to distract guards within a certain radius of the player to the whistle origin location. The affected distance depends on the 'Loudness' variable of the noise within the 'MakeFootstep/WhistleNoise' function. The formula for the noise to AI Perception distance is mentioned within the function. 

Gadgets: Gadgets are abilities that can be used only a limited number of times. The number of gadget activations remaining is displayed through the UI element for the same. Gadgets also have a cooldown interval during which it cannot be used. The default number of activations can be specified using the 'NumberOfGadgetActivationsLeft' variable in the 'BP_TDST_GameMode'.

1. Camera Jammer: The Camera Jammer gadget can be used to deactivate all camera bots within a certain range of the player, for a limited period of time. The jammer range can be specified through the 'CameraJammerRange' variable.

2. Proximity Shockmine: The Proximity Shockmine is a deployable actor that deactivates the first patrol bot to pass through it, for a limited period of time. The functional logic for the same can be found within the 'BP_ProximityShockmine' blueprint.

3. Stun Gun: The Stun Gun can be used to permanently deactivate the targeted patrol bot, until it is detected by other patrol bots. Unlike the other gadgets, the stun gun requires manual targeting using the mouse cursor. Splines are used to provide visual aim assists from the player towards the target. The functions 'Activate/DeactivateStunGun' & 'UpdateAimSplineLocation' contain the functional logic for this gadget.