Struct AbilityActivatedBroadcast
Tells observers that a character activated an ability, with everything needed to reproduce it.
public struct AbilityActivatedBroadcast : IBroadcast
- Implements
-
IBroadcast
- Inherited Members
Remarks
The ability simulation is deterministic — AbilityObject is a plain MonoBehaviour driven
by the tick delta from a seeded RNG — so an observer given the same spawn tuple produces the
same object the server did, and it costs nothing further on the wire for its whole lifetime.
State forwarding is off for every character, so this message (and the spawn payload, for a
late joiner) is the only way an observer ever learns about a cast.
Server authored. The client sends intent through its replicate input; the server validates it, resolves the target itself, and broadcasts what actually happened. Nothing here is taken from the client on trust — in particular TargetObjectID is the server's own resolution, never a victim the client named.
Wire format is hand written (AbilityObserverBroadcastSerializers) and shaped by SpawnMode: a Camera spawn carries the aim origin and the packed aim direction and the observer re-derives the pose with the server's own formula; every other mode carries the pose itself and no aim at all. The spawn tick travels as a 16-bit offset from ServerTick with a full-width fallback. Sent reliably: a cast is a rare, event-driven message and a lost one used to be a projectile an observer never saw. The only unreliable use is the second and later per-tick spawns of a channelled ability, where the first spawn of the channel is reliable and the rest are one visual each.
Fields
AbilityID
Ability that was activated.
public long AbilityID
Field Value
AimOrigin
World-space point the ability was aimed from. Camera mode only.
public Vector3 AimOrigin
Field Value
- Vector3
Remarks
Sent rather than derived. An observer could compute the caster's eye position, but it holds that caster interpolated — several hundred milliseconds behind — so deriving it would place the ability where the caster used to be. A Camera spawn's pose is a pure function of this and the aim direction, so for that mode the pose itself is omitted.
CasterObjectID
NetworkObject id of the casting character.
public int CasterObjectID
Field Value
PackedAimDirection
Aim direction, packed by AimDirectionCompression. Camera mode only.
public uint PackedAimDirection
Field Value
Seed
Deterministic RNG seed the ability object was spawned with.
public int Seed
Field Value
Remarks
The whole reason an observer can reproduce the cast rather than be told about it every
tick. Must match what the server used or the two simulations diverge immediately. It is
also half of the container id (AbilityContainerAllocator), which is why the
destroy message below can name an object by id alone.
ServerTick
Server TimeManager.LocalTick at the moment of the spawn.
public uint ServerTick
Field Value
Remarks
SpawnTick is in the OWNER's replicate-tick domain, which an observer has no way to map. This one is in the server's, so an observer can compare it against its estimate of the current server tick and fast-forward the object by the transit delay — otherwise every observed projectile starts one network delay behind the server's and outlives it by the same amount.
SpawnMode
The template's AbilitySpawnTarget, which decides what else is carried.
public byte SpawnMode
Field Value
SpawnPosition
World position the server spawned the object at. Every mode except Camera.
public Vector3 SpawnPosition
Field Value
- Vector3
Remarks
PointBlank, Forward and Spawner poses come off the caster's motor and spawner transforms, which an observer holds several hundred milliseconds behind, and a Target pose is the server's raycast hit, which an observer cannot reproduce against interpolated colliders. Since the trajectory is a closed form from the spawn pose, a locally resolved pose would keep the observer's object on a parallel, offset line for its whole life.
SpawnRotation
World rotation the server spawned the object with. Every mode except Camera.
public Quaternion SpawnRotation
Field Value
- Quaternion
Remarks
Travels through FishNet's 64-bit quaternion packing. The 32-bit form was measured at 0.59 degrees of error on a representative cast rotation — half a metre of visible drift on a 50 m projectile — which is more than a viewer should see even though hits are resolved on the server and only the visual is at stake. The owner never reads this: it predicts with its own exact pose.
SpawnTick
Replicate tick the ability was spawned on.
public uint SpawnTick
Field Value
TargetObjectID
NetworkObject id the server resolved as the target, or -1 when the ability has none.
public int TargetObjectID