Based on the context of the image, which displays a list of Unreal
Engine Blueprint nodes used for creating AI behavior, the "missing
data" refers to the logic and components required to actually connect
these nodes into a functioning system.
The image lists the ingredients, but it is missing the
recipe.
Here is a breakdown of the specific technical data and logic
missing from this image to make that AI work:
1. The Execution Flow (The "Wires")
The image shows isolated nodes. In Unreal Engine, these need
to be connected via "Execution Pins" (the white wires) to define the
order of operations.
- Missing:
The logic of when to switch states. For example, a branch checking:
"Is the Player within X distance? If True, switch Enum to Attack.
If False, switch to Chase."
2. The Enumeration Definition (The States)
The image lists Switch on Enum, but it doesn't define what
the Enumeration is.
- Missing: A
user-created Enum file (e.g., E_AI_State) containing specific list items:
- Idle
- Patrol
- Chase
- Attack
3. Essential Variables
To use nodes like Get Distance To or AI Move To, specific
variables must be stored in memory.
- Missing:
- TargetActor
(Variable to store the Player Character reference).
- AttackRange
(Float variable to define when to stop chasing and start hitting).
- HomeLocation
or PatrolRadius (Vector/Float for the random point generation).
4. The Trigger (Events)
These nodes do not run automatically. They need an event to
fire them.
- Missing:
- Event
Tick (to constantly check distances).
- Event
BeginPlay (to start the patrolling).
- OnSeePawn
(The event delegate that triggers when the sensing component actually
sees something).
5. World Setup Requirements
For AI Move To and Get Random Point in Navigable Radius to
function, the game world needs specific volumes.
- Missing: A NavMeshBoundsVolume.
Without this volume placed in the level, the AI cannot generate a path and
will simply stand still.
6. Damage Logic
The image lists Play Montage (the animation of attacking),
but it is missing the logic that actually calculates damage.
- Missing: Apply
Damage node or a Hitbox collision event (to actually hurt the player).
Summary
To recreate the system implied by the text "Patrol,
Chase, Attack," you would need to combine these nodes into a State
Machine inside an AI Controller or Character Blueprint.
Here is the final summary of the complete AI system. It
combines the visible nodes from your image with the missing logic,
variables, and world setup required to make a functional "Patrol,
Chase, Attack" loop in Unreal Engine.
The Complete AI System Design
This system functions as a State Machine. The AI
constantly checks which "State" it is in (Patrol, Chase, or Attack)
and executes specific logic for that state.
1. The Missing Foundation (Prerequisites)
Before any of the nodes in the image can work, these
"invisible" elements must exist:
- NavMeshBoundsVolume: A
volume placed in the level that allows AI Move To and Get Random Point to
find pathable ground.
- The
Enumeration (E_AI_State): A custom Enum variable
containing three specific states:
- Patrol
- Chase
- Attack
- Variables:
- Target_Actor
(Actor Reference): Stores who the AI is chasing.
- Attack_Range
(Float): Defines how close the AI needs to be to stop chasing and start
swinging (e.g., 150.0).
2. The Logic Flow (How the Nodes Connect)
Here is how the nodes from your image connect with the
missing logic to form the behavior loop:
A. The Sensing Phase (The Trigger)
- Event: PawnSensing
(On See Pawn) fires when the player enters the AI's vision cone.
- Logic:
- Set
Target_Actor to the Pawn that was seen.
- Set
the State Enum to Chase.
B. The Decision Phase (The Brain)
- Event: Event
Tick (runs every frame).
- Node: Switch
on Enum. This splits the logic into three distinct paths based on the
current state.
C. The State Behaviors
- Path
1: PATROL (Passive)
- Logic:
Check if the AI has reached its current destination.
- Nodes
Used: Get Random Point in Navigable Radius $\rightarrow$
AI Move To.
- Result:
The AI picks a random spot nearby and walks to it. When it arrives, it
picks a new one.
- Path
2: CHASE (Aggressive)
- Logic:
Constantly check the distance to the player.
- Nodes
Used: AI Move To (Target: Target_Actor) $\rightarrow$
Get Distance To.
- Transition:
If Get Distance To is less than Attack_Range, switch State Enum to
Attack.
- Path
3: ATTACK (Combat)
- Logic:
Stop moving, face the player, and play the attack animation.
- Nodes
Used: Stop Movement $\rightarrow$ Find Look at
Rotation (so AI faces player) $\rightarrow$ Play Montage (Attack
Animation).
- Transition:
If Get Distance To becomes greater than Attack_Range (player runs
away), switch State Enum back to Chase.
Summary Table
|
State |
Primary Node (From Image) |
Missing Data Required (To make it work) |
|
Patrol |
Get Random Point... |
NavMeshBoundsVolume
(World) |
|
Chase |
PawnSensing |
Target Variable
(Memory) |
|
Attack |
Play Montage |
Damage Logic (Gameplay) |
|
All |
Switch on Enum |
Event Tick (Updates the logic
loop) |
Would you like me to write out the pseudo-code for the
"Chase to Attack" transition so you can build it in Blueprints?
Based on the "Log Summary" provided in this second
image, the workflow has improved by defining the infrastructure
(NavMesh, Enums, Timers), but it is still missing the Input (Sensing)
and the Consequence (Damage/Reset).
Here is the specific data missing from this summary to make
the AI actually playable:
1. The "Eyes" (Target Acquisition
Logic)
The summary says to "Use 'AI Move To' with a Target
Actor," but it is missing the data on how that variable gets set in the
first place.
- Missing:
There is no mention of Pawn Sensing, AI Perception, or an OnSeePawn
event. Without this, the Target Actor variable remains empty, and the AI
will stay in the "Patrol" state forever because it never
"sees" anyone to chase.
2. The "Sword" (Damage & Combat
Logic)
The summary mentions the "Attack" state, but it
treats it only as a destination. It is missing the actual gameplay logic of
attacking.
- Missing:
- Apply
Damage: The math to subtract health from the
player.
- Hitbox/Collision:
Knowing when the sword actually touches the player.
- Motion
Warping: (Optional but common) Snapping the AI to
the player during the attack animation so they don't swing at the air.
3. The "Reset" (Loss of Target Logic)
Box 4 explains how to transition from Chase $\rightarrow$
Attack, but it is missing the logic for Chase $\rightarrow$ Patrol
(giving up).
- Missing: A
check to see if the Target Actor is too far away (max chase
distance) or if the AI has lost sight of the player for too long. Without
this, once the AI starts chasing, it will chase the player infinitely
across the entire map, never returning to its patrol route.
4. Animation State Data
While it mentions an Enum for logic states, it misses
the link to Animation Blueprints.
- Missing: A
boolean or Enum pass-through to the Animation Blueprint to tell the 3D
model to switch from "Running" animations to
"Combat/Swinging" animations.
Summary of the Missing Loop
You have the Movement (NavMesh/MoveTo) and the Brain
(Enums/Tick), but you are missing:
- The
Trigger: (Seeing the player).
- The
Impact: (Hurting the player).
- The
Exit: (Giving up and going home).
Would you like a Blueprint screenshot of how to set up the "On
Target Lost" logic so the AI stops chasing you if you run far enough
away?
Here is the final summary that integrates the infrastructure
from your image with the missing "gameplay" logic required to make
the AI functional.
To build the complete Patrol $\rightarrow$ Chase $\rightarrow$
Attack cycle, you need to add the Input (Sensing), the Consequence
(Damage), and the Exit Strategy (Reset).
The Complete AI Gameplay Loop
1. The Input: Target Acquisition (Missing Data)
The AI needs to know who to chase before it can use
"AI Move To."
- The
Component: Add a PawnSensing component to your
AI Character Blueprint.
- The
Logic: Use the On See Pawn event.
- Action:
When the event fires, cast the "Pawn" output to your ThirdPersonCharacter
(or Player).
- Data
Set: Save this As Target_Actor and set the State Enum to Chase.
2. The Interaction: Combat & Damage (Missing
Data)
The "Attack" state in your image is just a label;
you need to give it weight.
- The
Trigger: Inside your Attack Animation (Montage), add
an Anim Notify (e.g., "HitFrame").
- The
Logic: In the Blueprint AnimNotify_HitFrame event:
- Action:
Run a SphereOverlapActors or LineTrace forward from the AI.
- Consequence: If
it hits the Player, call Apply Damage. This subtracts health from the
player's variable.
3. The Exit: The Reset Logic (Missing Data)
You need a way to break the loop so the AI doesn't chase the
player forever.
- The
Check: Inside your Event Tick (during the Chase
state), add a second distance check.
- The
Logic:
- If
Distance < Attack Range: Attack.
- If
Distance > Give Up Range (e.g., 2000 units): Reset.
- The
Reset Action: Set Target_Actor to Empty/Null and switch
the State Enum back to Patrol.
Master Summary Table
This table merges the data from your image (The
"How") with the missing data (The "Why" and
"When").
|
Step |
State |
Logic (From your Image) |
Missing Data Added |
|
1 |
Patrol |
Use Get Random Point & NavMesh to walk around. |
Sensing: Waits for OnSeePawn to
interrupt the walking and validate a target. |
|
2 |
Chase |
Use AI Move To targeting the Target Actor. |
Reset: Checks if Distance > 2000.
If true, clears target and returns to Step 1. |
|
3 |
Attack |
Transition when Distance < Attack Range. |
Damage: Uses Apply Damage and Anim
Notifies to actually hurt the player. |
|
4 |
Loop |
Switch on Enum manages the flow. |
Animation: Sends a boolean to the
AnimBP so the model visually draws a weapon. |
Next Step:
Would you like the Blueprint logic for the "Reset/Give
Up" system so your AI stops chasing when you run too far away?
No comments:
Post a Comment