Skip to main content
Developer & Creator Documentation

Prompt-to-AAA Engine Blueprint Compiler & 121.games Syndication Ecosystem

Rather than sending a flat generic instruction to Vertex AI (gemini-4-neon default / gemini-4-carbon 1-shot repair), src/services/genreBlueprintService.mjs classifies every incoming Stu

Open AI Studio Direct-Answer FAQ Hub Machine-Readable Corpus (/llms-full.txt)

Prompt-to-AAA Engine Blueprint Compiler & 121.games Syndication Ecosystem

Document ID: YPG-AI-005 | Index: docs/README.md | Companion: VERTEX_AI_AND_MODEL_ROUTING.md

Primary Modules: src/services/genreBlueprintService.mjs, src/services/gameGeneratorService.mjs, src/routes/apiSyndicationRouter.mjs, src/services/gameSanitizer.mjs


1. Prompt-to-AAA Genre Blueprint Compiler

Rather than sending a flat generic instruction to Vertex AI (gemini-4-neon default / gemini-4-carbon 1-shot repair), src/services/genreBlueprintService.mjs classifies every incoming Studio prompt into one of 10 deterministic AAA game archetypes before synthesis (generateAndSaveGame, iterateAndSaveGame, autofixAndSaveGame) and injects a tailored engineering blueprint into buildEngineSystemPrompt().

1.1 The 10 Specialized AAA Archetypes

Archetype IDLabelRecommended EngineCategorySignature Engineering Blueprint
tactical-fpsTactical 5v5 First-Person Shooterthreejs3d-webglArticulated FPS viewmodel + operative rigs, PointerLock + WASD/Arrow parity, recoil spray curves, optical scope, volumetric smoke, C4 plant/defuse, round buy menu.
battle-royale3D Tactical Battle Royalethreejs3d-webglThird-person survivor + parachute + drivable buggy + orbital cargo transport airdrop rigs, TPS-to-4x/8x ballistic scope with projectile bullet drop, enterable compounds, shrinking Blue Zone.
3d-build-shooter3D Grid-Building Action Shooterthreejs3d-webglStylized hero + modular 4m x 4m x 4m destructible grid structures (Wall/Ramp/Floor/Cone), G architectural edit mode, weak-spot pickaxe harvesting, Launch Pad redeploy, violet storm.
3d-spline-racer3D Spline Drift & Nitro Racerthreejs3d-webglArticulated suspension vehicle with 4 spinning/steering wheels, curving parametric 3D spline highway, slip-angle drift-to-nitro boost, rival AI racers, dynamic FOV warp.
3d-flight-world3D Open-Sky Flight & Sanctuary Adventurethreejs3d-webglArticulated airship/glider rig, 360-degree open-sky floating sanctuaries, translucent hollow RingGeometry portals (zero washout), thermal updrafts, directional compass.
6dof-space-combat6-DOF Deep-Space Starfighter Combatthreejs3d-webgl6-DOF swept-wing starfighter with recoiling twin cannons & afterburners, target lead reticle, lock-on homing missiles, exoplanet debris rings, multi-phase dreadnought bosses.
run-and-gun-2d2D Kinetic Run-and-Gun & Action Platformerphaserphaser-2dArticulated multi-part 2D container rig + ./assets/sprite.png + ./cover.png parallax, coyote-time/jump-buffer physics, multi-weapon loadout, Phaser 3.90 .explode() particles.
verlet-grappler-2d2D Verlet Grappling-Hook Momentum Platformerphaserphaser-2dVelocity-tilted acrobat rig + multi-node Verlet rope constraint chain, pendulum momentum conservation, slingshot release boost, floating tower checkpoints.
orbital-roguelite360° Orbital & Twin-Stick Arena Roguelitecanvas2darcade-actionRotating orbital shield/turret rig, timed parry bursts, mid-run 3-card roguelite upgrade draft, multi-archetype enemy waves, multi-phase bosses, 0.25x-0.5x additive HDR bloom.
quantum-optics-puzzleQuantum Optics & Deterministic Grid Puzzlecanvas2dpuzzle-strategyPre-baked crystalline circuit grid, smooth-easing prism mirrors, chromatic beam splitters, >= 6 verified-solvable levels, Undo (Z), Par-Star ratings, adaptive mobile board metrics.

1.2 Mandatory Cross-Archetype Invariants Injected Into Every Prompt

Every blueprint block emitted by buildGenreBlueprintPrompt() reinforces five non-negotiable production invariants:

  1. Articulated Multi-Part 3D/2D Rig Hierarchy: Explicitly forbids bare BoxGeometry cubes, plain fillRect boxes, or static programmer-art cutouts.
  2. Input & Bridge Parity: PointerLock (where applicable) + 100% WASD (KeyW/A/S/D) and Arrow Keys parity + Space/R + YPG_KEY_EVENT / YourPlaygroundSDK.keys polling + pointer/touch fallback.
  3. Cosmic-Glass HOW TO PLAY Overlay & ? Toggle: Immediate live background render, translucent keycap tutorial card dismissing on first keypress/click, ? HOW TO PLAY top-HUD toggle, and non-overlapping <=560px mobile HUD.
  4. Locked 60 FPS Anti-Stutter Budget: renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 1.5)), 0.5x half-resolution bloom, 0 per-frame ctx.shadowBlur, 0 per-frame new THREE.Vector3/Color/Euler allocations, object pooling, dirty-checked DOM HUD mutations, and dt = Math.min(rawDt, 0.05).
  5. Procedural WebAudio Synth & Spatial SFX: Self-contained procedural music + stereo-panned SFX unlocked on first user gesture and guarded behind navigator.userActivation.hasBeenActive inside try { ... } catch (_) {}.

2. Deterministic Static Quality Scorer (scoreGeneratedGameQuality)

After linear-time O(N) sanitization (sanitizeGameHtml) and V8 vm.Script compilation succeed, gameGeneratorService.mjs invokes scoreGeneratedGameQuality(sanitized.html, engineObj.id) to attach deterministic diagnostics (0..100 score, letter grade S–F, per-check breakdown, and actionable warnings) directly onto generation metadata (archetype, archetypeLabel, qualityScore, qualityDiagnostics).

Check KeyMax WeightLinear-Time Static Assertion
howToPlayOverlay15Detects cosmic-glass HOW TO PLAY tutorial overlay markup outside injected SDK.
helpToggle10Detects interactive ? help button (#btn-help / toggleTutorial / ? HOW TO PLAY).
wasdAndArrowParity15Verifies both WASD (KeyW/A/S/D or lowercase 'w'/'a'/'s'/'d') and Arrow* bindings.
ypgTelemetryAndBridge15Verifies YourPlaygroundSDK.ready / YPG_READY, reportScore/gameOver/YPG_SCORE, and YPG_KEY_EVENT/YPG_INPUT/YourPlaygroundSDK.keys wiring.
zeroPerFrameShadowBlur15Flags any non-zero .shadowBlur = ... or ctx.filter = 'blur(...)' inside hot requestAnimationFrame/render/draw/animate/tick/update loops (while permitting shadowBlur = 0 and one-time offscreen pre-bakes).
pixelRatioCap10Enforces setPixelRatio(Math.min(..., <= 1.5)) on Three.js and capped devicePixelRatio on 2D engines.
zeroPerFrameLoopAllocs10Flags per-frame new THREE.Vector3/Color/Euler/Quaternion inside Three.js hot loops (or per-frame canvas gradients in 2D) and verifies clamped dt.
audioContextGuard10Verifies procedural WebAudio AudioContext is guarded by navigator.userActivation.hasBeenActive or user-gesture unlock inside try/catch.

3. Official Read-Only YourPlayground.games -> 121.games Syndication Feed

Implemented in src/routes/apiSyndicationRouter.mjs and mounted in src/app.mjs, the syndication API exposes a strictly read-only, CORS-enabled JSON catalog for https://121.games with zero cross-repository file mutations and zero raw .zip source exposure:

  • GET /api/syndication/121games: Returns all catalog games (Cache-Control: public, max-age=60, Access-Control-Allow-Origin: *), with optional read-only filters (?category=, ?engine=, ?featured=true, ?q=).
  • GET /api/syndication/121games/:slug: Returns a single canonical syndicated game manifest (404 GAME_NOT_FOUND for unknown or invalid slugs).
  • Read-Only & Zero-ZIP Enforcement: Mutating methods (POST, PUT, PATCH, DELETE) return 405 METHOD_NOT_ALLOWED; any export.zip / export / download path returns 403 ZIP_EXPORT_DISABLED (zipDownloadEnabled: false).

3.1 Canonical Syndication Fields Per Game

Every entry includes:

  • isBasedOn: https://www.yourplayground.games/games/<slug>
  • canonicalUrl: https://www.yourplayground.games/games/<slug>
  • runtimeEmbedUrl: https://www.yourplayground.games/runtime/<slug>/index.html
  • coverUrl: Absolute canonical URL (https://www.yourplayground.games/...)
  • creatorStudioCtaUrl: https://www.yourplayground.games/studio?utm_source=121games&utm_medium=community&utm_campaign=create_your_game
  • embedSandbox: allow-scripts allow-pointer-lock
  • sdkContract:
  {
    "inbound": ["YPG_KEY_EVENT", "YPG_INPUT", "121_INPUT"],
    "outbound": ["YPG_READY", "YPG_SCORE", "YPG_GAME_OVER", "121_READY", "121_SCORE", "121_GAME_OVER"]
  }

4. Dual-SDK Compatibility (YourPlaygroundSDK + 121SDK)

Inside src/services/gameSanitizer.mjs (YPG_SDK_SCRIPT_TAG), every sanitized game automatically gains native dual-SDK postMessage interoperability while preserving all linear-time security invariants (0 external URLs, 0 prototype pollution vectors, allow-scripts allow-pointer-lock null-origin sandbox):

  • Outbound Dual Emission:
  • sdk.ready() emits { source: 'YourPlaygroundSDK', type: 'YPG_READY', payload } and { source: '121SDK', sdkAliasOf: 'YourPlaygroundSDK', type: '121_READY', payload }.
  • sdk.reportScore(score) emits both YPG_SCORE and 121_SCORE.
  • sdk.gameOver(score) emits both YPG_GAME_OVER and 121_GAME_OVER.
  • Inbound Unified Controls:
  • Accepts YPG_KEY_EVENT, YPG_INPUT, and 121_INPUT (action: 'keydown'|'keyup'|'press'|'tap' or eventType: 'keydown'|'keyup'), updating window.YourPlaygroundSDK.keys and dispatching synthetic KeyboardEvents cleanly inside the sandboxed frame.
  • Window Global Alias: Exposes window.YourPlaygroundSDK, window.PlaygroundSDK, and window['121SDK'] pointing to the exact same hardened SDK singleton.