Table of Contents

Class HitClaimGeometry

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

The arithmetic the server uses to decide whether a hit the owner claims (see HitClaimVictim) could have been what the owner saw.

public static class HitClaimGeometry
Inheritance
HitClaimGeometry
Inherited Members

Remarks

What is being bounded. The owner resolves its projectile against characters where it draws them; the server resolves the same sweep against where its position history says they were drawn. The history reproduces the owner's view exactly while a character moves steadily and its updates arrive on time. It cannot when the owner drew something the server never had: the straight line between two position updates two ticks apart while the character turned between them, a character held at its last update because the next was late, a position rounded to the wire's centimetre grid. Every one of those errors is a DISTANCE THE CHARACTER MOVED over a tick or two, so the tolerance is a small constant plus a few ticks of the victim's own speed: a character standing still gets almost none, because nothing about a still character can have been drawn elsewhere.

Why geometry and not a physics query. The check needs one distance between one swept shape and one character, against a pose out of the history. Moving the character there, syncing physics and casting would cost a rewind scope for an answer two segments give exactly, and could not be tested without a physics scene.

Fields

BaseTolerance

Tolerance every claim gets, in metres: the wire grid, the claim's sixteenth-of-a-tick hold, float noise.

public const float BaseTolerance = 0.1

Field Value

float

MaximumTolerance

The most the tolerance grows to, in metres, however fast the victim was moving.

public const float MaximumTolerance = 1.5

Field Value

float

ToleranceTicksOfMovement

Ticks of the victim's own movement a claim may be off by.

public const float ToleranceTicksOfMovement = 2.5

Field Value

float

Remarks

Two for the straight line a client draws between updates two ticks apart, and a half for an update that arrived inside the playback margin. A character that outran this was drawn somewhere the connection, not the aim, put it; the claim is refused and the server's own sweep stands.

Methods

Gap(Vector3, Vector3, float, Vector3, Vector3, float, float, out Vector3, out Vector3)

The clear distance between an object swept from from to to and an upright character: zero when they touch or overlap.

public static float Gap(Vector3 from, Vector3 to, float shapeReach, Vector3 victimFeet, Vector3 victimUp, float victimRadius, float victimHeight, out Vector3 pointOnVictim, out Vector3 normal)

Parameters

from Vector3

Where the sweep began.

to Vector3

Where it ended.

shapeReach float

The swept shape's size about its centre (its largest half extent).

victimFeet Vector3

The character's position (its feet).

victimUp Vector3

The character's up.

victimRadius float

The character's capsule radius.

victimHeight float

The character's capsule height.

pointOnVictim Vector3

The point on the character's surface nearest the sweep.

normal Vector3

From that point toward the sweep.

Returns

float

SegmentDistance(Vector3, Vector3, Vector3, Vector3, out Vector3, out Vector3)

The shortest distance between two segments, and the points on each where it is reached.

public static float SegmentDistance(Vector3 p1, Vector3 q1, Vector3 p2, Vector3 q2, out Vector3 c1, out Vector3 c2)

Parameters

p1 Vector3
q1 Vector3
p2 Vector3
q2 Vector3
c1 Vector3
c2 Vector3

Returns

float

Tolerance(float, float)

How far a claim's victim may be from the object's swept path and still be accepted.

public static float Tolerance(float victimSpeed, float tickDelta)

Parameters

victimSpeed float

The victim's speed at the moment claimed, metres a second, from the history.

tickDelta float

Seconds per tick.

Returns

float