Skip to content

gitflarePublicPartly agent-ready40

neon-drift

Real-time multiplayer arcade racer on Cloudflare Workers and Durable Objects.

main
Add the Apache-2.0 licence3efe3da
JavaScript21 lines733 B
import test from 'node:test';import assert from 'node:assert/strict';import { createState, addPlayer, step } from '../public/shared/sim.js';import { makeSnapshot, encodeSnapshot } from '../public/shared/protocol.js'; test('full match with 16 inert players and zero-radius arena terminates', () => {  const st = createState(5, {});  for (let i = 1; i <= 16; i++) addPlayer(st, i, 'p' + i);  const t0 = Date.now();  let prev = null;  for (let i = 0; i < 30 * 200; i++) {    if (i === 100) st.radius = 0;    if (i === 200) st.radius = NaN;    step(st, new Map(), 1 / 30);    const snap = makeSnapshot(st);    encodeSnapshot(i % 60 === 0 ? null : prev, snap);    prev = snap;  }  assert.ok(Date.now() - t0 < 20000);});