Skip to content

Export Game (folder, for hosting)

Export Game (folder, for hosting) writes two files - game.html plus a scene.fg scene sidecar - into a folder you pick. It is the smallest output Awaken produces, built for uploading to a static host.

The single-file game.html export inlines your scene as base64, which inflates the scene bytes by ~33 %. The folder export skips that: it keeps the compressed scene as a raw binary sidecar the game fetches at boot, so the download is as small as it gets. The trade-off is that the game must be served - it will not run when double-clicked.

What you get

  • game.html - the player template with your compiled behaviours injected, but no inline scene. On boot it fetches ./scene.fg from the same folder.
  • scene.fg - the exact same Zstd-compressed binary scene container as the single-file export, written raw (no base64 wrapper). This is where all the size lives.

Both come out of the identical buildShipPayload pipeline used by game.html and Preview: used-asset collection, scene compaction, geometry quantization, and Zstd level-19 compression. Only the delivery differs - sidecar file instead of inline base64.

Why it must be served

A double-clicked file:// page is a unique opaque origin, and browsers block fetch() of sibling files from it. Since game.html here loads its scene via fetch("./scene.fg"), opening it directly from disk leaves the game with no scene to load - it will show "No game scene found." rather than run.

Serve the folder over http and the fetch succeeds. On boot the player tries its inline scene globals first, then falls back to fetching ./scene.fg (and, for legacy hosted builds, ./scene.awaken.json). See how the player boots a scene.

WARNING

The folder export will not run double-clicked. For a file you can open directly from disk, use Export game.html, which inlines the scene so no fetch is needed. Use the folder export only when you are hosting.

Using it

  1. Open File ▾ → Export Game (folder, for hosting)… in the Toolbar.
  2. Pick (or create) a destination folder in the directory picker.
  3. Awaken writes game.html and scene.fg into it and confirms in the Console.

📸 Screenshot - save as img/shipping-export-folder.png

The exported folder in a file browser showing exactly two files - game.html and scene.fg - with the scene.fg selected so its (large) size is visible against the small game.html.

Requirements

  • Chromium browser. The folder export uses the File System Access directory picker (showDirectoryPicker), which Firefox and Safari do not implement. On those browsers the Console reports "Folder export needs a Chromium browser (directory picker)." - use Export game.html there instead.
  • A built player template. Like the single-file export, it stamps your scene into the pre-built template. If it is missing you will see "Folder export needs the player template - run pnpm build:player-template." See the stale-template gotcha.

Hosting notes

Any static host works - the two files are plain static assets with no server-side logic.

  • Vercel / Netlify / Cloudflare Pages / S3+CloudFront - drop both files in the served directory (or a subfolder) and open game.html's URL. Keep scene.fg next to game.html, since the fetch is relative (./scene.fg).
  • Local check before uploading - run any static server in the folder (for example npx serve or python3 -m http.server) and open the served URL. This confirms the fetch path works; double-clicking will not.
  • MIME type - scene.fg is fetched as an ArrayBuffer, so its content type does not matter; hosts that serve unknown extensions as application/octet-stream are fine.
  • Compression - the scene is already Zstd-compressed inside scene.fg, so extra host-level gzip/brotli on it buys little; do not worry about configuring it.

For a single URL with nothing to keep in sync, the inline game.html is often simpler to host too - the folder export mainly wins when download size matters.

See also

Awaken — browser-native WebGPU game engine.