Compare commits
6 commits
3bf9de4848
...
1eafce4df9
| Author | SHA1 | Date | |
|---|---|---|---|
| 1eafce4df9 | |||
| fe4e7cc5fb | |||
| 76c01d2f3c | |||
| d0d2ea0bd2 | |||
| 612b6d93df | |||
| 99e610e955 |
7 changed files with 151 additions and 25 deletions
28
CHANGELOG.md
28
CHANGELOG.md
|
|
@ -1,5 +1,33 @@
|
|||
# Changelog
|
||||
|
||||
# v0.12.3
|
||||
|
||||
The Ordnance Disposal battlefield now comes alive at twice the speed: rival movement, blasts, and pickups all land with half the delay.
|
||||
|
||||
### Improvements
|
||||
|
||||
- **Ordnance Disposal.** The depot simulation updates twice as often, so opponents glide more smoothly, explosions and pickups appear sooner, and the whole match reads closer to real time.
|
||||
|
||||
### Fixes
|
||||
|
||||
- Various bug fixes and improvements.
|
||||
|
||||
---
|
||||
|
||||
# v0.12.2
|
||||
|
||||
Ordnance Disposal controls tighten up further: charges appear the instant you drop them, and movement shakes off the last of the heaviness.
|
||||
|
||||
### Improvements
|
||||
|
||||
- **Ordnance Disposal.** A dropped charge now appears under your technician the moment you press, instead of waiting on the server. Turning and stopping mid-run feel cleaner, with the faint tug-of-war from the last update gone.
|
||||
|
||||
### Fixes
|
||||
|
||||
- Various bug fixes and improvements.
|
||||
|
||||
---
|
||||
|
||||
# v0.12.1
|
||||
|
||||
Ordnance Disposal is far more responsive: your technician now answers the keyboard instantly.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polaris-task-force",
|
||||
"version": "0.12.1",
|
||||
"version": "0.12.3",
|
||||
"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",
|
||||
"type": "module",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { Eye, Flag, Play, Radio, Users } from "lucide-react";
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import type { BomperatorView, Dir, PlayerView } from "@/lib/minigames/bomperator/types";
|
||||
import { GRID_H, GRID_W, MAX_SEATS, MIN_TO_START, TICK_MS, TICKS_PER_SECOND } from "@/lib/minigames/bomperator/constants";
|
||||
import { BOMB_FUSE_TICKS, FLAME_LIFETIME_TICKS, GRID_H, GRID_W, MAX_SEATS, MIN_TO_START, TICK_MS, TICKS_PER_SECOND } from "@/lib/minigames/bomperator/constants";
|
||||
import { sendBomperatorInput } from "@/app/(frontend)/minigames/bomperator/actions";
|
||||
import { BomperatorHud, seatColor } from "./BomperatorHud";
|
||||
import { useBomperatorSounds } from "./sounds";
|
||||
|
|
@ -54,8 +54,18 @@ interface PredictBomb {
|
|||
id: string;
|
||||
x: number;
|
||||
y: number;
|
||||
/** Optimistic local charge the server has not confirmed yet. Blocks movement
|
||||
* like a real one but cannot be kick-pushed (the server has not placed it). */
|
||||
ghost?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correction deadzone in cells. Gaps explainable by input flight time or
|
||||
* snapshot-projection bias live inside this band; pulling on them is what made
|
||||
* movement feel heavy, so they are left alone.
|
||||
*/
|
||||
const PRED_DEADZONE = 0.4;
|
||||
|
||||
function predCellCentered(x: number, y: number): boolean {
|
||||
return Math.abs(x - Math.round(x)) < PRED_EPS && Math.abs(y - Math.round(y)) < PRED_EPS;
|
||||
}
|
||||
|
|
@ -108,7 +118,7 @@ function predStep(
|
|||
const home = dx > 0 ? Math.floor(x + PRED_EPS) : Math.ceil(x - PRED_EPS);
|
||||
const bomb = predBombAt(bombs, entering, cy);
|
||||
if (bomb) {
|
||||
if (kick) {
|
||||
if (kick && !bomb.ghost) {
|
||||
const bx = entering + dx;
|
||||
if (predOpen(grid, bx, cy) && !predBombAt(bombs, bx, cy)) {
|
||||
bomb.x = bx;
|
||||
|
|
@ -132,7 +142,7 @@ function predStep(
|
|||
const home = dy > 0 ? Math.floor(y + PRED_EPS) : Math.ceil(y - PRED_EPS);
|
||||
const bomb = predBombAt(bombs, cx, entering);
|
||||
if (bomb) {
|
||||
if (kick) {
|
||||
if (kick && !bomb.ghost) {
|
||||
const by = entering + dy;
|
||||
if (predOpen(grid, cx, by) && !predBombAt(bombs, cx, by)) {
|
||||
bomb.x = cx;
|
||||
|
|
@ -259,8 +269,8 @@ function drawBomb(ctx: CanvasRenderingContext2D, x: number, y: number, fuseTicks
|
|||
ctx.strokeStyle = "#475569";
|
||||
ctx.lineWidth = 1.5;
|
||||
ctx.stroke();
|
||||
// Blinking spark: faster as the fuse burns down.
|
||||
const blink = fuseTicks <= 6 ? Math.floor(t / 90) % 2 === 0 : Math.floor(t / 260) % 2 === 0;
|
||||
// Blinking spark: faster over the last quarter of the fuse.
|
||||
const blink = fuseTicks <= BOMB_FUSE_TICKS / 4 ? Math.floor(t / 90) % 2 === 0 : Math.floor(t / 260) % 2 === 0;
|
||||
if (blink) {
|
||||
ctx.fillStyle = "#fbbf24";
|
||||
ctx.beginPath();
|
||||
|
|
@ -273,7 +283,7 @@ function drawFlame(ctx: CanvasRenderingContext2D, x: number, y: number, ticksLef
|
|||
const px = x * CELL;
|
||||
const py = y * CELL;
|
||||
const flicker = 0.55 + 0.35 * Math.abs(Math.sin(t / 80 + x * 2 + y));
|
||||
ctx.globalAlpha = Math.min(1, ticksLeft / 3 + 0.2) * flicker;
|
||||
ctx.globalAlpha = Math.min(1, ticksLeft / FLAME_LIFETIME_TICKS + 0.2) * flicker;
|
||||
const grad = ctx.createRadialGradient(px + CELL / 2, py + CELL / 2, 2, px + CELL / 2, py + CELL / 2, CELL * 0.7);
|
||||
grad.addColorStop(0, "#fde68a");
|
||||
grad.addColorStop(0.5, "#fb923c");
|
||||
|
|
@ -365,6 +375,8 @@ export function BomperatorGame({
|
|||
const inputSeqRef = useRef(0);
|
||||
const pendingRef = useRef<Array<{ seq: number; dir: Dir | null; sentAt: number }>>([]);
|
||||
const pushOverlayRef = useRef<Map<string, { x: number; y: number; at: number }>>(new Map());
|
||||
const ghostBombsRef = useRef<Array<{ x: number; y: number; placedAt: number }>>([]);
|
||||
const knownBombIdsRef = useRef<Set<string>>(new Set());
|
||||
const lastAckRef = useRef(0);
|
||||
const lastAckedDirRef = useRef<Dir | null>(null);
|
||||
const lastVersionSeenRef = useRef(-1);
|
||||
|
|
@ -386,6 +398,35 @@ export function BomperatorGame({
|
|||
|
||||
const sendDrop = useCallback(async () => {
|
||||
playPlace();
|
||||
// Optimistic placement: the ghost charge appears at our cell the same instant
|
||||
// space goes down. The server places the real one about one round trip later
|
||||
// at its own (slightly trailing) position; the snapshot that shows our fresh
|
||||
// bomb retires the ghost. Every server rejection rule is mirrored here
|
||||
// against our freshest state, so a ghost almost never expires unfulfilled.
|
||||
const view = matchRef.current;
|
||||
const seat = view.yourSeat;
|
||||
const me = seat !== null ? (view.players[seat] ?? null) : null;
|
||||
if (view.phase === "battle" && me && me.alive) {
|
||||
const at = predRef.current ?? { x: me.x, y: me.y };
|
||||
const cx = Math.round(at.x);
|
||||
const cy = Math.round(at.y);
|
||||
const ghosts = ghostBombsRef.current;
|
||||
const overlay = pushOverlayRef.current;
|
||||
const cellTaken =
|
||||
cx < 0 ||
|
||||
cy < 0 ||
|
||||
cx >= GRID_W ||
|
||||
cy >= GRID_H ||
|
||||
view.grid[cy * GRID_W + cx] !== 0 ||
|
||||
view.bombs.some((b) => {
|
||||
const to = overlay.get(b.id);
|
||||
return (b.x === cx && b.y === cy) || (to !== undefined && to.x === cx && to.y === cy);
|
||||
}) ||
|
||||
ghosts.some((g) => g.x === cx && g.y === cy);
|
||||
if (!cellTaken && me.bombsActive + ghosts.length < me.bombsMax && ghosts.length < 4) {
|
||||
ghosts.push({ x: cx, y: cy, placedAt: performance.now() });
|
||||
}
|
||||
}
|
||||
try {
|
||||
await sendBomperatorInput(match.matchId, { drop: true });
|
||||
} catch {
|
||||
|
|
@ -497,6 +538,9 @@ export function BomperatorGame({
|
|||
const to = overlay.get(b.id);
|
||||
return { id: b.id, x: to?.x ?? b.x, y: to?.y ?? b.y };
|
||||
});
|
||||
for (const g of ghostBombsRef.current) {
|
||||
bombsWorking.push({ id: `ghost:${g.placedAt}`, x: g.x, y: g.y, ghost: true });
|
||||
}
|
||||
|
||||
/* -- local prediction: our own technician answers the keyboard immediately -- */
|
||||
if (view.phase === "battle" && me && me.alive) {
|
||||
|
|
@ -524,6 +568,7 @@ export function BomperatorGame({
|
|||
predRef.current = null;
|
||||
pendingRef.current = [];
|
||||
overlay.clear();
|
||||
ghostBombsRef.current = [];
|
||||
}
|
||||
|
||||
/* -- reconcile against the server once per fresh snapshot -- */
|
||||
|
|
@ -589,14 +634,49 @@ export function BomperatorGame({
|
|||
// Teleport/respawn: snap instead of sliding across the map.
|
||||
predRef.current = est;
|
||||
facingRef.current = facing;
|
||||
} else if (gap > 1e-4) {
|
||||
// Soft correction: prediction error decays smoothly, no snap-back.
|
||||
pred.x += (est.x - pred.x) * 0.2;
|
||||
pred.y += (est.y - pred.y) * 0.2;
|
||||
} else if (pending.length === 0 && gap > PRED_DEADZONE) {
|
||||
// Correct only once EVERY sent input is acknowledged. While
|
||||
// inputs are in flight the server legitimately trails the local
|
||||
// sim (it has not seen the latest keys yet), so pulling toward
|
||||
// it then drags the sprite backwards on every turn and key
|
||||
// release; that drag is what made movement feel heavy. With
|
||||
// everything acked, a gap beyond the deadzone is a genuine
|
||||
// disagreement (a charge or wall the local sim missed), so
|
||||
// close it firmly, leaving the deadzone band itself alone.
|
||||
const k = Math.min(gap - PRED_DEADZONE, gap * 0.5) / gap;
|
||||
pred.x += (est.x - pred.x) * k;
|
||||
pred.y += (est.y - pred.y) * k;
|
||||
}
|
||||
}
|
||||
}
|
||||
lastAckRef.current = ack;
|
||||
|
||||
// Reconcile optimistic ghost charges. The server placed our drop when
|
||||
// a bomb we have not seen before shows up owned by our seat (it may
|
||||
// sit a cell away from the ghost: the server trails our displayed
|
||||
// position), or when anything occupies the ghost's cell. A ghost
|
||||
// still unmatched past the round-trip budget expired because the
|
||||
// server rejected the placement; retire it silently.
|
||||
const ghosts = ghostBombsRef.current;
|
||||
if (ghosts.length > 0) {
|
||||
let freshOwn = 0;
|
||||
for (const b of view.bombs) {
|
||||
if (b.ownerSeat === me.seat && !knownBombIdsRef.current.has(b.id)) freshOwn += 1;
|
||||
}
|
||||
for (let i = ghosts.length - 1; i >= 0; i -= 1) {
|
||||
const g = ghosts[i];
|
||||
const cellTaken = view.bombs.some((b) => b.x === g.x && b.y === g.y);
|
||||
if (cellTaken) {
|
||||
ghosts.splice(i, 1);
|
||||
} else if (freshOwn > 0) {
|
||||
freshOwn -= 1;
|
||||
ghosts.splice(i, 1);
|
||||
} else if (now - g.placedAt > 1200) {
|
||||
ghosts.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
knownBombIdsRef.current = new Set(view.bombs.map((b) => b.id));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -634,6 +714,12 @@ export function BomperatorGame({
|
|||
const w = bombsWorking.find((wb) => wb.id === bomb.id);
|
||||
drawBomb(ctx, w?.x ?? bomb.x, w?.y ?? bomb.y, bomb.fuseTicks, now);
|
||||
}
|
||||
// Ghost charges: optimistic placements awaiting server confirmation. The
|
||||
// fuse burns on the local clock so the blink cadence matches real ones.
|
||||
for (const g of ghostBombsRef.current) {
|
||||
const fuse = Math.max(0, BOMB_FUSE_TICKS - (now - g.placedAt) / TICK_MS);
|
||||
drawBomb(ctx, g.x, g.y, fuse, now);
|
||||
}
|
||||
for (const flame of view.flames) drawFlame(ctx, flame.x, flame.y, flame.ticksLeft, now);
|
||||
for (const player of view.players) {
|
||||
const isMe = mySeat !== null && player.seat === mySeat;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Five XP-earning minigames under one parent: routes live at `/minigames/*` (moved
|
|||
- **Flight Simulator**: `/minigames/flappy` (canvas game + leaderboard). **Minefield Clearance (EOD)**: `/minigames/eod`. **OPORD Recall**: `/minigames/opord` (`src/lib/minigames/opord-recall.ts`).
|
||||
- **Call for Fire (artillery observer)**: `/minigames/call-for-fire`, game rules in `src/lib/minigames/call-for-fire.ts` (patrol/checkpoint/compound difficulties, compass bearing observer reports, ADD/DROP + RIGHT/LEFT corrections, scoring/accuracy/XP, injected rng, pure). Components: `src/components/frontend/minigames/call-for-fire/` (`CallForFireArena`, `FireMissionBoard`, `CallForFireLeaderboard`). Action `submitCallForFireResult` validates result bounds, updates profile stats, awards XP + chips, emits `minigame:call-for-fire`, and records the ledger entry (accuracy is distance-to-target on a win, null on a loss).
|
||||
- **Call for Fire: Versus (multiplayer)**: `/minigames/call-for-fire-versus`, category `multiplayer` (out of periods). Pure engine in `src/lib/minigames/call-for-fire-versus/` (`engine.ts`, `views.ts`, `types.ts`, `constants.ts`; client-safe) plus a server-only in-memory match registry in `registry.ts` (mirrors `blackjack/tables.ts`: `globalThis`-anchored Map, lobby, per-turn timeout, expiry sweep, SINGLE-INSTANCE ONLY). Each player hides a FOB fleet, then alternates fire corrections (first shot is a grid designation, later shots adjust from the last impact). `views.ts` builds per-viewer snapshots that never serialize the opponent's fleet. Client polls `fetchVersusMatch` (the in-memory SSE bus is unreliable across dev module copies, same as blackjack). Rewards on completion via `stats.ts` (`minigame:call-for-fire-versus`, profile group `callForFireVersus`).
|
||||
- **Ordnance Disposal (multiplayer, real-time)**: `/minigames/bomperator` (internal key `bomperator`, label "Ordnance Disposal"), category `multiplayer` (out of periods), a 2-8 player free-for-all Bomberman-style charge-clearing drill. Same pure-engine + in-memory-registry split as CFF versus, but upgraded from turn-based to a **fixed ~10 Hz tick loop**: `src/lib/minigames/bomperator/{constants,types,engine,views}.ts` are pure/client-safe (seeded RNG via `state.rngState`/`gridSeed`; `generateGrid`, `createMatchState`, `startRound`, `applyInput`, `tick`), and `registry.ts` runs one `setInterval(TICK_MS)` per live match (started on `startMatch`, cleared on complete/dissolve; `globalThis.__bomperatorMatches`; SINGLE-INSTANCE ONLY: a restart/redeploy kills live matches). Grid is 15x13 (border + even/even pillars + seeded crates with one hidden power-up each; four classic pickups bomb/range/speed/kick). Movement is grid-locked with sub-cell interpolation; charges fuse ~2.5s, cross-flames stop at walls, destroy crates, chain-detonate, and kick-push; round ends at <=1 alive; sudden death spawns random-cell explosions after the 150s timer, with a draw guard. FFA has no hidden info so `buildBomperatorView` serves every viewer the same board (`yourSeat: null` = spectator). Clients POST inputs (`sendBomperatorInput`, rate-limited 20/s) and poll `fetchBomperatorMatch` (~150ms); a rolling event buffer (monotonic ids) drives client SFX without diffing. Disconnects hold the seat for `RECONNECT_WINDOW_MS` then eliminate; below two active seats the match dissolves. Rewards on completion via `stats.ts` (`minigame:bomperator`, profile group `bomperator`: matchesPlayed/matchWins/roundsWon/kills/xpEarned; XP win/loss base + per-kill bounty, chips auto-derived). Registry row ships `status: "upcoming"` (page renders `MinigameComingSoon` until an admin flips it active).
|
||||
- **Ordnance Disposal (multiplayer, real-time)**: `/minigames/bomperator` (internal key `bomperator`, label "Ordnance Disposal"), category `multiplayer` (out of periods), a 2-8 player free-for-all Bomberman-style charge-clearing drill. Same pure-engine + in-memory-registry split as CFF versus, but upgraded from turn-based to a **fixed ~20 Hz tick loop** (was ~10 Hz until v0.12.3; every tick-denominated constant doubles with the rate so real-world durations stay identical): `src/lib/minigames/bomperator/{constants,types,engine,views}.ts` are pure/client-safe (seeded RNG via `state.rngState`/`gridSeed`; `generateGrid`, `createMatchState`, `startRound`, `applyInput`, `tick`), and `registry.ts` runs one `setInterval(TICK_MS)` per live match (started on `startMatch`, cleared on complete/dissolve; `globalThis.__bomperatorMatches`; SINGLE-INSTANCE ONLY: a restart/redeploy kills live matches). Grid is 15x13 (border + even/even pillars + seeded crates with one hidden power-up each; four classic pickups bomb/range/speed/kick). Movement is grid-locked with sub-cell interpolation; charges fuse ~2.5s, cross-flames stop at walls, destroy crates, chain-detonate, and kick-push; round ends at <=1 alive; sudden death spawns random-cell explosions after the 150s timer, with a draw guard. FFA has no hidden info so `buildBomperatorView` serves every viewer the same board (`yourSeat: null` = spectator). Clients POST inputs (`sendBomperatorInput`, rate-limited 40/s) and poll `fetchBomperatorMatch` (~500ms fallback behind the SSE stream); a rolling event buffer (monotonic ids) drives client SFX without diffing. Disconnects hold the seat for `RECONNECT_WINDOW_MS` then eliminate; below two active seats the match dissolves. Rewards on completion via `stats.ts` (`minigame:bomperator`, profile group `bomperator`: matchesPlayed/matchWins/roundsWon/kills/xpEarned; XP win/loss base + per-kill bounty, chips auto-derived). Registry row ships `status: "upcoming"` (page renders `MinigameComingSoon` until an admin flips it active).
|
||||
- Leaderboards match active players by user id (not display name) — see commit 72715c4 if leaderboard queries look wrong.
|
||||
|
||||
## Periods, achievements & the game registry
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@
|
|||
|
||||
/* ------------------------------------------------------------------ timing */
|
||||
|
||||
/** Fixed simulation tick. ~10 Hz server-authoritative loop. */
|
||||
export const TICK_MS = 100;
|
||||
/** Fixed simulation tick. ~20 Hz server-authoritative loop (100ms pre-v0.12.3;
|
||||
* halved to freshen every snapshot-bound surface: opponents, explosions, drops). */
|
||||
export const TICK_MS = 50;
|
||||
/** Ticks per second, derived from TICK_MS. */
|
||||
export const TICKS_PER_SECOND = Math.round(1000 / TICK_MS);
|
||||
|
||||
|
|
@ -26,10 +27,10 @@ export const CRATE_DENSITY = 0.4;
|
|||
|
||||
/* ------------------------------------------------------------------- bombs */
|
||||
|
||||
/** Fuse length in ticks (~2.5s at 10 Hz). */
|
||||
export const BOMB_FUSE_TICKS = 25;
|
||||
/** How long a flame cell lingers after an explosion (ticks). */
|
||||
export const FLAME_LIFETIME_TICKS = 3;
|
||||
/** Fuse length in ticks (~2.5s at 20 Hz). */
|
||||
export const BOMB_FUSE_TICKS = 50;
|
||||
/** How long a flame cell lingers after an explosion (ticks, ~0.3s at 20 Hz). */
|
||||
export const FLAME_LIFETIME_TICKS = 6;
|
||||
|
||||
/** Starting loadout every technician begins each round with. */
|
||||
export const START_BOMBS = 1;
|
||||
|
|
@ -59,14 +60,14 @@ export const POWERUP_WEIGHTS: Record<"bomb" | "range" | "speed" | "kick", number
|
|||
export const ROUND_TIMER_S = 150;
|
||||
export const ROUND_TIMER_TICKS = ROUND_TIMER_S * TICKS_PER_SECOND;
|
||||
/** In sudden death, spawn a random-cell explosion every N ticks (~4s). */
|
||||
export const SUDDEN_DEATH_INTERVAL_TICKS = 40;
|
||||
export const SUDDEN_DEATH_INTERVAL_TICKS = 80;
|
||||
/** Countdown between rounds (seconds). */
|
||||
export const INTER_ROUND_COUNTDOWN_S = 3;
|
||||
export const INTER_ROUND_COUNTDOWN_TICKS = INTER_ROUND_COUNTDOWN_S * TICKS_PER_SECOND;
|
||||
/** Brief result hold at the end of a round before the next countdown. */
|
||||
export const ROUND_END_HOLD_TICKS = 3 * TICKS_PER_SECOND;
|
||||
/** Spawn protection so nobody dies the instant a round opens (ticks). */
|
||||
export const SPAWN_INVULNERABLE_TICKS = 10;
|
||||
/** Spawn protection so nobody dies the instant a round opens (ticks, ~1s at 20 Hz). */
|
||||
export const SPAWN_INVULNERABLE_TICKS = 20;
|
||||
/**
|
||||
* Draw guard: if sudden death runs this many explosions without reducing the
|
||||
* field to one technician, the round is called a draw rather than looping.
|
||||
|
|
|
|||
|
|
@ -435,7 +435,11 @@ function advancePlayer(
|
|||
|
||||
function approach(current: number, target: number, step: number): number {
|
||||
const delta = target - current;
|
||||
if (Math.abs(delta) <= step) return target;
|
||||
// EPS tolerance: multi-tick glides accrue float dust (e.g. 5.3 + 0.35 =
|
||||
// 5.6499999999999995), so the final step can land a hair past `step` from the
|
||||
// target; without this the player stops within 1e-15 of the center without
|
||||
// ever reaching it exactly.
|
||||
if (Math.abs(delta) <= step + 1e-6) return target;
|
||||
return current + Math.sign(delta) * step;
|
||||
}
|
||||
|
||||
|
|
@ -633,8 +637,15 @@ function tickBattle(state: BomperatorState): BomperatorState {
|
|||
if (!dir) continue;
|
||||
const cellsPerTick = (p.speed * TICK_MS) / 1000;
|
||||
const res = advancePlayer(state, { ...p, inputDir: dir }, ctx.bombs, cellsPerTick);
|
||||
p.x = res.x;
|
||||
p.y = res.y;
|
||||
if (isCellCentered(res.x, res.y)) {
|
||||
// Resting on a whole cell keeps bomb/flame rounding exact: snap away any
|
||||
// sub-EPS float residue accumulated over a multi-tick glide.
|
||||
p.x = Math.round(res.x);
|
||||
p.y = Math.round(res.y);
|
||||
} else {
|
||||
p.x = res.x;
|
||||
p.y = res.y;
|
||||
}
|
||||
if (p.inputDir) p.dir = p.inputDir;
|
||||
if (res.pushedBombId && res.pushedTo) {
|
||||
ctx.bombs = ctx.bombs.map((b) =>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* and a server restart or redeploy ends any live match.
|
||||
*
|
||||
* The pure engine (./engine, ./views) never touches timers or I/O. This wrapper
|
||||
* owns the fixed ~10 Hz tick loop, lobby membership, the disconnect/reconnect
|
||||
* owns the fixed ~20 Hz tick loop, lobby membership, the disconnect/reconnect
|
||||
* window, completion rewards, and the idle-expiry sweep. Clients POST inputs and
|
||||
* poll snapshots; the in-memory SSE bus is used only for the profile-update nudge
|
||||
* after awards (it is unreliable across dev module copies, same as blackjack).
|
||||
|
|
|
|||
Loading…
Reference in a new issue