Fire Crystal Ant - AI

Version 1.2 by Adam Janus on 2026/01/19 18:51

Fire Crystal Ant

1. Introduction

  1. A low-level, early-game hostile creature.
  2. Introduce directional combat and basic telegraphed enemy attacks.
  3. Drops basic loot.

1768844705045-424.png

2. Enemy Behaviours

Summary:

  • Patrol
  • 2 Attacks
  • 1 special move
  • Stagger

Detects player by:

  • Sight
  • Hearing
  • Touch
  • Damage

1768844705047-128.png

























 

2.1 Patrol

1768844705048-905.png

  • Triggered by: Not engaged in any other behaviour OR end of Disengage behaviour
  • Shown behaviour: Picks a location within its [Patrol Distance], rotates towards it and moves until it reaches it at [Patrol Speed].
    • This is handled by a Custom Task and the MoveTo task of UE’s Behaviour Trees
    • A new random location is picked after [NextPatrolWait] 
  • Transition rule: Senses the Player by sight, hearing, touch or damage.
    • Senses are handled by Unreal Engine’s AIPerception component
    • Attacking an unaware Enemy triggers this behaviour
  • Animation:
    • Normal ant-walking animation, with antennas waving slightly.
    • On reaching patrol destination, idle animation with antennas moving in a jerky fashion (as if assessing the surroundings).

2.2 Approach

1768844705049-610.png

  • Triggered by: end of Patrol Behaviour 
  • Shown behaviour: the Enemy rotates towards the Player and moves towards their direction at [Approach Speed].
    • This is handled by the MoveTo task
  • Transition rule:  the Enemy stops moving when they are closer than [Attack Distance] from the Player and they still have the Player in their Line of Sight 
    • [Attack Distance] overrides the [Acceptable Radius] value in the MoveTo Task and is edited on a per-enemy basis based on their Design
  • Animation:
    • Faster ant-walking animation, with antennas waving faster.

2.3 Enemy Attack

1768844705050-879.png

  • Triggered by: end of Approach Behaviour 
  • Shown behaviour: the Enemy triggers an Attack Animation Montage or Move Animation Montage
    • Pincer Attack is preferred usually.
    • Stinger Attack is preferred when:
      • Player is near the edge of [Attack Distance].
      • Player has reached the [Hit Streak Limit].
    • Burrow Move is preferred when:
      • Player is out of [Attack Distance].
      • Player has reached the [Hit Streak Limit].
        • Lower preference than Stinger Attack.
  • Transition rule: the Enemy evaluates if the Player is still within [Attack Distance] and in its Line of Sight and either Attacks again or starts the Approach Behaviour again 
  • Animation:

2.4 Enemy Staggered

  • Triggered by: [Stagger Damage] >= [Stagger Limit]
  • Shown behaviour: the Enemy aborts all other Behaviours and triggers a Stagger Animation Montage
  • Transition rule: upon ending the Stagger Animation Montage and waiting [Stagger Time] the Enemy evaluates if the Player is still within [Attack Distance] and in its Line of Sight and either starts the Attacks Behaviour or the Approach Behaviour

2.5 Enemy Disengage

1768844705052-455.png

  • Triggered by: the Player gets further than the Enemy’s [AreaOfInterest]
  • Shown behaviour: the Enemy rotates towards its [SpawnLocation] and goes back there
    • This is handled by the MoveTo task
  • Transition rule: upon reaching the [SpawnLocation] and waiting [NextPatrolWait] the Enemy starts the Patrol Behaviour

3. Action and Reactions

3.1 Attacking the Enemy

Upon registering damage, the following happens:

  • Particles are spawned at the first point of impact
    • If the flesh is hit, slightly bright gold particles. 1 burst: Short-lived and sparse.
    • If the armour is hit, dull grey particles. Smaller particles. 1 burst: Short-lived and even sparser.
  • A 2D Sound Effect is spawned
    • If the flesh is hit, a satisfying crunch sound.
    • If the armour is hit, a dull clang sound.
  • Additionally, if flesh is hit, the crystals on the ant’s body glimmer in dull red (emissive).
  • The Enemy receives damage based on the calculations in the CombatSystem_Design Document.
  • The Enemy receives Stagger Damage.

3.2 Enemy Attack

This enemy has attacks, and 1 special movement while attacking.

3.2.1 Pincer attack

The ant uses the pincers on its face to “bite” the player.

Damage

Type

Blockable?

Number of attacks

Extra Effects/Conditions

[Low]

Slashing

1

None

3.2.1.1 Animation

Wind-up:

  1. Extend the pincers over 0.5 seconds.
    1. Also, tilt the head back by 5 degrees from normal position (or the closest that’s noticeable to the player)
  2. [Notify] Body crystals glow deep gold.
  3. [Notify] Sounds:
    1. Insect-like crittering sound, and
    2. “Knock-knock-knock” retracting sound (like small machine gears)
  4. Hold for 0.5 seconds.

Swing:

  1. Snap shut over 0.2 seconds.
  2. Snap the head forward by 5 degrees from normal position.
  3. [Notify] Body crystals stop glowing abruptly.
  4. [Notify] Sounds:
    1. Slam sound
  5. [Notify] Apply slashing damage according to the number of pincer colliders that overlap the player.
    1. If the player is blocking, apply [Low] stamina cost to the player according to the number of pincer colliders that overlap the blocking shield.

Recovery:

  1. Pincers reach normal positions over 0.2 seconds.
  2. Cooldown for 2 seconds.

3.2.2 Sting attack

The ant uses the stinger at the back to stab the player.

Damage

Type

Blockable?

Number of attacks

Extra Effects/Conditions

[Low-Mid]

Slashing
+ Poison

1

Poisoned (5 seconds)

3.2.2.1 Animation

Wind-up:

  1. Extend the wings horizontally over 0.5 seconds.
    1. Start flapping the wings.
  2. Lift the entire body up by 10 cm over 0.3 seconds.
    1. Also, slightly curl the body (i.e. bring the stinger closer to the head)
  3. [Notify] Body crystals glow deep gold.
  4. [Notifies] Sounds:
    1. Insect-like crittering sound (same as in Pincer attack), and
    2. Gentle swooping sound
  5. Hold for 0.2 seconds.

Swing:

  1. Quickly twist the entire body mid-air such that the stinger pointed at the player over 0.3 seconds.
  2. [Notify] Body crystals stop glowing
  3. [Notifies] Sounds:
    1. Fast swooping sound
    2. Subtle “cling” sound (like metal hitting metal)
  4. [Notify] Apply damage if the stinger collider overlaps the player.
    1. If the player is blocking, apply [Low-Mid] stamina cost to the player if the stinger collider overlaps the blocking shield.

Recovery:

  1. Body uncurls completely and the ant lands back on the ground over 0.5 seconds.
    1. Also, wings retract completely.
  2. [Notifies] Sounds:
    1. Very dull thump sound
    2. Very subtle swooping sound
  3. Cooldown for 2 seconds.

3.2.3 Burrow Move

The ant burrows into the ground and pops out behind the player.

3.2.3.1 Animation

Wind-up:

  1. Raise the arms and front half of the body by 4 cm over 0.5 seconds, as if “bracing”.
  2. [Notifies] Sounds:
    1. Dulled version of the crittering sound.
  3. Hold for 0.1 second.

Swing:

  1. Dive entirely into the ground, over 0.2 seconds.
    1. Kick up a small mound, which disappears after 1 second.
  2. [Notifies] Sounds:
    1. Dull thump
    2. Crunch of stones and mud
  3. Burst out of the ground (roughly) behind the player over 0.2 seconds.
    1. Facing the player.
    2. Same as before, kick up a mound.
  4. [Notifies] Sounds:
    1. Sharp woosh
    2. Crunch of stones and mud

Recovery:

  1. Cooldown for 5 seconds.

3.3 Enemy Armor

  • The ant’s body is not visibly armoured per se. However, hitting different areas of the ant impart different damage, as follows:

Part of the body

Damage

Notes

Entire top and sides

[Low]

On account of being covered in crystals

Head

[Mid]

No crystals, but skull

Under the body

[High]

No crystals, softer, cream-coloured skin

Each of these parts correspond to unique colliders along the body.
 

  • A capsule collider that is only used for AI movement logic calculations

3.4 Enemy Stagger

  • When the received [Stagger Damage] >= [Stagger Limit] the Enemy starts the Stagger Behaviour
  • After completing the Staggered Behaviour the [Stagger Damage] gets reset to 0
  • The received [Stagger Damage] goes down over time if new [Stagger Damage] is dealt every [Stagger Recovery Time]

3.5  Defeating the Enemy 

3.5.1 Summary

  • Upon reaching 0 HP the Enemy plays a Death Anim Montage and stops using its Behaviour Tree.
  • All Colliders besides the Enemy Base Collider are Disabled
    • The Base Collider is set to overlap all
  • All physics, including Gravity, is disabled
  • Loot is dropped

3.5.2 Animations

  1. The ant’s body rises up in the air by 10 cm, somersaults and flips over, and falls back to the ground. Legs up in the air and the wings splayed slightly.
  2. All of this happens in 1 second.
  3. Crystals stop glowing.

3.5.3 Loot

  • Drops 3-6 [crafting crystals (type 1)].
  • Drops 5-10 [energy].

4. Enemy Blueprint Structure

4.1 Base Enemy Blueprint

The Base Enemy Blueprint inherits from Character

Tuning of basic Components:

  • Character Movement -> [Use controller rotation yaw] -> True
  • Capsule Component -> ignore all Collisions besides the ones needed for Locomotion

Other Components and Tuning:

  • AI Controller -> AI Perception -> Senses Config -> All Enemies have at least the Sight Sense
  • Base Collider
  • Attack Colliders
  • Reference Point -> Located at the Center of Mass of the Enemy
  • Area of Interest (sphere collider)

4.2 Enemy Blackboard

All Enemies share the same Blackboard, besides particularly unique and complex Enemies (like bosses)

4.3 Behaviour Tree

Briefly described at 2. Enemy Behaviours.

5. Instance Editables

5.1 Manually editable

Variable

Type

Description 

Health Points

Float

The Enemy’s health

Spawn Location 

Vector 3 

Where the Enemy originates (set on Begin Play) 

Attack Distance

Float

How far from the Player the Enemy starts to attack

Stagger Damage 

Float

The amount of received Stagger Damage 

Stagger Limit

Float

The amount of Stagger Damage to initiate the Stagger Behaviour

Stagger Time 

Float

The duration of the Stagger Behaviour

Stagger Recovery time 

Float

How long it takes for the Stagger Damage to reduce while not taking damage 

Patrol Speed 

Float

The Speed of Movement in the Patrol Behaviour 

Approach Speed

Float

The Speed of Movement in the Approach Behaviour 

Next Patrol Wait 

Float

How long to wait before going to the next Patrol Point 

Patrol Distance

Float

How far from Spawn can the Enemy pick a Patrol Point

Attack Damage

Float

How much Damage the Enemy deals by Pincer attack

Attack Damage Stinger

Float

How much Damage the Enemy deals by Stinger attack

Poisoned Duration

Float

How long does the player stay poisoned after Stinger attack

Base Attack Animation Montage

Anim. Montage

The Animation of the Enemy’s Pincer attack

Stinger Attack Animation Montage

Anim. Montage

The Animation of the Enemy’s Stinger attack

Burrow Move Animation Montage

Anim. Montage

The Animation of the Enemy’s Burrow Move

Stagger Animation Montage 

Anim. Montage 

The Animation of the Enemy’s Stagger 

Death Animation Montage 

Anim. Montage

The Animation of the Enemy’s Death

Hit Streak

Integer

Number of hits player has made without taking damage

Hit Streak Limit

Integer

The amount of hit streak before preferring Stinger Attack

Flesh Hit Sound

Sound Cue

The sound to play when player attacks on Enemy’s flesh

Armor Hit Sound

Sound Cue

The sound to play when player attacks on Enemy’s armor (in this case, the ant’s body’s upper and side areas)

Flesh Hit Particles

Niagara System

The VFX to play when player attacks on Enemy’s flesh

Armor Hit Particles

Niagara System

The VFX to play when player attacks on Enemy’s armor

Pincer Attack Crystals Colour

Colour

Colour of the body crystals when the Enemy does Pincer attack

Stinger Attack Crystals Colour

Colour

Colour of the body crystals when the Enemy does Stinger attack

Flesh Hit Crystals Colour

Colour

Colour of the body crystals when player attacks on Enemy’s flesh

Dropped Loot

Array of item structs

  • Item
  • Fixed quantity or range?
  • Amount

The items to drop when the Enemy dies.

5.2 Internally set

Variable

Type

Description 

Target

Actor

The Target the Enemy pursues (commonly Player, set in the Blackboard) 

Current Location 

Transform 

Used to determine the relative position of the Enemy compared to the Player, to trigger different Attacks (set in the Blackboard)

Has Line of Sight 

Bool

Used to determine if the Enemy can actually see the Player (set in the Blackboard) 

Patrol Point

Vector 3

The chosen Patrol Point (set in the Blackboard)