MRPGI/web/index.html
type-two e9cf00e686 THE MRPGI BOOK: deep combined user/dev manual, linked from the live menus
- web/manual.html — 17 chapters: playing, the editor deeply, the
  authoring cookbook (full JSON reference + the five load-bearing
  puzzle patterns), dialogue trees, flags, the art pipeline with
  sprite-generation prompts, sound, driving the engine with code
  (real JSONL transcripts), AIs + MCP, prompt patterns with actual
  outputs (the roof room is the real shipped expansion), the web
  build & cloud saves, engine internals, extension recipes,
  troubleshooting, and full command/event/palette reference.
- Game menu gains "Manual": window.open on the web (via a JS plugin
  import), the default browser natively.
- README tab links the Book; repo README points at it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 11:49:24 +10:00

232 lines
10 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MRPGI — Monster Robot Party Game Interpreter</title>
<meta name="description" content="A new-school reimagining of Sierra's AGI adventure engine. Play The DJ's Lost Fuse in your browser.">
<style>
html, body { margin: 0; padding: 0; height: 100%; background: #0b0d11; overflow: hidden; }
canvas {
position: absolute; inset: 0;
width: 100%; height: 100%;
image-rendering: pixelated;
background: #0b0d11;
}
#boot {
position: absolute; inset: 0; display: flex; flex-direction: column;
align-items: center; justify-content: center; gap: 12px;
color: #5fffd7; font-family: ui-monospace, Menlo, monospace; font-size: 14px;
pointer-events: none; transition: opacity .4s;
}
#boot b { font-size: 22px; letter-spacing: 2px; color: #ff87d7; }
#readme-tab {
position: fixed; top: 0; right: 24px; z-index: 10;
background: #ff87d7; color: #0b0d11; border: 0;
border-radius: 0 0 8px 8px; padding: 5px 14px 7px;
font: bold 13px ui-monospace, Menlo, monospace; letter-spacing: 1px;
cursor: pointer;
}
#account-tab {
position: fixed; top: 0; right: 110px; z-index: 10;
background: #5fffd7; color: #0b0d11; border: 0;
border-radius: 0 0 8px 8px; padding: 5px 14px 7px;
font: bold 13px ui-monospace, Menlo, monospace; letter-spacing: 1px;
cursor: pointer;
}
#account {
position: fixed; top: 34px; right: 100px; z-index: 10; display: none;
width: min(280px, calc(100vw - 24px));
background: #12151c; color: #cdd5e1; border: 1px solid #5fffd7; border-radius: 8px;
padding: 14px 16px; font: 13px/1.5 ui-monospace, Menlo, monospace;
}
#account.open { display: block; }
#account h1 { font-size: 15px; color: #5fffd7; margin: 0 0 8px; letter-spacing: 1px; }
#account input {
width: 100%; box-sizing: border-box; margin: 3px 0;
background: #1e232b; color: #fff; border: 1px solid #48505f; border-radius: 4px;
padding: 6px 8px; font: inherit;
}
#account button {
margin: 6px 6px 0 0; padding: 6px 12px;
background: #5fffd7; color: #0b0d11; border: 0; border-radius: 4px;
font: bold 12px ui-monospace, Menlo, monospace; cursor: pointer;
}
#account button.quiet { background: #2a3140; color: #cdd5e1; }
#account #acc-msg { margin-top: 8px; color: #ff87d7; min-height: 18px; }
#readme {
position: fixed; top: 34px; right: 12px; z-index: 10; display: none;
width: min(340px, calc(100vw - 24px)); max-height: 80vh; overflow-y: auto;
background: #12151c; color: #cdd5e1; border: 1px solid #ff87d7; border-radius: 8px;
padding: 14px 16px; font: 13px/1.5 ui-monospace, Menlo, monospace;
}
#readme.open { display: block; }
#readme h1 { font-size: 15px; color: #ff87d7; margin: 0 0 6px; letter-spacing: 1px; }
#readme h2 { font-size: 13px; color: #5fffd7; margin: 12px 0 2px; }
#readme p { margin: 4px 0; }
#readme kbd {
background: #1e232b; border: 1px solid #48505f; border-radius: 4px;
padding: 0 5px; font: inherit; color: #fff;
}
</style>
</head>
<body>
<div id="boot"><b>MRPGI</b><span>booting the party&hellip;</span></div>
<canvas id="glcanvas" tabindex="1"></canvas>
<button id="readme-tab">README</button>
<button id="account-tab">SIGN IN</button>
<div id="account">
<h1 id="acc-title">Sign in</h1>
<div id="acc-form">
<input id="acc-user" placeholder="username" autocomplete="username" maxlength="20">
<input id="acc-pass" placeholder="password" type="password" autocomplete="current-password" maxlength="100">
<button id="acc-login">Sign in</button>
<button id="acc-signup" class="quiet">Create account</button>
</div>
<div id="acc-actions" style="display:none">
<button id="acc-save">Save world</button>
<button id="acc-load" class="quiet">Load world</button>
<button id="acc-logout" class="quiet">Sign out</button>
</div>
<div id="acc-msg"></div>
</div>
<div id="readme">
<h1>MRPGI</h1>
<p>A new-school take on Sierra's 1980s AGI adventure engine (King's Quest,
Space Quest), rebuilt in Rust and running here as one small WASM file —
engine, paint tool, and the game <i>The DJ's Lost Fuse</i> included.</p>
<h2>Playing</h2>
<p><kbd>&larr;&uarr;&darr;&rarr;</kbd> or click to walk &middot; type verbs +
<kbd>Enter</kbd> (<i>look, take fuse, use amp, talk bouncer&hellip;</i>) &middot;
menus along the top, like the classics &middot; <kbd>1</kbd>&ndash;<kbd>6</kbd>
pick a dialogue reply &middot; <kbd>Esc</kbd> leaves a chat.</p>
<h2>Painting (press <kbd>Tab</kbd>)</h2>
<p>The in-engine room editor. <kbd>1</kbd>&ndash;<kbd>0</kbd> tools &middot;
<kbd>Z</kbd> undo (just Z &mdash; no Ctrl!) &middot; <kbd>L</kbd> cycles the
look/walkability view &middot; <kbd>[</kbd> <kbd>]</kbd> pick sprites &middot;
<kbd>,</kbd> <kbd>.</kbd> brush size. You paint two layers at once: a colour
<i>and</i> a meaning (floor / wall / water). Making a lake? Paint with the
<b>water</b> tag &mdash; today it's scenery with plans (the engine reserves it
for swimming, like the original).</p>
<p>Want to keep what you paint? Hit <b>SIGN IN</b> (top right), make a
name + password, and <b>Save world</b> / <b>Load world</b> keep your whole
project on the server between visits.</p>
<h2>Etc</h2>
<p><kbd>F1</kbd> CRT scanlines &middot; <kbd>F2</kbd> sound &middot; whole
thing is ~1&nbsp;MB &middot; also drivable headlessly by terminals, Python,
and AIs (it's an MCP server). Made by Monster Robot Party.</p>
<p><b><a href="manual.html" target="_blank">&rarr; THE MRPGI BOOK</a></b> &mdash;
the deep manual: authoring games as JSON, AI prompt patterns, driving the
engine from code, and the engine internals. Also under
<b>Game&nbsp;&rarr;&nbsp;Manual</b> in the menu bar.</p>
</div>
<script src="mq_js_bundle.js"></script>
<script>
// --- engine <-> page bridge (must register before the wasm loads) ------
let onWorldSaved = null;
miniquad_add_plugin({
register_plugin: (importObject) => {
importObject.env.mrpgi_world_saved = (ptr, len) => {
const json = new TextDecoder().decode(new Uint8Array(wasm_memory.buffer, ptr, len));
if (onWorldSaved) onWorldSaved(json);
};
importObject.env.mrpgi_open_manual = () => { window.open('manual.html', '_blank'); };
},
version: "1",
name: "mrpgi_bridge",
});
function sendWorldToEngine(json) {
const bytes = new TextEncoder().encode(json);
const ptr = wasm_exports.mrpgi_alloc(bytes.length);
new Uint8Array(wasm_memory.buffer, ptr, bytes.length).set(bytes);
wasm_exports.mrpgi_world_in(ptr, bytes.length);
}
load("mrpgi.wasm");
// hide the boot splash once the engine is drawing frames
const t = setInterval(() => {
if (typeof wasm_exports !== "undefined" && wasm_exports) {
document.getElementById("boot").style.opacity = "0";
clearInterval(t);
}
}, 250);
</script>
<script>
const canvas = document.getElementById('glcanvas');
const tab = document.getElementById('readme-tab');
const panel = document.getElementById('readme');
tab.addEventListener('click', () => {
panel.classList.toggle('open');
tab.textContent = panel.classList.contains('open') ? 'CLOSE' : 'README';
if (!panel.classList.contains('open')) canvas.focus();
});
// --- the front door -----------------------------------------------------
const $ = (id) => document.getElementById(id);
const accTab = $('account-tab'), acc = $('account');
const msg = (m) => { $('acc-msg').textContent = m || ''; };
const api = (path, opts = {}) => fetch('api/' + path, { credentials: 'same-origin', ...opts });
function setSignedIn(user) {
$('acc-form').style.display = user ? 'none' : 'block';
$('acc-actions').style.display = user ? 'block' : 'none';
$('acc-title').textContent = user ? ('hi, ' + user) : 'Sign in';
accTab.textContent = user ? user.toUpperCase() : 'SIGN IN';
}
accTab.addEventListener('click', () => {
acc.classList.toggle('open');
if (!acc.classList.contains('open')) { msg(''); canvas.focus(); }
});
async function auth(kind) {
const user = $('acc-user').value.trim(), pass = $('acc-pass').value;
if (!user || !pass) { msg('need a name and a password'); return; }
try {
const r = await api(kind, { method: 'POST', body: JSON.stringify({ user, pass }) });
const j = await r.json();
if (!r.ok) { msg(j.error || 'hmm, that did not work'); return; }
$('acc-pass').value = '';
setSignedIn(j.user);
msg(kind === 'signup' ? 'welcome! SAVE stores your painted world.' : 'welcome back.');
} catch { msg('server unreachable'); }
}
$('acc-login').addEventListener('click', () => auth('login'));
$('acc-signup').addEventListener('click', () => auth('signup'));
$('acc-pass').addEventListener('keydown', (e) => { if (e.key === 'Enter') auth('login'); });
$('acc-logout').addEventListener('click', async () => {
try { await api('logout', { method: 'POST' }); } catch {}
setSignedIn(null);
msg('signed out.');
});
$('acc-save').addEventListener('click', () => {
msg('packing world…');
onWorldSaved = async (json) => {
onWorldSaved = null;
try {
const r = await api('world', { method: 'PUT', body: json });
const j = await r.json();
msg(r.ok ? 'saved! (' + Math.round(json.length / 1024) + ' KB)' : (j.error || 'save failed'));
} catch { msg('server unreachable'); }
};
wasm_exports.mrpgi_request_save();
});
$('acc-load').addEventListener('click', async () => {
try {
const r = await api('world');
if (!r.ok) { msg((await r.json()).error || 'load failed'); return; }
sendWorldToEngine(await r.text());
msg('world loaded — go look!');
canvas.focus();
} catch { msg('server unreachable'); }
});
// restore an existing session on boot
api('me').then(async (r) => { if (r.ok) setSignedIn((await r.json()).user); }).catch(() => {});
</script>
</body>
</html>