FPS Tower Defense Toolkit v1.8 Dev Log #1: Improved AI systems

The creep AI logic in FPS Tower Defense Toolkit is primarily driven by a set of timed distance, angular, & trace based checks. It provides the designer with complete control over editing the visual range parameters as well as the underlying workflow. However driven by an inheritance based approach, the system had issues with code modularity. For example, the Core Bomber class had no threat detection capability unlike the the Melee & Ranged classes, thus leading to either code redundancy or the requirement for more vertical layers of inheritance. As a result, adding more creep classes in the future might require a lot of unnecessary work. Fixing this potential issue is the main focus of the v1.8 update for FPS Tower Defense Toolkit.

The new & improved AI design in the upcoming update is primarily driven by a move to component based design that allows the creep classes to have different levels of threat detection capabilities. The four components that make up the new threat detection system are:

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

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

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

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

Even though I've mentioned that some of these components take in data obtained from other components to perform their functions, it does not mean that they are interdependent. The components 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.

The update also adds 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.

With this new system, creation & maintenance of creep AI should be a much more convenient process than it is right now. Plus the introduction of a weightage system paves way for inclusion of companion bots in the future updates. There are a few more notable changes making it into the v1.8 update. More details will be made available soon.


For more details about the toolkit, check out the official Unreal Engine forum support thread at: https://forums.unrealengine.com/showthread.php?79300-FPS-Tower-Defense-Toolkit