clik-engine API
    Preparing search index...

    Class LagCompensation

    Server-side lag compensation using historical position snapshots. Rewinds entity positions to verify hits at the time the client fired.

    Usage:

    const lagComp = new LagCompensation({ maxHistory: 30 });
    // Each server tick:
    lagComp.recordTick(tick, entityPositions);
    // On hit request from client:
    const wasHit = lagComp.verifyHit(clientTick, shooterPos, targetId, hitRadius);
    Index

    Constructors

    Accessors

    Methods

    • Verify a hit by rewinding to the client's tick. Checks if the target was within hitRadius of the shot position at that tick.

      Parameters

      • clientTick: number
      • shooterPosition: PositionLike
      • targetId: string
      • hitRadius: number

      Returns boolean