Skip to content

Objectives & AI Template ProOnly¶

The Objectives & AI template is a content sample that shows how to build mission, achievement, and AI patrol systems using Logic Driver state machines. It includes a mission framework with sequential and parallel objectives, a kill-streak achievement tracker, and an AI patrol state machine with pursuit, engagement, and inter-agent communication.

This template is not meant to be production ready out of the box. It is designed as a starting point that you can adapt to your game's objective and AI systems.

Prerequisites

Familiarity with Custom Node Classes, State Machine References, and Conduits will help you get the most out of this template.

Installation¶

Install the template from the Logic Driver utility launcher under Content Samples. See Content Samples for details.

Once installed, the template creates two directories:

  • Template/ Reusable core files including mission and achievement node classes, a conduit utility node, base Blueprints, an achievement manager component, interfaces, and UI widgets. These do not depend on any shared plugin content.
  • Samples/ A complete first-person shooter example with AI enemies, mission objectives, achievements, and a playable map.

The Three Systems¶

The template is organized into three independent systems. Each can be adopted on its own.

  • Missions


    A hierarchical state machine structure where missions contain objectives, and objectives track progress toward completion. Supports sequential and parallel objective flows.

    Jump to Missions

  • Achievements


    A state machine that tracks timed kills and head shot streaks in parallel. An achievement manager component handles display priority and UI notifications.

    Jump to Achievements

  • AI Patrol


    A perception-based AI state machine with patrol routes, target pursuit, distance-based engagement, and inter-agent communication.

    Jump to AI Patrol

Mission System¶

The mission system uses a hierarchical state machine pattern. A top-level state machine contains mission nodes, each mission is a nested state machine containing objective states, and transitions check objective completion to advance the flow.

When a mission begins, it creates a quest widget showing the mission name and objective descriptions. As objectives are completed (by collecting items, eliminating enemies, and so on), transitions fire and the flow advances. When all objectives in a mission are done, the mission ends and the next one starts.

For missions with parallel branches (such as a collection task and an elimination task running at the same time), a conduit synchronization point waits for all branches to finish before the flow continues.

Base State Machine¶

FSM_MissionBase is the base state machine class for all mission state machines. It stores internal references to the owning mission level and tracked objectives. When creating a new mission state machine, set its parent class to FSM_MissionBase.

Node Classes¶

FSMN_MissionFSM¶

A nested state machine node representing a complete mission. Each mission node contains objective states inside it. When the mission begins, it sets up the quest widget and displays the mission description. The mission is considered complete when all objectives inside it reach their end states.

Property Description
Reward The reward value granted when this mission completes. Set on each mission node in the graph.
Description Text description of the mission, displayed in the quest widget. Configured in the class defaults.

FSMN_Objective¶

A state representing a single objective within a mission. It tracks progress as events come in (overlap events, kill events, etc.) and compares against the required count.

Property Description
Required Target Count How many targets must be reached to complete this objective. Set on each node in the graph.
Objective A text description of this objective. Set on each node in the graph.

FSMN_ObjectiveTransition¶

Transition between objectives. It checks whether the source objective has met its required target count before allowing the flow to advance. It also supports reacting to completion events from BP_MissionLevel.

This transition has no user-configurable properties. It reads requirements from the source objective automatically.

FSMN_MissionTransition¶

Transition between missions or mission phases. No user-configurable properties.

FSMN_MissionEnd¶

End state for a mission sequence. Place this as the final state inside a mission sub-state machine or at the end of the top-level mission flow.

FSMN_WaitForFSMs (Conduit)¶

A conduit that acts as a synchronization point. It waits for all connected state machine references to reach their end states before allowing the flow to continue. This is useful for missions with parallel objectives that must all complete before proceeding.

In the sample, this conduit sits between parallel mission branches and the final state, ensuring all missions finish before the quest completes.

Sample: FSM_Mission¶

The sample mission demonstrates a multi-mission quest with sequential and parallel objectives. It defines four variables in the class defaults:

Property Default Description
Reward 1 100 Reward for completing the first mission path.
Reward 2 100 Reward for completing the second mission path.
Mission 1 Count 4 Number of targets for the first elimination mission.
Mission 2 Count 5 Number of targets for the second elimination mission.

How the Sample Mission Works

The quest has two parallel branches that must both complete before it finishes:

  1. Collection Mission. The player collects objects (BP_ObjectiveBase) placed in the world. Each pickup increments the objective's progress. When the required count is reached, the objective transitions to its end state.
  2. Elimination Missions. The player eliminates AI enemies. When it finishes, it feeds into Elimination Mission 2, which has its own objective and end state.
  3. Wait. A FSMN_WaitForFSMs conduit that synchronizes both branches. The Collection Mission path and the Elimination Mission path must both reach their end states before the flow continues.
  4. Finished. The quest is complete, triggering the WBP_MissionCompleteWidget overlay.

The Collection Mission and Elimination Missions run in parallel, so the player can work on either at any time. Both branches converge at the Wait conduit.

Achievement System¶

The achievement system tracks player accomplishments using a parallel state machine. Two independent achievement tracks (quick kill streaks and cumulative headshot kills) run side by side within the same state machine. An achievement manager component runs the state machine and handles UI notifications.

The achievement state machine advances through tiers as requirements are met. For timed streaks, kills must happen within the configured time limit or the streak resets. Both tracks can be earned repeatedly.

Node Classes¶

FSMN_AchBase¶

Base achievement state class. All achievement states inherit from this. It provides a notification message and optional sound effect that play when the achievement triggers.

Property Description
Message The achievement message displayed to the player. Configured in the class defaults.
Audio A sound asset to play when this achievement triggers. Set on each node in the graph.

FSMN_AchKill¶

A kill-based achievement state. Extends FSMN_AchBase. Tracks kill counts and checks against a configurable requirement. The kill counter resets when the parent state machine restarts, which is how timed achievements reset between streaks.

Property Description
Required Kills The number of kills needed to earn this achievement. Set on each node in the graph.

Also inherits Message and Audio from FSMN_AchBase.

FSMN_AchKillRequirementTransition¶

Checks if the kill requirement for the current achievement has been met. Place this between FSMN_AchKill states to advance through achievement tiers.

This transition has no user-configurable properties. It reads the kill requirement from its source state automatically.

FSMN_AchTimedKillFSM¶

A nested state machine representing a timed achievement chain (like multi-kill streaks). Each state inside is a successive kill tier. The timer resets on each kill, and the chain expires if too much time passes between kills.

Property Description
Time Limit How many seconds the player has between kills before the streak resets. Set on each node in the graph.
Headshots Only If true, only headshot kills count toward this streak. Set on each node in the graph.
Priority Display priority. Lower numbers take precedence when multiple achievements trigger simultaneously. Default: 3. Set on each node in the graph.

Sample: FSM_Achievements¶

The sample achievement state machine tracks two categories running in parallel:

A timed kill-streak chain using FSMN_AchTimedKillFSM. The nested state machine contains seven tiers, each requiring one more kill within the time limit:

DoubleKill --> TripleKill --> MultiKill --> MegaKill --> UltraKill --> MonsterKill --> LudicrousKill

If the timer expires at any point, the chain resets to the beginning and can be earned again. Each tier plays a corresponding sound effect and displays a notification.

Tracks cumulative headshots using FSMN_AchKill states. Unlike the quick kill chain, these are not timed; the headshot count persists. The chain runs independently of the Quick Kills track.

Both tracks restart when they reach their end state, allowing achievements to be earned repeatedly.

AI Patrol System¶

The AI patrol state machine is the most complex state machine in the template. It inherits from FSM_AI_Base, which stores an internal reference to the owning AI pawn.

Two properties are configured in the class defaults:

Property Description
Target Point The patrol target point to navigate toward.
Time Between Visibility Checks How often the AI checks for target visibility during pursuit.

Top-Level Flow¶

The verified top-level flow connects three elements: a patrol area, a target pursuit sub-machine, and a decision conduit.

When the AI detects a target, the state machine transitions from the Patrol Area sub-machine to the TargetSpotted sub-machine. When pursuit ends, a Wait conduit evaluates the result and can return to patrol.

Patrol Area¶

A nested state machine with three states:

The AI selects a destination, navigates to it, then picks a new one.

TargetSpotted¶

A nested state machine that contains three parallel sub-machines for movement, engagement, and communication. When the AI spots a target, all three run simultaneously.

Handles navigation toward the detected target, losing and re-acquiring line of sight, and deciding when pursuit is over.

The AI navigates toward the target. If line of sight is lost, it moves to the last known location and can re-acquire or give up. A Target Reached conduit and a Target Lost state both lead to the sub-machine's end state.

A distance-based combat loop that runs alongside movement.

The In Range conduit checks distance. If close enough, the AI attacks, waits, then re-evaluates. If the target is out of range, the AI approaches again.

Allows AI agents to share target information with nearby allies.

The idle state (No Information) can transition to Relay Target when this agent spots something, or to Target Info Received when another agent shares information.

Note

Open FSM_AI_Patrol in the state machine editor to see the full graph and how all sub-machines connect. The AI patrol system is best understood by exploring it directly.

Shared Template Files¶

Blueprints¶

BP_BaseCharacter is a base character with health management and headshot detection. Extend this for both player and AI characters.

BP_MissionLevel is a level actor that defines a mission area. It tracks objectives within its boundaries using overlap events and notifies the mission system when objectives are completed.

Property Description
Start SM On Overlap Whether to start the mission state machine when the player overlaps the area.
Objectives The objective actors to track within this level. Set per-instance in the level.
Other Objects Additional actors associated with this mission level. Set per-instance in the level.

BP_ObjectiveBase is a collectible objective actor. When the player overlaps it, it fires a completion event to notify the mission system.

BP_AIActor is an AI enemy character that extends BP_BaseCharacter. Used in the sample map as the target for elimination missions and the subject of AI patrol behavior.

Interfaces¶

BPI_AchievementDisplay is an interface for displaying achievements in the UI. Implement this on your HUD or widget to receive achievement notifications.

BPI_PlayerStats is an interface for querying player statistics such as kill counts. The achievement system uses this to read player data.

Achievement Manager¶

AC_LogicDriverAchievementManager is an SMStateMachineComponent that runs the achievement state machine and manages the achievement widget UI.

Widgets¶

WBP_MissionWidget displays the current mission name and objective descriptions.

WBP_MissionCompleteWidget is a full-screen overlay shown when a mission is completed.

WBP_AchievementWidget is a pop-up notification for achievements with animation support.

WBP_HealthDisplay displays the player's current health.

Integration Guide¶

Adding Missions to Your Game¶

  1. Create objective actors. Extend BP_ObjectiveBase for collectible objectives, or create your own actors that fire the QuestObjectiveCompleted delegate.

  2. Set up mission levels. Use BP_MissionLevel to define areas where objectives are tracked, or fire objective events directly from your game logic. Enable Start SM On Overlap if you want the mission to begin when the player enters the area.

  3. Build mission state machines. Create a new state machine Blueprint with FSM_MissionBase as the parent class. Use FSMN_MissionFSM nodes to define missions, setting the Reward and Description on each. Place FSMN_Objective states inside them with a Required Target Count and an Objective description. Connect objectives with FSMN_ObjectiveTransition. Use FSMN_WaitForFSMs conduits to synchronize parallel objectives.

  4. Customize the UI. Modify WBP_MissionWidget and WBP_MissionCompleteWidget to match your game's style. FSMN_MissionFSM creates the mission widget when the mission begins, so you can swap the widget class by modifying the node class.

Start Simple

Try building a single-mission quest first before adding parallel branches or the Wait conduit. The Collection Mission in the sample is a good model for a first mission.

Adding Achievements to Your Game¶

  1. Attach the manager. Add AC_LogicDriverAchievementManager to your player character or game mode.

  2. Create achievement state machines. Use FSMN_AchKill for count-based achievements and FSMN_AchTimedKillFSM for streak-based chains. Set Required Kills on each FSMN_AchKill state. For timed chains, configure Time Limit, Headshots Only, and Priority.

  3. Set display priority. Lower Priority numbers take precedence. The default is 3. If a kill triggers both a headshot achievement and a streak achievement, the one with the lower priority number displays.

  4. Fire events. Make sure your game fires CharacterKilled (or equivalent) events that the achievement manager can listen to. The sample connects this through the game mode.

  5. Customize audio. Set the Audio property on each achievement state to play a sound when it triggers. The sample includes separate sound assets for each kill streak tier.

Non-Kill Achievements

The template's achievement classes are built around kills, but the pattern works for any countable event. You could extend FSMN_AchBase to track distances traveled, items crafted, or any other metric.

Adding AI Patrol to Your Game¶

  1. Set up AI characters. Extend BP_BaseCharacter (or BP_AIActor) for your AI agents. The sample uses PawnSensing for target detection.

  2. Create a base state machine. FSM_AI_Base stores the NPC reference internally. Create your patrol state machine as a child of FSM_AI_Base, or use FSM_AI_Patrol directly as a starting point.

  3. Configure patrol. Set Target Point to define where the AI patrols. Adjust Time Between Visibility Checks to control how often the AI looks for targets during pursuit.

Tip

Open FSM_AI_Patrol in the editor to explore the full graph. It is the most complex state machine in the template and is best understood visually.