Communitygithub.com

demoscene-intro

Build a size-coded demoscene intro (64k, or 4k/8k/16k/32k budgets) as one self-contained HTML file with real-time WebGL graphics, a synthesized WebAudio soundtrack under its own byte budget, choreographed camera and captions. Use this whenever the user asks for a demo, intro, demoscene production, 64k/4k intro, demoparty entry, size-limited audiovisual piece, music-synced 3D sequence or procedural music video in the browser, even if they only describe scenes and mood ("a slow flight through a flooded cathedral with an ambient soundtrack, under 64KB"). The user supplies the art direction; this skill supplies the spec, the pitfalls and the checking tools.

What is demoscene-intro?

demoscene-intro is a Claude Code agent skill that build a size-coded demoscene intro (64k, or 4k/8k/16k/32k budgets) as one self-contained HTML file with real-time WebGL graphics, a synthesized WebAudio soundtrack under its own byte budget, choreographed camera and captions. Use this whenever the user asks for a demo, intro, demoscene production, 64k/4k intro, demoparty entry, size-limited audiovisual piece, music-synced 3D sequence or procedural music video in the browser, even if they only describe scenes and mood ("a slow flight through a flooded cathedral with an ambient soundtrack, under 64KB"). The user supplies the art direction; this skill supplies the spec, the pitfalls and the checking tools.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/LukaszDygon/demoscene/tree/HEAD/skill/demoscene-intro

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Demoscene intro

You're making a piece of art that happens to be tiny. The user's brief is the art direction. Your job is to realize it with as much craft and invention as fits the budget: the brief is the floor, not the ceiling.

The spec

  • One HTML file, no external requests, within the byte budget (default 65 536). Honour whatever the user says: 4k, 8k, 16k, 32k. The soundtrack code gets its own sub-budget (default 16 384, or roughly a quarter of the total for smaller categories). Report the raw, uncompressed size. A self-extracting packer is only fine if the user's party rules allow it, and if you use one, say so.
  • Real-time graphics (WebGL2) and a synthesized soundtrack (WebAudio), both generated by code. Text uses OS fonts with a fallback stack for macOS, Windows and Linux, because embedding a font blows the budget.
  • Starts within about a second of the click. Synthesize live with a short lookahead. Browsers block audio without a gesture, so make the start screen part of the piece rather than a generic "click to start". The audio clock drives the visuals.
  • Sync everything to the music in bars and beats. Write the storyboard in bars first: scene, camera, captions, music section.

Make it yours, not generic

The most common failure is a stiff, safe piece: a template-looking title card, flat shading everywhere, a camera on rails, captions that merely label the scene. Choose the technique per brief:

  • raymarched SDFs and volumetric light for underwater, clouds, organic forms
  • meshes for architecture and characters
  • a single fragment shader for 4k–16k
  • 2D canvas tricks, particles and feedback buffers where they serve the look

Spend bytes where the eye goes:

  • light: fog, shafts, glow, reflections
  • texture and noise
  • secondary motion: things drifting, breathing, reacting to the beat
  • one or two signature moments per piece that the viewer remembers

Beware the genre's first answer: the most familiar progression, tempo, sound palette or post effect for the style, such as Am–F–C–G for synthwave, or tape wobble, scanlines and bloom on everything. Derive tempo, key, harmony, timbres and post-processing from this brief's mood and subject, and make at least one choice a listener wouldn't predict from the genre label. Take conventions only from other intros' folder structure, never their look or sound.

Treat the title screen, the transitions and the end card as part of the art. If the brief is thin, invent in its spirit and tell the user what you added.

Contracts (so the checking tools work)

  • Keep the music in its own script whose code can also render offline: expose SONG.render() → Promise<AudioBuffer> by running the same scheduler on an OfflineAudioContext. That's how you measure a mix you can't hear. See references/audio.md.
  • Optional, for camera flights through geometry: define window.__probe = {dur, cam: t => [x,y,z], boxes: [[x0,y0,z0,x1,y1,z1], …]} for the clearance check.

Check your work

python3 <skill>/scripts/budget.py dist/x.html --total 65536 --music src/music.js --music-max 16384
node <skill>/scripts/check.mjs e2e dist/x.html         # click → first sound time, exceptions
node <skill>/scripts/check.mjs audio src/music.js      # offline render: peak, NaN, RMS per 4 bars
node <skill>/scripts/check.mjs clearance dist/x.html   # if __probe is defined

Don't take screenshots: the user judges the piece by watching it in motion with sound, and that's the visual review. Catch visual problems by reasoning about the code: exposure and colour maths, what is on screen at each moment of the timeline, and whether a reveal is visible too early. For audio, aim for a peak of 0.5–0.95, no NaNs, and section levels that follow the arrangement.

Deliver

Open the intro in the user's browser so they can watch it with sound (open dist/x.html). Tell them the size against budget, the timeline, what you invented beyond the brief, and what you couldn't verify. You haven't heard the music; you've only measured it.

Pitfalls that cost hours before

  • Audio graphs that only grow. Scheduling a whole song up front keeps thousands of dead nodes alive. Schedule bar by bar and disconnect finished nodes (references/audio.md).
  • Buffers at a fixed 44.1 kHz throw on 48 kHz live contexts. Use ctx.sampleRate.
  • Reveals leak. Big hero objects show over walls and through open roofs long before their moment. Gate them on time or hide them behind something.
  • Faces only read head-on, held for a couple of seconds.
  • Captions need a dark shadow or glow to stay readable over bright scenes.
  • -x**2 is a JS syntax error; write -(x**2).

Related Skills