AI Art Engine 中文
Menu

Guide · v9.0.0 · Playable HTML5 & Game Production

Playable HTML5 Mini-Games & Game Production Suite

Describe gameplay in one sentence inside the AI chat panel (or from an external MCP client) and the agent writes a complete pure Node (esbuild) 2D / 3D project: geometry, textures, materials, SFX and level layouts are all generated procedurally by code. The host bundles a self-contained single HTML file, runs headless Chromium smoke verification (zero console/page errors + simulated input + canvas frame-diff validation), and links seamlessly into layered Game UI suites and the game.economy Machinations v2 studio.

1. What it is

This workflow is driven by the built-in AI chat panel or the MCP Game Production toolset (replacing legacy canvas-only playable generation nodes):

Step Who does it Output
Brief You describe the gameplay in one sentence The one-sentence brief
Scaffold Tool gameplay_prepare_project Cache/GamePlayJobs/…/project (package.json / build.mjs / src/core / src/assets skeleton)
Code The agent edits src/** with its own file tools Procedural assets + gameplay (geometry / canvas textures / audio / levels)
Build & smoke gate Tool gameplay_build (host runs esbuild + headless Chromium smoke test) Self-contained dist/single.html + live smoke verification report
Play Play button on the chat artifact card Opens in the system default browser and registers a gamePlay asset
You need a configured text model (DeepSeek, Claude or any compatible reasoning provider) plus Node / npm on the machine. Both bundling and headless Chromium smoke checks are executed safely by the host — never run competing npm commands manually inside the job folder.

2. Driving it from the AI chat

Open the AI chat panel on the right (mode Craft) and describe the game in one sentence, for example:

Low-poly space station corridor: collect energy cells, WASD to move, mouse to steer, win at 10; use Three.js

The agent calls three tools in sequence:

  1. gameplay_prepare_project: writes the scaffold (optionally with mode: 2d | 3d | auto and a game title).
  2. Writes src/assets/** (procedural assets) and src/game/** (gameplay loop & HUD).
  3. gameplay_build: the host runs npm install + node build.mjs and launches the headless Chromium smoke gate, returning a jobId polled via gameplay_job_status until done.

Once the build and smoke check pass, a game card appears in the conversation with a Play button that opens the single-file HTML5 build directly in your browser.

2D or 3D follows what you ask for; say "use Three.js" when you want 3D explicitly. Asset-layer conventions (directory layout, the defineAsset contract, texture and WebAudio recipes) live in the built-in skill gameplay-proc-assets, loaded automatically by the agent.

3. All assets generated by code

This is the core of the approach: zero external asset downloads and zero paid media API calls — everything is synthesized deterministically inside the project, so it costs no media credits, builds in seconds, reproduces from a seed, and stays stylistically coherent.

  • src/core/rng.js: seeded randomness (change one character to swap the whole asset set).
  • src/core/palette.js: one coherent palette shared by textures, materials and lights.
  • src/core/registry.js: the defineAsset({ id, kind, build }) registry.
  • src/assets/geometry/: BufferGeometry shapes (extrude / lathe / merge / instancing).
  • src/assets/texture/: textures painted with Canvas 2D (stripes / noise / gradients), returned as a canvas ready for CanvasTexture.
  • src/assets/audio/: WebAudio synthesized SFX (oscillators + filters + envelopes).
  • src/assets/level/: level layouts derived from the seed.

4. Generate → build → headless Chromium smoke verification → play

  1. Generate: describe the game in chat; the log shows the agent authoring src/**. In 3D mode the scaffold includes three and a clean render loop.
  2. Build & Headless Chromium Smoke Verification: right after gameplay_build bundles dist/single.html, the host boots a hidden headless Chromium instance and runs a three-pillar live verification gate:
    • Zero console & page errors: captures any console.error, uncaught pageerror runtime exception, WebGL shader compilation failure or broken resource load.
    • Simulated player input: dispatches synthetic pointer clicks and keyboard input (WASD, arrow keys, Space) to click past title overlays and exercise movement/action handlers.
    • Canvas pixel frame-diff validation: samples multiple rendered canvas frames across time to verify non-blank pixel luminance and real inter-frame motion (catching all-black/white screens or frozen requestAnimationFrame loops). Results are reported in gameplay_job_status.smoke; whenever smoke.ok === false, the agent reads the diagnostics, patches the bug and rebuilds automatically.
  3. Play: click Play to open the self-contained single file in your browser — fullscreen and DevTools included. If a build is non-self-contained (ES modules or relative paths), it falls back gracefully to the in-app sandbox window.
  4. Also playable from the library: every successful build registers a gamePlay asset you can double-click in the asset browser at any time.

5. Iterating and project layout

  • Keep iterating naturally: "make it darker / add a double-jump sound / add boss waves" — the agent updates only src/assets/** and src/game/** and re-runs gameplay_build.
  • Rebuilding the same project reuses the same job and asset, updating the card in place without cluttering your asset library.
  • On disk: Cache/GamePlayJobs/<jobId>/project/ under the project root, with the bundled single file at dist/single.html.

6. Companion Game Production Tools & Machinations v2 Studio

Beyond pure-code prototypes, AI Art Engine v9.0.0 ships a full commercial game production suite accessible on the node canvas and via the 15 Game Production MCP tools:

  • game_one_sentence_create (One-Sentence Game Suite): turn a single concept prompt into coordinated design specs, structured balance tables, core art assets and a playable scaffold.
  • game_ui_suite_create (16-Class Game UI Suite & Native TySh Layered PSD): generate cohesive HUDs, inventory grids, gacha banners, shops and skill bars split into 16 UI widget classes, exporting layered .psd files with native Photoshop editable TySh text layers plus Unity / Godot UI prefabs.
  • game_playable_preview_compile (Interactive HTML5 Playable Compiler): compile generated tilemaps (game_level_map_generate), JSON/CSV data tables (game_data_table_generate), shaders/particles (game_shader_particle_generate) and UI assets into instant playable HTML5 previews or playable ad packages, alongside game_tile_pbr_process, game_audio_variants and game_bundle_export.
  • game.economy Node & machinations_studio (Machinations v2 Economy Studio): model progression loops, gacha pity systems, stamina sinks and combat balance across 59 typed building blocks (Pools, Sources, Drains, Converters, Gates, Delays, Registers — inspectable via machinations_building_blocks), and run deterministic step-by-step traces or multi-run Monte Carlo simulations before writing production server code. 🎮 Launch Zero-Install Live Playground →

7. FAQ

The build fails with an npm / build error?

Make sure Node.js / npm are on PATH, then read the log tail and error from gameplay_job_status. You can also run npm run build manually inside Cache/GamePlayJobs/…/project to compare.

Play opened an editor instead of a browser?

Play uses the system default app; if .html is associated with a code editor, that editor opens. Use the in-app play window from the asset library in that case.

Blank page in the browser but fine in the app?

The build is not self-contained: from file:// browsers block type="module" scripts and relative sibling files. Ask the agent to keep index.template.html on inline classic scripts.

Black screen or shader errors?

Check the smoke field of gameplay_job_status: headless Chromium smoke verification catches console/page errors, load failures, blank/black canvases and zero canvas frame-diff after simulated input in smoke.errors / smoke.warnings. Pass that report back to the agent to patch and rebuild.

What happened to the old "Playable HTML generation" / "Playable HTML" nodes?

Game generation moved to the chat panel and MCP tools. Legacy generation nodes are migrated into note nodes preserving your prompt, while existing gamePlay assets remain playable from the library.

Can external coding agents (Claude Code / Cursor / Codex) drive all these game tools?

Yes — enable Settings → MCP Server and connect to /mcp to call gameplay_prepare_project, gameplay_build, gameplay_job_status, game_one_sentence_create, game_ui_suite_create, game_playable_preview_compile and machinations_studio directly. See the MCP Setup Guide.