Class FollowerEnvelope
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA range of yaws in degrees. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMotion(long sentNs, long replyNs, boolean onGround) voidaddMove(long sentNs, long replyNs, float x, float y, float z, float yaw, boolean onGround) voidbooleanvoidreset(long nowLowerNs, long nowNs, float x, float y, float z, float yaw) voidresumeRemoteTick(long nowLowerNs, long nowNs, float[] before, float[] after, boolean afterOnGround, float[] pendingTarget, int pendingSteps) voidresync(long nowLowerNs, long nowNs) Boar skipped ticks for this vehicle (it was far from the player).shownSet()shownYaw()voidtick(long nowLowerNs, long nowNs)
-
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
-
shownSet
-
shownYaw
-