Class FollowerEnvelope

java.lang.Object
ac.boar.anticheat.prediction.vehicle.FollowerEnvelope

public final class FollowerEnvelope extends Object
Every place (and yaw) the client can be showing a vehicle the server moves, as a set. Checks use this set as their limit: the boat takeover (UncertainRunner), the boat top retry (BoatTopRetry) and the horse mount (HorseTicker.mountNear).

Why a set: the client shows the vehicle a little in the past, on a clock we never see. So we run the client's interpolation for every timing our send and arrival times allow. The set can be bigger than what the client shows, never smaller, while the two windows below hold.

Client model (PredictedMovementComponent::tickNextPosition 0x1047ff9f0, HistoryCache::addHistory 0x1047fef70): - Each server move is an entry, stamped with the client's clock when it handled the packet. - Each tick: delay = 100 ms * clamp(smoothed time between moves / 50 ms, 1, 8). lookup = now - delay. - The target is the point on the entry line at the lookup time (the newer entry itself when it is on the ground). - The shown position moves 1/3 of the way to the target (1/remaining when no new target was picked).

The two windows, in our own nanoTime (the client's clock is assumed to be ours plus a fixed offset): - An entry's stamp: from when we sent the move, to when the reply to the next latency packet reached us. The client handles the move before it answers that latency packet. - The client's "now" for input k: from when we sent the newest latency packet whose reply came before input k (LatencyUtil.nowLowerBoundNs), to when input k reached us. The client handles packets after a frame's ticks (Minecraft::update 0x108ca1f94), so that reply was handled in an earlier frame. Not covered: the clocks drifting apart over a few seconds, and a client that handles packets out of order.

  • Constructor Details

    • FollowerEnvelope

      public FollowerEnvelope(long nowNs, float x, float y, float z, float yaw)
  • Method Details

    • reset

      public void reset(long nowLowerNs, long nowNs, float x, float y, float z, float yaw)
    • addMove

      public void addMove(long sentNs, long replyNs, float x, float y, float z, float yaw, boolean onGround)
    • addMotion

      public void addMotion(long sentNs, long replyNs, boolean onGround)
    • tick

      public void tick(long nowLowerNs, long nowNs)
    • resync

      public void resync(long nowLowerNs, long nowNs)
      Boar skipped ticks for this vehicle (it was far from the player). Over those ticks the client blended its shown position towards targets on the entry line, or kept its old target. Every such blend lies in the box around: the old shown set, the old target, every entry since, and the target picked now. So the set stays a true limit.
    • resumeRemoteTick

      public void resumeRemoteTick(long nowLowerNs, long nowNs, float[] before, float[] after, boolean afterOnGround, float[] pendingTarget, int pendingSteps)
    • advanceForControl

      public void advanceForControl()
    • assumedNow

      public boolean assumedNow()
    • renderSet

      public PositionSet renderSet()
    • shownSet

      public PositionSet shownSet()
    • shownYaw

      public FollowerEnvelope.YawRange shownYaw()