Back to Supersonic RC Revive
SOURCE / PINNED RELEASE

Made of little things.

Supersonic RC Revive

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

Archive hash verified: 90d22b206672eba4…. 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; any other SIM_LEVEL is a level folder or level .glb.
import { existsSync, 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' : (process.env.SIM_LEVEL ?? 'ref-out/game'));
/** The level: a Blender level GLB, or a folder of legacy files (or holding only level.glb). */
function readLevel(path) {
  const bytes = (file) => new Uint8Array(readFileSync(file)).buffer; // copy out of Node's shared pool
  if (path.endsWith('.glb')) return { levelGlb: bytes(path) };
  if (!existsSync(resolve(path, 'collision.json'))) return { levelGlb: bytes(resolve(path, 'level.glb')) };
  return {
    markers: JSON.parse(readFileSync(resolve(path, 'markers.json'), 'utf8')),
    collision: JSON.parse(readFileSync(resolve(path, 'collision.json'), 'utf8')),
    rayMeshBuffer: bytes(resolve(path, 'raymesh.bin')),
  };
}
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 = readLevel(game);
  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();
}