Build integration (PulseAIBuildBridge)

The bridge PulseAIBuildBridge lets agents raid the buildings of Pulse Build: they find hostile building pieces, move to them and damage them. Enable it next to PulseAI and PulseBuild. Everything runs on the server.

Hostile pieces

Building pieces drawn as instances have no actor, so they are no known targets of the awareness. The bridge searches the building world instead (UPulseBuildSubsystem::QueryPieces). A piece is hostile when

  • it has an owner (pieces of the world are nobody’s target) and health (Health trait), and
  • the owner’s team is not the agent’s team (Pulse::Team; an owner without team is hostile to agents with a team).

Agents of Pulse.Team.Neutral attack nothing, pieces of that team are never attacked.

FPulseAIBuildPieceScoring rates the pieces in the radius:

Property Default Description
DistanceWeight 1 Closeness: 1 at the agent, 0 at the radius
DamagedWeight 0.5 Missing health: damaged pieces first
PreferredTags, PreferredWeight none, 1 Pieces with these tags count more (doors, gates)
IgnoredTags none Pieces with these tags are never chosen

StateTree nodes

Category Pulse AI Build, for trees with the schema Pulse AI:
Node What it does
Evaluator Hostile Build Piece The best hostile piece in Radius, searched every Interval seconds. Outputs bHasPiece, PieceId, PieceLocation, Distance, PieceHealth
Task Move To Build Piece Moves next to the piece (Reach). Bind PieceId to the evaluator, or leave it empty and the task searches itself (SearchRadius, Scoring). Fails without path or when the piece is gone
Task Damage Build Piece Hits the piece every Interval seconds with Damage (UPulseBuildConstructionSubsystem::ApplyDamage, optional HitMontage), looking at it. Succeeds when it breaks or is gone, fails out of Reach or when the piece has no health

A raider in short:

Root
├─ Raid      Move To Build Piece                     → on succeeded: Attack, on failed: Wait
├─ Attack    Damage Build Piece (Damage 100, Interval 1) → on completed: Root
└─ Wait      Delay 2 s                               → on completed: Root

Pulse Build reacts as to any damage: health, repair, destroyed pieces and collapses of what stood on them.

Agents walk on the navigation mesh. For buildings that change while the game runs:

  1. Put a Nav Mesh Bounds Volume around the area (Set Up of Pulse AI offers it).
  2. Set Runtime Generation of the navigation mesh to Dynamic. The bridge step of Pulse AI and Pulse Build in the Pulse window does it (Project Settings > Navigation Mesh by hand). Open levels keep the old value until they are loaded again, and a RecastNavMesh actor of a level can override it.

Placed and removed pieces then update the mesh around them, also pieces drawn as instances (their collision blocks pawns). In the example map of Pulse Build a path through a new wall goes around it and goes straight again once the wall is destroyed.

Doors

A closed door cuts the mesh. Put Pulse AI Build Door Link (UPulseAIBuildDoorLinkComponent) into the actor class of the door piece: it adds a navigation link through the door (Depth in front of and behind the actor along its X axis, Height above its origin). When an agent reaches the link, the door is asked to open: implement IPulseAIBuildDoor::OpenDoorForAgent in the door actor (return false to keep it closed: the agent stops there). Without the interface the agent just walks on, which fits doorways without a door leaf.

Debugging

The log category LogPulseAIBuildBridge (Verbose) logs every hit, destroyed pieces, pieces out of reach and doors that stayed closed.


This site uses Just the Docs, a documentation theme for Jekyll.