Skip to content

Architecture

To add behaviour that goes beyond a Data Asset, you need to know which Blueprint holds what, and the path an action follows from a player's key to the host and back. Network model gives the rules of who decides what.

All paths start at Content/ZombieSurvival/Blueprints/.

The framework actors

Actor Where it exists What it holds
Core/BP_ZSGameInstance On every machine, from launch to quit Sessions: host, find, join, join by address, leave. The character rule ValidateChoice.
Core/BP_ZSGameMode On the host only The rules of the hosted game: the action registry the host accepts (ActionRegistry, checked by IsActionDefAllowed), the password and the ban list, the start points, the settings assets of the zombies, food, noise and social rules. Its components save and load the world (AC_WorldPersistence), run the weather (AC_WeatherDirector) and put far zombies to sleep (AC_ZombieSleep).
Core/BP_ZSGameState On every machine, replicated What every player shares: the world's options (Sandbox), the clock (ClockBaseMinutes, ClockBaseServerTime, TimeScale, TimeSpeedIndex), the weather and the snow depth, the power grid (bGridPowered), the list of survivors.
Core/BP_ZSPlayerState One per player, on every machine The player's identity (PlayerGuid), their counts (StatZombiesKilled, StatItemsCrafted, StatPiecesBuilt), whether they are dead, their PvP flag, and the character they asked for.
Core/BP_ZSPlayerController One per player, on the host and on that player's machine The HUD and every window, the radial menu, the chat (AC_Chat), the patient view of the health window (an AC_Wounds named PatientView), and the server events the player's machine calls, such as Server_RequestAction.
Player/BP_Survivor One per player, on every machine The character: body, inventory, skills and actions, in components (see below).
AI/BP_Zombie On every machine, run by the host A zombie. The host runs its senses and decisions, and each machine hides it by its own vision (AC_VisionTarget). Its numbers come from its archetype, a PDA_ZombieDef.
Interactables/BP_Interactable and its children On every machine, decided by the host Everything you act on in the world: doors, windows, containers, campfires, generators, fuel pumps, water sources, built pieces.
Vehicles/BP_VehicleBase On every machine, simulated by the host A Chaos vehicle, with its fuel (AC_VehicleFuel), parts (AC_VehicleParts), seats (AC_VehicleSeats), electrics (AC_VehicleElectrics) and a place to sleep (AC_SleepSpot).

The survivor's components

BP_Survivor is a Character. Most of its behaviour is in components, one per system, in ActorComponents/. The names in the first column are those of its Components panel.

Component Class What it does System page
Needs AC_Needs Hunger, thirst, fatigue, and whether the survivor is dead. Needs and statuses
Status AC_Status The statuses and their tiers, medicines, coughs and the heartbeat. Needs and statuses
Endurance, Mood AC_Endurance, AC_Mood Endurance spent and recovered; the mood. Needs and statuses
NeedsFX AC_NeedsFX The screen effects of the needs, on the owning player's screen only.
Wounds, Infection AC_Wounds, AC_Infection The 17 body zones and their wounds; the infection. Health and wounds
BodyTemperature AC_BodyTemperature Body temperature, wetness and shelter. Clothing and temperature
Clothing AC_Clothing The worn layers, their holes, patches, blood and dirt. Clothing and temperature
Sleep AC_Sleep Falling asleep, sleeping and waking. Sleep
Inventory, BackBag, SideBag AC_Inventory (three of them) The survivor's own inventory, and the two worn bags. Inventory and carrying
WeaponSlots AC_WeaponSlots The weapons stowed on the body, and the one drawn. Melee combat
Firearm AC_Firearm Rounds, magazines, jams and attachments of the gun in hand. Firearms
ActionQueue AC_ActionQueue Every timed action: request, validation, progress, effect, queue. See below. Map population and timed actions
Crafting AC_Crafting The recipes the survivor knows and the craft requests. Crafting
Building AC_Building Build mode: the ghost piece, snapping, placing and upgrading. Base building
Skills, SkillTraining, CharacterTraits AC_Skills, AC_SkillTraining, AC_CharacterTraits Skill levels and experience; experience earned near a source; occupation and traits. Skills and traits
VisionSource AC_VisionSource The vision cone of the local player. Player vision and occlusion
VisionTarget AC_VisionTarget How this survivor is hidden or faded on the other players' screens. Player vision and occlusion
ZombieAttacks AC_ZombieAttacks The zombies attacking this survivor: attack slots, grabs, takedowns. Zombies
CharacterMovement, MotionWarping engine Movement, and the warp targets of vaults and climbs. Traversal

The survivor's own functions tie the components together:

For Functions of BP_Survivor
input HandleInteractInput, HandleContextInput, HandleAttackInput
choosing what is under the cursor SelectInteractTarget, TraceContextTarget
combat RequestAttack, AttackAuthority, RequestFire, FireAuthority
the requests that start actions RequestTagged

How an action travels

Every gesture that changes the world is a timed action: a PDA_ActionDef Data Asset, run by the action queue of the survivor who does it. An action has a tag, such as Action.Openable.Toggle, a target (the actor it acts on, or the survivor itself) and parameters, an S_ActionParams: an index, a count, an item, an asset, a body part, a location, a yaw and an option.

Player's machine                          Host
-----------------                         ----
key, menu entry or radial
  -> BP_Survivor.RequestTagged(Tag)
  -> AC_ActionQueue.RequestAction
     (walks to the target first if needed)
  -> SendRequest
     plays the gesture at once (prediction)
  -> BP_ZSPlayerController
     .Server_RequestAction(Request)  ---->  HandleRequestAction
                                             is the action in the registry?
                                           -> AC_ActionQueue.StartAction_Authority
                                           -> ValidateRequest
                                              alive, not vaulting, target in reach,
                                              BPI_ActionTarget.CanPerformAction
                                           -> AcceptRequest
                                              duration: 0 -> effect now
                                              another action running -> queued
                                              otherwise -> timed
                                           -> BeginTimed: Current (replicated)
  OnRep_Current: progress bar,     <----   timer, checked every 0.1 s
  animation and sound on every              (death, moving, target gone)
  machine                                  -> FinishCurrent: validate again
                                           -> ApplyEffect:
                                              BPI_ActionTarget.PerformAction
                                              the target changes replicated
  OnRep_ on the target: every      <----     variables
  machine shows the new state

RequestTagged(Tag, Target, Params) looks for the definition with that tag, first in the survivor's own ActionDefs, then in DataAssets/Actions/Childs/DA_ActionRegistry_Default. An action set to approach its target walks the survivor to it before it sends anything. On the host's own survivor the same path runs without crossing the network.

The host refuses a request, with a reason shown to the player, when:

  • the definition is not in the registry of the game mode, DA_ActionRegistry_Default (This action is not allowed);
  • the survivor is dead, vaulting, or held by an action with bLockMovement;
  • the target is missing, or does not implement BPI_ActionTarget;
  • the target is out of reach, or out of sight when the definition requires a clear line;
  • the target's own CanPerformAction says no.

Once it accepts, the host lets a BP_Interactable fill in parameters in PrepareActionParams, then computes the duration: the base duration of the definition, or the one its target gives when the definition takes its duration from the target, then skill, stats and two bounds. An action of 0 seconds takes effect at once. If another action is still running, the request waits in the queue, MaxQueued requests at most.

While the action runs, the host cancels it if the survivor died, moved further than MoveCancelTolerance when the definition cancels on a move, or the target is gone. When the time is up, it validates the request again, applies the effect and grants the experience. Because the target changes replicated variables, a player who joins later sees the new state too.

The result is Completed, Cancelled or Refused, written in LastResult. A refusal with a reason reaches the player as a message.

The action target interface

Interfaces/BPI_ActionTarget is what makes an actor a target of actions. The host calls it, and the player's machine never does.

Function Inputs Outputs Called
CanPerformAction Tag, Instigator (the survivor), Params bOk, Reason when the request arrives, and again when the time is up
GetActionDuration Tag, Instigator, Params bOverride, Seconds only for a definition with bDurationFromTarget
PerformAction Tag, Instigator, Params none once, when the action completes

It is implemented by BP_Interactable, and so by every door, window, container and the rest, by the survivor for actions on yourself, such as eating or wearing, and by the vehicle, the vehicle container and the fuel pump.

On a child of BP_Interactable

The parent already implements the interface. Its children add their own actions through three functions they override, without touching the interface:

Override What it does
CollectEntries(Who) Adds the entries of the context menu, one AddActionEntry(Who, Tag, Label, Params) per action. AddActionEntry runs your check at once and stores its reason with the entry.
CanExtraActBy(Tag, Who, Params) Returns bHandled, bOk, Reason. Return bHandled true for your own tags only.
ExtraActBy(Tag, Who, Params) Returns bHandled, bDone. Applies the effect, on the host.

BP_Generator is a complete example. Its three actions, connect, toggle and refuel, are added in the first override, checked in the second and applied in the third, where the generator sets its replicated state. The campfire, the stove, the water source, the forage spot and the fuel pump follow the same pattern.

Where to add what

You want Where it goes
A new kind of item, zombie, recipe, piece, vehicle or outfit A Data Asset and its registry, with no graph. The how-to guides give the steps.
A new gesture on an existing kind of object A PDA_ActionDef, listed in DA_ActionRegistry_Default, and the three overrides on that object's Blueprint, as in Add a replicated action.
A new kind of object you act on A child of BP_Interactable with its own replicated variables and the overrides above.
A new behaviour of zombies Add a zombie behaviour
A new system on the survivor A new component in ActorComponents/, added to BP_Survivor, that follows the network model: its state in replicated variables, its changes through actions.