diff --git a/src/lib/cannons.mjs b/src/lib/cannons.mjs index d367412..e16d76c 100644 --- a/src/lib/cannons.mjs +++ b/src/lib/cannons.mjs @@ -32,3 +32,9 @@ export function loadCannons() { // $uri/index.html` would then have a file and a directory competing for the // same URL. Exactly why the notebook exports are at /nb/ and not /notebooks/. export const cannonsFrameUrl = '/cn/embedded.html'; + +// Attract mode: the same page, told to play scripted scenes instead of +// connecting. It costs the client (classes.js) and nothing else -- no +// WebSocket, and crucially not the WebAssembly server, which is an order of +// magnitude larger and still waits for the click. +export const cannonsDemoUrl = '/cn/embedded.html?demo=1'; diff --git a/src/pages/cannons.astro b/src/pages/cannons.astro index 50e19f6..cecf513 100644 --- a/src/pages/cannons.astro +++ b/src/pages/cannons.astro @@ -1,6 +1,6 @@ --- import Base from '../layouts/Base.astro'; -import { loadCannons, cannonsFrameUrl } from '../lib/cannons.mjs'; +import { loadCannons, cannonsFrameUrl, cannonsDemoUrl } from '../lib/cannons.mjs'; const build = loadCannons(); const mb = (n) => (n / 1048576).toFixed(1); @@ -46,9 +46,27 @@ const overTheWire = build ? mb(build.wireBytes) : null; computer opponent takes the other seat.

+

+ The battle below the button is a demo, and it has no server at all: the + client’s packet handlers are ordinary methods, so a scene is just a script + of the packets a real match would have sent, fed straight in. Which is why + it can show you eight cannons opening with ICBMs at once — a thing no + actual match can produce, because the computer opponents cannot aim a + guided weapon. +

+ { build ? (
+ {/* Rendered here rather than created in the script, so Astro's scoped + styles actually reach it -- see the note on .cn-frame below. It + starts on the demo, which needs the client but no server. */} +
) : (

@@ -78,10 +92,10 @@ const overTheWire = build ? mb(build.wireBytes) : null;