Back to Supersonic RC Revive
SOURCE / PINNED RELEASE

Made of little things.

Supersonic RC Revive

Release
372375d18e3f…
Author-recorded commit
6fbf09f88a0a…
License
LICENSE
Author’s source reference
nostr://npub1ye5ptcxfyyxl5vjvdjar2ua3f0hynkjzpx552mu5snj3qmx5pzjscpknpr/wss%3A%2F%2Fgit.napplet.soy%2F/n-143146b0d6f

Archive hash verified: 76e4eb30c67a6f45…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

tools/sim/drive.mjs
#!/usr/bin/env node
// Headless test drive of the physics port against the extracted level data.
//   node tools/sim/drive.mjs [script]
// script: comma list of "<keys>:<seconds>", keys from u d l r s (space) or -
// e.g. "u:3,ul:2,-:1". Prints car state every 0.25 s of real time.
// SIM_LEVEL=custom drives the custom bundle (src/game/assets-custom) instead of
// the extracted originals.
import { readFileSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { createServer } from 'vite';

const root = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
const game = resolve(root, process.env.SIM_LEVEL === 'custom' ? 'src/game/assets-custom' : 'ref-out/game');
const server = await createServer({ root, logLevel: 'error', server: { middlewareMode: true }, appType: 'custom', optimizeDeps: { noDiscovery: true, entries: [] } });
try {
  const { runDrive } = await server.ssrLoadModule('/src/game/sim/headless.ts');
  const level = {
    markers: JSON.parse(readFileSync(resolve(game, 'markers.json'), 'utf8')),
    collision: JSON.parse(readFileSync(resolve(game, 'collision.json'), 'utf8')),
    // Copy out: small files come back as views into Node's shared buffer pool.
    rayMeshBuffer: new Uint8Array(readFileSync(resolve(game, 'raymesh.bin'))).buffer,
  };
  await runDrive(level, process.argv[2] ?? 'u:4,ul:2,u:2,-:2', process.argv[3] ? JSON.parse(process.argv[3]) : {}, Number(process.env.SIM_DT ?? 0.25));
} finally {
  await server.close();
}