META-GRID: TUTORIAL

BUDDY OS • HTML5 MULTI-FILE LABYRINTH • ALL STATE METHODS DEMONSTRATED IN ONE FILE

How do you make a multi-room grid RPG that actually works on itch.io without losing state?

This is the lab that shows you.

Meta-Grid is not a game — it's a copy-paste template and interactive tutorial for building labyrinth games that feel instant.

What it teaches:

Code

index.html  ← MANAGER (never unloads)  ├─ <div id="scene-root"></div>  └─ <script> state in RAM, fetch() scenesscenes/  ├─ town.html  ← FRAGMENT only: <div> tiles </div>  ├─ forest.html  └─ shop.htmljs/manager.js ← router + save

Core pattern (from file):

JavaScript

const state = { inv:[], pos:{x,y}, scene:'town' };async function go(to, entry){  const frag = await fetch(`scenes/${to}.html`).then(r=>r.text());  document.getElementById('scene-root').innerHTML = frag;  state.scene = to; state.pos = entry;}


  • Manager never navigates — iframe stays on index.html, so state lives in closure
  • fetch() works inside itch zip — instant scene swaps
  • Doors use data-door="forest" data-entry-x="5" data-entry-y="0"
  • HUD stays persistent — Inventory: sword, key, etc.
  • Backup with localStorage.setItem('mygame', JSON.stringify(state))
  • Avoid: window.location between full HTML docs = slow, loses state unless you hack URL/localStorage

Includes the full Hub Manager template with COPY TEMPLATE button, PLAY AGAIN loop, and notes on itch dashboard settings (set index.html as launch file, zip upload).

For devs making grid crawlers, town → forest → cave → shop loops, Buddy OS style projects.

MINT #2ecc8f / PEACH #e8a87c / BG #0f1410


DEVELOPER NOTES:

This build is entirely in HTML5 and based on a Unity prototype.

If you would like me to update and expand this file please consider donating.

Let me know in the comments what desired improvements or bugs you experience and we will update it for Version 2.

Meta-Grid: Tutorial is free to play, if you would like to purchase the zip file you can use the source code to Meta-Grid: Tutorial in your projects.

Download

Download NowName your own price

Click download now to get access to the following files:

Meta-Grid-Download.zip 60 kB
if you pay $10 USD or more