Click a world to give it the keyboard
\n\n"; const q = new URLSearchParams(location.search); const n = Math.max(1, Math.min(9, parseInt(q.get('n'), 10) || 4)); /* Every world runs a full simulation, and they all share one GPU, so the tier has to come down as the count goes up: nine at the four-up's settings would ask nine times the simulation work of a single instance. Override with ?q= if the machine has room. */ const tier = q.get('q') || (n <= 2 ? 'med' : n <= 4 ? 'low' : 'tiny'); const base = parseInt(q.get('seed'), 10) || Math.floor(Math.random() * 1e6); const cols = n <= 2 ? n : (n <= 6 ? 2 : 3); const rows = Math.ceil(n / cols); const grid = document.getElementById('grid'); grid.style.gridTemplateColumns = 'repeat(' + cols + ', 1fr)'; grid.style.gridTemplateRows = 'repeat(' + rows + ', 1fr)'; // ?gap= sets the mount, in pixels. 0 butts the worlds together as before. const gap = Math.max(0, Math.min(80, q.get('gap') === null ? (n > 4 ? 7 : 10) : parseInt(q.get('gap'), 10) || 0)); if (n > 4) document.body.classList.add('dense'); grid.style.gap = gap + 'px'; grid.style.padding = gap + 'px'; /* Brought up one at a time. Nine WebGL contexts asking the driver for their render targets in the same instant is a memory spike, and the browser answers it by dropping one — which is exactly what happened on the first nine-up. Staggering costs a few seconds at startup and nothing after. */ function makeCell(i) { const cfg = 'q=' + encodeURIComponent(tier) + '&seed=' + (base + i * 7919) + '&ui=min' + // one soundtrack, not four (i === 0 ? '' : '&mute=1'); const cell = document.createElement('div'); cell.className = 'cell'; grid.appendChild(cell); const f = document.createElement('iframe'); f.srcdoc = ART.replace('', '