mirror of
https://github.com/hanzo-templates/voxel-craft.git
synced 2026-10-30 20:51:53 +00:00
Chunk: a voxel world is a meshing problem, not a drawing problem. 81 chunks of
16x16x24 is ~500k cells; emitting only faces that touch air leaves ~62k quads at
60 fps. Editing re-meshes only the touched chunk and its four neighbours.
Why this exists: static-SPA builders cannot ship a game. Proving hanzo.app can
meant finding what actually stopped it, and three things did:
1. POST /v1/projects/:slug/deploy carries the entire build in ONE request body
and the public edge caps a body at 4 MiB (measured: 4194304 accepted,
4198400 gets the opaque fasthttp "Error when parsing request"). Godot emits
a 43 MB engine wasm; Unity 22 MB + 5.7 MB of data. The artifact lane cannot
express a game at all, so these ship through the release lane instead: stage
to the object store, then POST /v1/sites/:slug/publish promotes it
server-side with no body.
2. Engine loaders emit NON-fingerprinted filenames (index.js, <name>.loader.js)
and clients/sites.CacheControlFor only marks a content-hashed name
immutable. A redeploy therefore leaves the CDN and the browser running the
OLD loader against the NEW wasm. That is not a visible error: emscripten
prints "still waiting on run dependencies" forever and the canvas stays
300x150. Every template here fingerprints its own asset names so the case
cannot recur.
3. A cross-origin-isolated document (COEP: require-corp) BLOCKS a plain
cross-origin script, so the shared a.hanzo.ai runtime needs
crossorigin="anonymous" on exactly the pages that opt into isolation.
Co-authored-by: Hanzo Dev <[email protected]>
29 lines
1.4 KiB
HTML
29 lines
1.4 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
|
<title>Chunk — a voxel sandbox</title>
|
|
<meta name="description" content="A first-person voxel sandbox: procedural terrain, face-culled chunk meshing, and place/break editing that re-meshes only the chunk you touched.">
|
|
<style>
|
|
:root { color-scheme: dark }
|
|
html,body { margin:0; height:100%; background:#8fc4ff; overflow:hidden;
|
|
font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; color:#0b1220 }
|
|
canvas { display:block }
|
|
#hud { position:fixed; left:16px; top:14px; pointer-events:none; color:#f8fafc;
|
|
text-shadow:0 1px 4px rgba(0,0,0,.65) }
|
|
#dot { position:fixed; left:50%; top:50%; translate:-50% -50%; width:6px; height:6px;
|
|
border:1px solid rgba(255,255,255,.85); border-radius:50%; pointer-events:none }
|
|
#tag { position:fixed; right:16px; bottom:12px; color:#f8fafc; opacity:.65; pointer-events:none }
|
|
</style>
|
|
<script src="https://a.hanzo.ai/analytics.js" data-org="hanzo" crossorigin="anonymous" defer></script>
|
|
<script src="https://a.hanzo.ai/chat.js" data-org="hanzo" data-mode="site" crossorigin="anonymous" defer></script>
|
|
</head>
|
|
<body>
|
|
<div id="hud">generating world…</div>
|
|
<div id="dot"></div>
|
|
<div id="tag">Chunk · three.js voxels · hanzo.app</div>
|
|
<script type="module" src="./app.js"></script>
|
|
</body>
|
|
</html>
|