The game engine as a stage set, with no server behind it

The landing page runs the real engine with no server, class portraits share its one WebGL context, a 55-second lore intro hides the zone join, and Gloamreach becomes Duskbound.

The Duskbound landing page with three voxel heroes around a live 3D campfire behind the Forge a Hero form
Contents
  1. Three passes at one page
  2. The engine without a server
  3. Never make the name field wait
  4. Class portraits in the same GL context
  5. Below the fold is the game's own data
  6. The lore intro
  7. The intro hides the loading screen
  8. The social card is a screenshot of the game
  9. The rename
  10. By the numbers
  11. Related posts

The landing page has two jobs that pull against each other: let you in instantly, and prove there's a real 3D world behind the form. The third pass of the day made the backdrop the actual game engine, running with no server.

The landing page: a live 3D Hollowmere campfire behind the Duskbound wordmark and the Forge a Hero panel
The landing page on my private server. Everything behind the form is the game engine rendering Hollowmere, with no server connection

Three passes at one page

Pass Who What
1 foundation agent, wave 1 the starter template's page plus a form; proved guest → character → /play
2 front-door agent (H), wave 2 layered SVG/CSS/canvas dusk scene, class cards, live player count from world.status, /login, /credits, fade into the game, OG tags
3 landing agent, afternoon the real engine behind the form, 3D class portraits, the lore intro

Pass 2 also fixed the class picker: the screen-reader radio sat outside its card, so clicks hit label text and selected nothing. The cards became a proper ARIA radiogroup.

The engine without a server

A video would have been dishonest, and unnecessary:

  • Procgen is deterministic and isomorphic: generateZone builds the same town anywhere from hash32(zoneId) (procedural worlds)
  • The renderer only needs a map and actors: Engine.loadZone(map) doesn't care where the map came from

LandingStage generates a hub town client-side, puts the three class heroes at the campfire, adds pets and a townsperson, and orbits a slow camera. No websocket:

src/components/landing/stage/LandingStage.tsTypeScript
// The landing backdrop: the real engine with no server. A hub town is generated client-side from
// its seed, the three class heroes stand around the campfire with their weapons, a pet or two and
// a townsperson walk about, and a slow cinematic camera orbits the group. Every ~12 s the stage
// crossfades to the next act's town (a 2D snapshot of the last frame fades over the new one).
 
async show(i: number): Promise<void> {
  // …
  this.snapshot()                                   // freeze the outgoing frame into a 2D canvas
  this.clearCast()
  const map = generateZone(zoneGenInputFor(v.zoneId, seedFor(v.zoneId, '')))
  await this.engine.loadZone(map, 'landing', 'landing', () => {})
  if (v.look) this.engine.usePreset(PRESETS[v.look])
  this.placeFocus(map, v)
  this.chooseShot(v)                                // line-of-sight-checked camera pick
  await this.placeCast(map, v)
  this.engine.renderer.compile(this.engine.scene, this.engine.rig.camera)
  // … then fade the snapshot out over the new town

Every 12 s it moves to the next act's town (Hollowmere, Saltmarrow, Emberhold, Lanternwatch, Whitevigil, the Last Lantern). The crossfade copies the last frame to a 2D canvas, loads and compiles the new town, then fades the canvas: never two scenes in memory.

Vignettes are pure data, so SSR and the gallery import them without Three.js:

src/components/landing/stage/vignettes.tsTypeScript
{
  act: 1,
  numeral: 'I',
  title: 'The Unquiet Dead',
  zoneId: 'a1_town',
  town: 'Hollowmere',
  hook: 'A lantern-lit town at the edge of blighted fields, a flooded chapel and a graveyard that will not stay buried',
  cam: { yaw: 0.6, sway: 0.35, dist: 15, pitch: 0.46 },
  pets: ['fox'],
  still: '/landing/act-1.webp',
},
Six act towns rendered by the same stage: Hollowmere, Saltmarrow, Emberhold, Lanternwatch, Whitevigil and the Last Lantern
The six vignettes as stills (public/landing/act-*.webp), rendered by the real engine through /dev/landing-shot

Never make the name field wait

  1. SSR paints a scene: sky, stars, moon, SVG ridge and town, CSS fog, canvas embers. Also the no-WebGL2 fallback.
  2. Hydration makes the form live. Nothing else loads.
  3. When idle, the engine chunk is imported:
src/components/landing/HeroScene.tsxTSX
// The engine chunk (three + the renderer + procgen) loads only after hydration, once the browser
// is idle, so first paint and the name field never wait on it.
const loadStage = () => import('./stage/HeroStage')
 
function whenIdle(fn: () => void): () => void {
  // Safari has no requestIdleCallback
  if (typeof window.requestIdleCallback === 'function') {
    const id = window.requestIdleCallback(fn, { timeout: 1800 })
    return () => window.cancelIdleCallback(id)
  }
  const id = setTimeout(fn, 400)
  return () => clearTimeout(id)
}
  1. The live scene crossfades in once its first vignette is on screen.
Left: the painted SSR fallback with the skyline and moon. Right: a moment later, the live engine scene has crossfaded in
Two frames 4 s apart from the same headless session: the painted fallback (left), then the live Hollowmere campfire (right)
Measure Value
Entry bundle growth ~21 KB gzipped
3D ready, warm cache ~0.8 s
3D ready, cold 1.6–3.7 s

The stage pauses off-screen or in a hidden tab (IntersectionObserver plus visibilitychange); under prefers-reduced-motion it settles and holds one frame.

Class portraits in the same GL context

Each class card is a 3D turntable; hover plays the signature move with real skill FX (Sunder, Barbed Arrow, Fireball). Three more contexts would hit browser caps and duplicate textures and shaders, so the portraits share the backdrop's:

src/components/landing/stage/CardStudio.tsTypeScript
// Class-card portraits on the backdrop's own WebGL context (never a second one). Each registered
// card canvas gets a turntable of its class hero: before the main frame renders, the studio draws
// each portrait into a scissored corner of the engine canvas and copies it out with drawImage, then
// the main frame paints over the whole buffer. Hovering a card plays the signature move with the
// real skill FX (the FX batches are borrowed into the studio scene for that one draw).
 
/** far from any town, so FX fired here never show in the backdrop */
const ORIGIN = { x: -320, y: -320 }
A phone-width landing page: the wordmark, the pitch, the live-realm pill and the Forge a Hero panel with the Warden card
At 390 px (2× DPR, touch emulation) the form stacks over the live backdrop and the class cards keep their 3D portraits

Below the fold is the game's own data

  • Act gallery: the vignettes above
  • Boss portraits: engine stills from /dev/landing-shot?kind=boss&id=…, captured by scripts/landing-shots.ts into public/landing/
  • Loot: real item definitions via scripts/landing-loot.ts → loot.gen.ts, shown in the game's ItemTooltip
  • Ladder: top four from the public ladder router
  • Pet preview: a live 3D pet on the same stage
Six boss portraits from the landing page: the Bone King, the Sunless King, the Ember Lord, the Drowned Choir, the Winter Queen and the Unmaker
Boss portraits rendered by the engine at 360×440 with transparent backgrounds. All eighteen come from one script run

The lore intro

55 seconds, once, before a new hero's first drop-in: six beats over each act's vignette, letterboxed, ending on the hero's name.

src/components/landing/intro/IntroCinematic.tsxTypeScript
// Lore from shared/data (the Lantern of Saint Vey, the kings who held the Gloam's doors, the
// Leviathan, the Unmaker on the Unwritten Throne). Title cards never end in a period.
export const BEATS: readonly Beat[] = [
  { vignette: 0, line: 'For three hundred years, one lantern held back the Gloam', sub: 'The Lantern of Saint Vey', secs: 8.5 },
  { vignette: 1, line: 'Then the chapel sank, and the lantern went down with it', sub: 'And the dusk began to creep', secs: 8 },
  { vignette: 2, line: 'Kings held its doors, and every one went wrong holding them', sub: 'The Bone King, the Sunless King, the Ember Lord', secs: 8.5 },
  { vignette: 3, line: 'It drowned the sea and swallowed the moon', sub: 'What the Gloam touches, it unwrites', secs: 8 },
  { vignette: 4, line: 'Now the last lanterns burn at the edge of the world', sub: 'Every one of them is guttering', secs: 8 },
  { vignette: 5, line: 'At its heart, the Unmaker waits on a throne no one wrote', sub: 'Someone has to walk into the dark and relight them', secs: 9 },
]
Four beats of the intro: Hollowmere, Saltmarrow, Whitevigil, and the final You are Duskbound card
Frames from /dev/intro: the first beat, the kings, the last lanterns, and the closing card

The intro hides the loading screen

Matchmaking, websocket, auth, town generation and asset loading all run under the last card:

src/components/landing/intro/useIntroGate.tsxTSX
/**
 * /play's intro gate. A brand-new hero (level 1, still in Hollowmere, flag unset) or `?intro=1`
 * gets the lore intro first; the game mounts under it once the last card is up, so the zone join
 * runs while the hero's name is on screen and the fade-out lands straight in the world.
 * Automation (navigator.webdriver: e2e, trailer capture, bx) skips it unless `?intro=1`.
 */
export function useIntroGate(hero: Hero | null, force: boolean): { mountGame: boolean; overlay: ReactNode } {
  const [phase, setPhase] = useState<Phase>('undecided')
  const fresh = hero !== null && hero.level <= 1 && hero.zoneId === 'a1_town'
 
  useEffect(() => {
    if (!id || phase !== 'undecided') return
    const automated = navigator.webdriver === true
    setPhase(force || (fresh && !automated && !introSeen(id)) ? 'playing' : 'done')
  }, [id, fresh, force, phase])
  // …
  return { mountGame: phase === 'final' || phase === 'done', overlay }
}
  • Skip: Esc, the Skip button, or a pad's B or Start (controller and touch)
  • Seen per hero in gr.introSeen.<id>; /intro and /dev/intro replay it
  • No WebGL2: jumps to the final beat, so it can never block entry
  • Automation: navigator.webdriver skips it, or every e2e run, trailer capture and bx profile would sit through 55 s of lore

The social card is a screenshot of the game

/dev/og renders a 1200×630 card (wordmark, pitch, each class's three skill icons) over an engine still of the Hollowmere campfire. scripts/og.ts screenshots it into public/og.png, under Node, because Playwright's pipe transport hangs under Bun on Windows.

The Open Graph card: the Duskbound wordmark, the pitch, and the three classes' skill icons over an engine still
public/og.png: an HTML page over an engine still, screenshotted, so the card always matches the game

The rename

Gloamreach became Duskbound in commit e3fedb8 at 15:58, bundled with Acts 4–6. Rejected per decisions.md: Lanternfall, Lanternbearer (kept as the Unmaker title), Nightward.

  • Every visible string changed: titles, OG tags, wordmark, landing copy, credits, admin header, trailer cards
  • "The Gloam" stayed as the darkness: Act VI, Gloam Rifts, the Gloam Anvil
  • Internal ids stayed: gr.token, gr.pad.v1, gr-* classes. Renaming the token key would have logged out every guest, since the token is the account.
  • Infrastructure stayed: the Drydock project, database, repo and original gloamreach subdomain; duskboundga.me was added alongside (d5308f5)

No "Gloamreach" remains in src/, shared/ or server/ TypeScript, and every session survived, because player-facing and machine-facing names were separate from the start.

By the numbers

src/components/landing/** ~3,900 lines, plus 1,100 lines of landing.css
Engine-rendered stills 38: 6 acts, 18 bosses, 12 pets, the home, the OG background
WebGL contexts 1, for the backdrop and all three portraits
Intro 6 beats, ~55 s, skippable from the first frame