Compare commits
3 commits
1883a1aabe
...
99d4982979
| Author | SHA1 | Date | |
|---|---|---|---|
| 99d4982979 | |||
| e343a81c4a | |||
| d15beb8e35 |
4 changed files with 64 additions and 12 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
|
@ -1,5 +1,19 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# v0.12.16
|
||||||
|
|
||||||
|
Bomperator matches on the live arena feel steady again, and the arena reads more clearly at a glance.
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
- **Bomperator.** Power-ups on the field are labeled with their names, and the loadout row is centered under the arena.
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
- **Bomperator.** Movement no longer stutters or snaps back mid-match. The client's correction window now accounts for the server's tick queue instead of raw network ping, and any correction that remains glides at run speed instead of jumping in a single frame.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# v0.12.15
|
# v0.12.15
|
||||||
|
|
||||||
Experience totals now display as whole numbers everywhere.
|
Experience totals now display as whole numbers everywhere.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "polaris-task-force",
|
"name": "polaris-task-force",
|
||||||
"version": "0.12.15",
|
"version": "0.12.16",
|
||||||
"description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.",
|
"description": "Web app for the Arma 3 unit Polaris Task Force. Uses Next.js for client- and server-side rendering, with a Postgres database and some other neat libraries.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
|
|
@ -455,6 +455,16 @@ export function BomperatorGame({
|
||||||
const lastAckedDirRef = useRef<Dir | null>(null);
|
const lastAckedDirRef = useRef<Dir | null>(null);
|
||||||
const lastVersionSeenRef = useRef(-1);
|
const lastVersionSeenRef = useRef(-1);
|
||||||
const rttAvgRef = useRef(100);
|
const rttAvgRef = useRef(100);
|
||||||
|
/**
|
||||||
|
* Input-to-ack latency EMA: measured from send time until the server's
|
||||||
|
* snapshot confirms the input. Unlike the transport RTT (ping/pong on WS,
|
||||||
|
* POST timing on HTTP), it includes the server tick queue and snapshot
|
||||||
|
* turnaround - the full loop delay prediction must tolerate. The envelope
|
||||||
|
* sizes itself from this; production telemetry showed ping-only RTT (3-24ms)
|
||||||
|
* shrinking the envelope below the natural gap noise floor, so ~13% of
|
||||||
|
* snapshots trimmed and each trim read as a micro-teleport.
|
||||||
|
*/
|
||||||
|
const ackLatRef = useRef(100);
|
||||||
const dbgRef = useRef<{ ring: DbgRow[]; lastAt: number; remoteSnaps: number; lastRs: number } | null>(
|
const dbgRef = useRef<{ ring: DbgRow[]; lastAt: number; remoteSnaps: number; lastRs: number } | null>(
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
@ -774,6 +784,9 @@ export function BomperatorGame({
|
||||||
while (pending.length > 0) {
|
while (pending.length > 0) {
|
||||||
const head = pending[0];
|
const head = pending[0];
|
||||||
if (!head || head.seq > ack) break;
|
if (!head || head.seq > ack) break;
|
||||||
|
// Sample input-to-ack latency for the envelope (see ackLatRef).
|
||||||
|
const lat = now - head.sentAt;
|
||||||
|
if (lat > 0 && lat < 2000) ackLatRef.current = ackLatRef.current * 0.8 + lat * 0.2;
|
||||||
ackedDir = head.dir;
|
ackedDir = head.dir;
|
||||||
pending.shift();
|
pending.shift();
|
||||||
}
|
}
|
||||||
|
|
@ -820,16 +833,23 @@ export function BomperatorGame({
|
||||||
// unattended past the snap threshold and discharged as the
|
// unattended past the snap threshold and discharged as the
|
||||||
// reported "teleported back to where the server saw me". Now:
|
// reported "teleported back to where the server saw me". Now:
|
||||||
// gaps inside the envelope ride untouched, anything beyond is
|
// gaps inside the envelope ride untouched, anything beyond is
|
||||||
// trimmed a little on EVERY snapshot, and even large gaps close
|
// trimmed toward the envelope on EVERY snapshot, and even large
|
||||||
// at a capped rate (2.5x run speed) instead of teleporting.
|
// gaps close at a capped rate (2.5x run speed) instead of
|
||||||
// Verified against the recorded production latency trace plus
|
// teleporting. Verified against the recorded production latency
|
||||||
// server-stall replay in tests/int/bomperator-prediction.int.
|
// trace plus server-stall replay in tests/int/bomperator-prediction.
|
||||||
// spec.ts: zero corrections over 1.5 cells (old policy: instant
|
// int.spec.ts. Round resets still snap via the ack-backwards branch.
|
||||||
// 2.6-cell jumps). Round resets still snap via the ack-backwards
|
// Sizing uses transport RTT plus the SERVER-SIDE component of
|
||||||
// branch.
|
// the measured input-to-ack loop (tick queue + snapshot
|
||||||
|
// turnaround), which ping/pong RTT does not see: prod telemetry
|
||||||
|
// over the WS arena showed ping RTT (3-24ms) understating the
|
||||||
|
// real input->effect delay, so the envelope sat below the
|
||||||
|
// natural gap noise floor (p95 1.0 cells) and every held run
|
||||||
|
// trimmed visibly. On HTTP the ack loop minus POST RTT is just
|
||||||
|
// the snapshot wait, so this stays near the v0.12.6 tuning.
|
||||||
|
const rttEnv = Math.min(300, Math.max(rtt, ackLatRef.current - rtt));
|
||||||
const envelope = Math.max(
|
const envelope = Math.max(
|
||||||
PRED_DEADZONE,
|
PRED_DEADZONE,
|
||||||
(me.speed * (rtt / 2 + TICK_MS / 2 + PRED_ENVELOPE_BUDGET_MS)) / 1000,
|
(me.speed * (rttEnv / 2 + TICK_MS / 2 + PRED_ENVELOPE_BUDGET_MS)) / 1000,
|
||||||
);
|
);
|
||||||
if (gap > 2.5) {
|
if (gap > 2.5) {
|
||||||
const maxStep = (me.speed * 2.5 * dtMs) / 1000;
|
const maxStep = (me.speed * 2.5 * dtMs) / 1000;
|
||||||
|
|
@ -838,7 +858,14 @@ export function BomperatorGame({
|
||||||
pred.y += (est.y - pred.y) * easeT;
|
pred.y += (est.y - pred.y) * easeT;
|
||||||
facingRef.current = facing;
|
facingRef.current = facing;
|
||||||
} else if (gap > envelope) {
|
} else if (gap > envelope) {
|
||||||
const k = Math.min(gap - envelope, gap * 0.5) / gap;
|
// Rate-limited trim: close at most 0.35 cells per snapshot
|
||||||
|
// (~7 cells/s at 20Hz, i.e. a run-speed glide, not a jump).
|
||||||
|
// The old policy closed the whole excess in one frame; once
|
||||||
|
// trims got frequent on the WS arena that read as constant
|
||||||
|
// micro-teleports (the reported jitter), and slower
|
||||||
|
// proportional convergence let sustained divergence stack
|
||||||
|
// past the ease threshold in trace replay.
|
||||||
|
const k = Math.min(gap - envelope, 0.35) / gap;
|
||||||
pred.x += (est.x - pred.x) * k;
|
pred.x += (est.x - pred.x) * k;
|
||||||
pred.y += (est.y - pred.y) * k;
|
pred.y += (est.y - pred.y) * k;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,9 @@ function runScenario(cfg: ScenarioConfig): Telemetry {
|
||||||
let lastAck = 0;
|
let lastAck = 0;
|
||||||
let lastAckedDir: Dir | null = null;
|
let lastAckedDir: Dir | null = null;
|
||||||
let rttAvg = cfg.rttTrueMs;
|
let rttAvg = cfg.rttTrueMs;
|
||||||
|
// Mirror of ackLatRef: input-to-ack latency EMA (includes the tick queue
|
||||||
|
// and snapshot turnaround); sizes the correction envelope.
|
||||||
|
let ackLat = cfg.rttTrueMs;
|
||||||
let clientView: SimSnapshot | null = null;
|
let clientView: SimSnapshot | null = null;
|
||||||
let lastVersionSeen = -1;
|
let lastVersionSeen = -1;
|
||||||
let seqCounter = 0;
|
let seqCounter = 0;
|
||||||
|
|
@ -520,6 +523,8 @@ function runScenario(cfg: ScenarioConfig): Telemetry {
|
||||||
while (pending.length > 0) {
|
while (pending.length > 0) {
|
||||||
const head = pending[0];
|
const head = pending[0];
|
||||||
if (!head || head.seq > ack) break;
|
if (!head || head.seq > ack) break;
|
||||||
|
const lat = now - head.sentAt;
|
||||||
|
if (lat > 0 && lat < 2000) ackLat = ackLat * 0.8 + lat * 0.2;
|
||||||
ackedDir = head.dir;
|
ackedDir = head.dir;
|
||||||
pending.shift();
|
pending.shift();
|
||||||
}
|
}
|
||||||
|
|
@ -554,9 +559,10 @@ function runScenario(cfg: ScenarioConfig): Telemetry {
|
||||||
// lead, tick quantization, estimator error) ride inside the envelope
|
// lead, tick quantization, estimator error) ride inside the envelope
|
||||||
// untouched; anything beyond is genuine divergence, corrected a little
|
// untouched; anything beyond is genuine divergence, corrected a little
|
||||||
// on EVERY snapshot so offsets can never stack into a teleport.
|
// on EVERY snapshot so offsets can never stack into a teleport.
|
||||||
|
const rttEnv = Math.min(300, Math.max(rttAvg, ackLat - rttAvg));
|
||||||
const envelope = Math.max(
|
const envelope = Math.max(
|
||||||
PRED_DEADZONE,
|
PRED_DEADZONE,
|
||||||
(me.speed * (rttAvg / 2 + TICK_MS / 2 + PRED_ENVELOPE_BUDGET_MS)) / 1000,
|
(me.speed * (rttEnv / 2 + TICK_MS / 2 + PRED_ENVELOPE_BUDGET_MS)) / 1000,
|
||||||
);
|
);
|
||||||
const predBefore = { x: pred.x, y: pred.y };
|
const predBefore = { x: pred.x, y: pred.y };
|
||||||
if (gap > 2.5) {
|
if (gap > 2.5) {
|
||||||
|
|
@ -589,7 +595,12 @@ function runScenario(cfg: ScenarioConfig): Telemetry {
|
||||||
: gap > envelope
|
: gap > envelope
|
||||||
) {
|
) {
|
||||||
const floor = cfg.policy === "v123" ? PRED_DEADZONE : envelope;
|
const floor = cfg.policy === "v123" ? PRED_DEADZONE : envelope;
|
||||||
const k = Math.min(gap - floor, gap * 0.5) / gap;
|
// v123: instant close to floor. Envelope policy: rate-limited trim
|
||||||
|
// (max 0.35 cells per snapshot, a glide not a jump).
|
||||||
|
const k =
|
||||||
|
cfg.policy === "v123"
|
||||||
|
? Math.min(gap - floor, gap * 0.5) / gap
|
||||||
|
: Math.min(gap - floor, 0.35) / gap;
|
||||||
pred.x += (est.x - pred.x) * k;
|
pred.x += (est.x - pred.x) * k;
|
||||||
pred.y += (est.y - pred.y) * k;
|
pred.y += (est.y - pred.y) * k;
|
||||||
tel.pulls += 1;
|
tel.pulls += 1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue