Struct AbilityObjectHitBroadcast
Tells observers which body an ability object hit, so they can draw the impact the server resolved instead of guessing at one.
public struct AbilityObjectHitBroadcast : IBroadcast
- Implements
-
IBroadcast
- Inherited Members
Remarks
Why an observer is told rather than left to work it out. An ability object's trajectory is deterministic and every peer agrees on it; its HIT SET is not. The server resolves hits inside a rewind to the CASTER'S view, and a third-party observer holds every character interpolated against its own latency — so an observer running the same query answered a question nobody asked. It could miss a hit the server landed (corrected, by AbilityObjectDestroyedBroadcast) and it could resolve one the server did not, which nothing corrected: its copy ended early, played its impact effect where nothing had happened, and — with a fork — carried on down a heading the server never took.
What it costs, and why that is less than it looks. An observer's copy is deliberately
run SpectatorInterpolationTicks behind the server's, so it stays consistent with the
interpolated peers it is drawn against — see ComputeObserverFastForwardTicks. That is
66 ms at the shipped tick rate, and it is a head start this message already holds: for
an observer inside roughly 133 ms round trip the authoritative answer arrives BEFORE
the local guess would have fired. Only observers past that see the impact late, and by
less than their one-way latency rather than by a round trip.
Sent to every observer of the caster, the owner included, exactly like AbilityObjectDestroyedBroadcast. The owner predicts its own hits and normally has this one already, in which case the receiver's per-object hit set makes the message a no-op — but an owner that MISPREDICTED A MISS had no correction at all before this, and its impact effect simply never played.
Reliable, and for the same reason its sibling is: there is no repeat behind it. A lost hit message is an impact nobody outside the server ever sees.
Fields
AbilityID
Ability the object belonged to.
public long AbilityID
Field Value
CasterObjectID
NetworkObject id of the casting character.
public int CasterObjectID
Field Value
ContainerID
Deterministic container id the object lived in (identical on every peer).
public int ContainerID
Field Value
Normal
Surface normal at Point.
public Vector3 Normal
Field Value
- Vector3
ObjectID
Object id within the container (identical on every peer).
public int ObjectID
Field Value
Point
World point of impact, measured on the server inside the rewind scope.
public Vector3 Point
Field Value
- Vector3
VictimObjectID
NetworkObject id of the character that was hit, or 0 when the hit resolved to scenery.
public int VictimObjectID
Field Value
Remarks
Zero is a real outcome rather than a failure: a projectile is free to end on a wall, and the OnHit events still run for it with no target character — which is what an authored impact decal or sound needs.