Replication and Events
Cube Weapon replicates actor data and component state, then rebuilds client-side visual components. Its local subsystem maps are not themselves replicated objects.
Source: Private/WorldActors/WeaponActorBase_Replication.cpp, Private/Data/WeaponStructs.cpp, Private/Components/AC_WeaponNetComp_*.cpp and Private/Components/AC_WeaponCharComp.cpp.
Replicated State
| Owner | Properties |
|---|---|
| AWeaponActorBase | ActorNetGuid, BuildID, WeaponRuntimeData, RuntimeStats |
| UAC_WeaponNetComp | WorkingBuild |
| UAC_WeaponCharComp | AssignedWeaponActors, ActualUsedWeapon |
| UAC_WeaponGameplayComp | WeaponStateData |
WeaponRefCache, ActiveComponentMap, AvailableSockets and free mesh-component lists are local reconstruction state. ActualAmmo is not a replicated property.
Runtime Fast Array
FWeaponDataArray derives from FFastArraySerializer and uses FWeaponDataEntry items with EntryID, InstanceID, DBType, MeshType and SocketName. NetDeltaSerialize uses FastArrayDeltaSerialize; the owner back-reference is NotReplicated.
Item callbacks PostReplicatedAdd, PostReplicatedChange and PreReplicatedRemove call the actor's data-listener functions, which assign/reset local components. Array callbacks notify the actor of final sizes. Actor OnRep_WeaponDataArray also assigns entries absent from its ActiveComponentMap.
Clients load definitions by ID and reconstruct meshes on the replicated actor. They do not spawn an additional actor for every received build or mesh part.
FWeaponStateArray similarly serializes gameplay-state tags and notifies the gameplay component through its state-listener interface. State changes can start/stop the local fire loop.
RPC Routes
| Route | Client behavior | Authority behavior |
|---|---|---|
| Build | SRPC_QueueBuildRequest | Executes internal build handler |
| Acquire | SRPC_QueueAcquireRequest | Executes allocation handler |
| Equip/Unequip/Use | SRPC_QueueEquipRequest | Executes equipment handler |
| Interaction | Executes local handler, then SRPC_QueueInteractRequest | Executes interaction handler |
Ranged attack and reload use reliable multicasts. Their implementations skip an autonomous owner because that client has already executed the local interaction. Firemode change updates the state array through its interaction path rather than an equivalent dedicated multicast.
This provides local responsiveness but is not a complete prediction/reconciliation or authoritative ammunition system. Test event execution separately on authority, owning clients and simulated proxies.
Build Delegates
| Delegate | Parameters | Emitted by |
|---|---|---|
| OnWorkingBuildModified | OldBuild, NewBuild | MutateWorkingBuild on authority operation paths |
| OnWorkingBuildReplicated | OldBuild, NewBuild | Client OnRep_WorkingBuild |
| OnWorkingBuildCreated | BuildID | Client RepNotify when GUID changes, including import/reset transitions |
| OnBuildValidatedCallback | BuildID | Successful authority validation and client callback RPC |
| FetchBuildCallback | Build | CRPC_FetchBuildCallback after local registration |
OnWorkingBuildCreated means the replicated GUID changed, not exclusively that CreateBuild ran. It can carry an empty GUID on reset. BuildCreatedCallback on the controller interface is declared but not invoked by the create handler.
A validation callback supplies a GUID, not the complete build. WorkingBuild replication and RPC delivery should be coordinated independently; do not assume all replicated fields are ready simply because a callback arrived.
Actor and Character Events
| Event | Contract |
|---|---|
| WeaponAcquiredCallback | Actor OnRep_Owner for locally controlled owner, when GUID is already valid |
| OnActorNetGuidReplicated(ActorRef) | Successful registration in OnRep_ActorNetGuid when previously unregistered |
| WeaponUnequipCallback | Authority cleanup handoff from Unequip |
| OnUsedWeaponUpdate(OldWeapon, NewWeapon) | Character active-weapon state changes |
| OnWeaponFired(WeaponRef) | Gameplay fire loop consumes a shot |
| OnWeaponStateChanged(bAddTag, ChangedTag) | Declared on the actor; not a general replacement for emitted component state events |
OnRep_ActorNetGuid does not retry WeaponAcquiredCallback if OnRep_Owner ran before the GUID arrived. Internal acquisition also lacks an authority-side completion callback. Project handoff logic must account for those differences.
Gameplay Tags and Thread Context
Native weapon state tags are defined in Public/Data/WeaponTags.h and Private/Data/WeaponTags.cpp. Keep slot tags and state tags distinct, and use the exact tags expected by the fire/state handlers.
Use UObject gameplay APIs on the game thread. Asynchronous streaming does not make registries, build mutation or runtime components a thread-safe worker API. No locks or cross-thread gameplay mutation contract are provided by these managers.