{
 "id": "gamengen",
 "title": "GameNGen diffusion game engine",
 "aliases": [
  "GameNGen",
  "Diffusion Models Are Real-Time Game Engines"
 ],
 "domain": "genai",
 "subdomain": "neural game simulation",
 "stage": "generation",
 "realtime": "realtime",
 "platforms": [
  "python",
  "cuda"
 ],
 "year_introduced": 2024,
 "inputs": [
  "ldr-image",
  "animation"
 ],
 "outputs": [
  "ldr-image"
 ],
 "style": "photoreal",
 "dynamic": "dynamic",
 "summary": "A diffusion model that acts as a game engine: it predicts the next frame from past frames and player actions, running interactively on one accelerator without explicit geometry, physics or game logic.",
 "how_it_works": "Training happens in two phases. First, an RL agent plays the target game (Doom in the paper) while frames, actions and the game state are recorded as a large dataset. Second, a pretrained text-to-image latent diffusion model is fine-tuned to generate the next frame conditioned on a window of previous frames and actions; action tokens replace the text conditioning, and previous frames enter as latent channels concatenated to the noisy latent. To stop autoregressive drift over long play, the training adds noise augmentation to the context frames with the noise level provided to the model, so it learns to correct accumulated errors. At inference only a few denoising steps are used, and the decoder is fine-tuned to improve small details such as the heads-up display. The result plays like the original at interactive rates but has no persistent world state beyond its context window.",
 "when_to_use": "Study it when exploring neural simulators and world models as an alternative to a hand-built renderer, for games that already have lots of recorded play. Prefer `genie-world-models` for learned, action-controllable environments from unlabelled video, `marble-world-model` for persistent 3D generation, and a conventional engine plus `neural-radiance-caching`-style learned shading when determinism and editing matter.",
 "cost": {
  "class": "heavy",
  "notes": "The paper reports about 20 frames per second on a single TPU (an accelerator, not a consumer GPU); model size and denoising steps set the budget."
 },
 "failure_modes": [
  "Loss of long-term consistency: items, enemy positions and map layout drift beyond the context window",
  "Accumulating autoregressive error causes colour drift, blur or hallucination over long sessions",
  "No exact game rules: health, ammo and physics are approximated visually",
  "Training needs a large, action-labelled gameplay dataset per game",
  "Latency and hardware requirements far above the original engine"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "arxiv:2408.14837",
   "type": "paper",
   "title": "Diffusion Models Are Real-Time Game Engines",
   "authors": [
    "Dani Valevski",
    "Yaniv Leviathan",
    "Moab Arar",
    "Shlomi Fruchter"
   ],
   "year": 2024,
   "venue": "arXiv preprint (cs.LG)",
   "url": "https://arxiv.org/abs/2408.14837",
   "ids": {
    "arxiv": "2408.14837"
   },
   "license": null,
   "extra": {
    "arxiv_version": "2",
    "category": "cs.LG"
   },
   "provenance": {
    "title": {
     "authority": "arxiv",
     "endpoint": "https://export.arxiv.org/api/query?id_list=2408.14837",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "arxiv",
     "endpoint": "https://export.arxiv.org/api/query?id_list=2408.14837",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "arxiv",
     "endpoint": "https://export.arxiv.org/api/query?id_list=2408.14837",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "arxiv",
     "endpoint": "https://export.arxiv.org/api/query?id_list=2408.14837",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "arxiv",
     "endpoint": "https://export.arxiv.org/api/query?id_list=2408.14837",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "valevski2024diffusion"
  },
  {
   "role": "tutorial",
   "key": "url:https://gamengen.github.io/",
   "type": "tutorial",
   "title": "Diffusion Models Are Real-Time Game Engines (project page)",
   "authors": [
    "Valevski",
    "Leviathan",
    "Arar",
    "Fruchter"
   ],
   "year": null,
   "venue": "gamengen.github.io",
   "url": "https://gamengen.github.io/",
   "ids": {},
   "license": null,
   "extra": {
    "http_status": 200,
    "live": true,
    "archive": {
     "url": "http://web.archive.org/web/20261114073744/https://gamengen.github.io/",
     "timestamp": "20261114073744"
    },
    "page_title": "GameNGen",
    "host": "gamengen.github.io",
    "title_confirmed_by_page": false,
    "title_unconfirmed": true
   },
   "provenance": {
    "title": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "http",
     "endpoint": "GET https://gamengen.github.io/ → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "http",
     "endpoint": "GET https://gamengen.github.io/ → 200",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "research-draft",
     "endpoint": "title_hint/author_hint, checked against page title where available",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 0,
   "__bib": "valevskidiffusion"
  }
 ],
 "presets": [
  {
   "id": "gamengen-live",
   "title": "GameNGen — DDIM denoising latent frame (left) vs synthesized playable corridor engine (right)",
   "runtime": "glsl-fragment",
   "params": {
    "P_NOISE_LVL": 0.45,
    "P_WALK_SPEED": 1,
    "P_NEON_GAIN": 1.15,
    "P_SPLIT": 0.46
   },
   "basis": "original",
   "license_note": "MIT — written for this index.",
   "code": "const float P_NOISE_LVL = 0.45; // P Diffusion Noise [0.05, 0.95, 0.02]\nconst float P_WALK_SPEED = 1.0; // P Corridor Speed [0.0, 2.5, 0.05]\nconst float P_NEON_GAIN = 1.15; // P Corridor Glow [0.3, 2.0, 0.05]\nconst float P_SPLIT = 0.46; // P Latent / Frame Split [0.0, 1.0, 0.02]\n\nfloat hash21(vec2 p) {\n  p = fract(p * vec2(127.1, 311.7));\n  p += dot(p, p + 34.5);\n  return fract(p.x * p.y);\n}\n\n// First-person sci-fi/retro FPS corridor SDF for neural game engine synthesis\nvec2 mapCorridor(vec3 p) {\n  float floorD = p.y + 0.88;\n  float ceilD = 0.92 - p.y;\n  float wallD = 1.22 - abs(p.x);\n  // Repeating structural ribs along Z\n  float rz = mod(p.z + 1.0, 2.0) - 1.0;\n  float ribX = 1.02 - abs(p.x);\n  float ribZ = abs(rz) - 0.14;\n  float rib = max(ribX, ribZ);\n  float d = min(min(floorD, ceilD), min(wallD, rib));\n  float mat = 1.0;\n  if (abs(d - floorD) < 0.002) mat = 2.0;\n  else if (abs(d - rib) < 0.002) mat = 3.0;\n  else if (abs(d - ceilD) < 0.002) mat = 4.0;\n  return vec2(d, mat);\n}\n\nvec3 calcNormal(vec3 p) {\n  vec2 e = vec2(0.003, 0.0);\n  return normalize(vec3(\n    mapCorridor(p + e.xyy).x - mapCorridor(p - e.xyy).x,\n    mapCorridor(p + e.yxy).x - mapCorridor(p - e.yxy).x,\n    mapCorridor(p + e.yyx).x - mapCorridor(p - e.yyx).x\n  ));\n}\n\nvec3 aces(vec3 x) {\n  x = max(x, 0.0);\n  return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);\n}\n\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n  vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;\n  float screenX = fragCoord.x / max(iResolution.x, 1.0);\n  float screenY = fragCoord.y / max(iResolution.y, 1.0);\n  float split = clamp(P_SPLIT, 0.0, 1.0);\n  float noiseLvl = clamp(P_NOISE_LVL, 0.05, 0.95);\n  float speed = max(P_WALK_SPEED, 0.0);\n  float neon = clamp(P_NEON_GAIN, 0.2, 2.2);\n\n  // Subtle head-bob walking motion\n  float bob = sin(iTime * 5.2 * speed) * 0.03;\n  vec3 ro = vec3(sin(iTime * 0.65 * speed) * 0.18, bob, -iTime * 2.1 * speed);\n  vec3 rd = normalize(vec3(uv.x, uv.y, -1.25));\n\n  vec3 col = vec3(0.04, 0.03, 0.05);\n  float t = 0.05;\n  vec2 hit = vec2(1e5, 0.0);\n  for (int i = 0; i < 52; i++) {\n    vec2 h = mapCorridor(ro + rd * t);\n    if (h.x < 0.004) { hit = vec2(t, h.y); break; }\n    t += h.x;\n    if (t > 14.0) break;\n  }\n\n  if (hit.x < 1e4) {\n    vec3 p = ro + rd * hit.x;\n    vec3 n = calcNormal(p);\n    // Periodic ceiling/wall corridor lights\n    float lz = floor((p.z + 1.0) / 2.0) * 2.0;\n    vec3 lPos = vec3(0.0, 0.72, lz);\n    vec3 toL = lPos - p;\n    float dL = length(toL);\n    vec3 lDir = toL / max(dL, 1e-4);\n    float atten = 1.0 / (1.0 + 0.38 * dL * dL);\n    float diff = max(dot(n, lDir), 0.0);\n\n    vec3 alb = vec3(0.32, 0.30, 0.28);\n    if (hit.y > 1.5 && hit.y < 2.5) {\n      // Industrial tiled metal floor\n      vec2 tile = step(0.06, fract(p.xz * 1.5));\n      alb = mix(vec3(0.16, 0.18, 0.22), vec3(0.34, 0.36, 0.40), tile.x * tile.y);\n    } else if (hit.y > 2.5 && hit.y < 3.5) {\n      alb = vec3(0.46, 0.24, 0.18);\n    } else if (hit.y > 3.5) {\n      alb = vec3(0.22, 0.24, 0.28);\n    }\n\n    vec3 lightCol = mix(vec3(1.0, 0.62, 0.26), vec3(0.24, 0.88, 1.0), 0.5 + 0.5 * sin(lz * 0.7));\n    col = alb * (0.14 + 1.25 * diff * atten * lightCol);\n\n    // Emissive wall strip + ceiling strip\n    float strip = exp(-abs(p.y + 0.10) * 24.0) * step(0.85, abs(n.x));\n    float ceilGlow = exp(-abs(p.x) * 6.0) * step(0.85, -n.y) * smoothstep(0.35, 0.10, abs(mod(p.z + 1.0, 2.0) - 1.0));\n    col += lightCol * (strip * 0.85 + ceilGlow * 1.45) * neon;\n\n    // Distance atmospheric haze\n    float fog = 1.0 - exp(-hit.x * 0.16);\n    col = mix(col, vec3(0.08, 0.05, 0.09), fog);\n  }\n\n  // Retro FPS HUD bar along bottom + center crosshair\n  if (screenY < 0.14) {\n    float bar = smoothstep(0.14, 0.132, screenY);\n    vec3 hud = vec3(0.12, 0.13, 0.16);\n    float hp = step(abs(screenX - 0.25), 0.10) * step(abs(screenY - 0.07), 0.025);\n    float ammo = step(abs(screenX - 0.75), 0.10) * step(abs(screenY - 0.07), 0.025);\n    hud = mix(hud, vec3(0.95, 0.24, 0.18), hp);\n    hud = mix(hud, vec3(0.96, 0.78, 0.22), ammo);\n    col = mix(col, hud, bar * 0.92);\n  }\n  float crossH = smoothstep(0.005, 0.001, abs(uv.y)) * smoothstep(0.032, 0.024, abs(uv.x));\n  float crossV = smoothstep(0.005, 0.001, abs(uv.x)) * smoothstep(0.032, 0.024, abs(uv.y));\n  col = mix(col, vec3(0.95, 0.98, 0.85), max(crossH, crossV) * 0.75);\n\n  // Left side: Intermediate DDIM diffusion denoising step (noisy latent patches + denoising scan)\n  if (screenX < split) {\n    vec2 patchCell = floor(fragCoord / 6.0);\n    float n1 = hash21(patchCell + floor(iTime * 12.0) * 0.31);\n    float n2 = hash21(patchCell * 1.37 + floor(iTime * 12.0) * 0.19);\n    float n3 = hash21(patchCell * 1.91 + floor(iTime * 12.0) * 0.43);\n    vec3 epsNoise = vec3(n1, n2, n3) - 0.5;\n    float alphaBar = 1.0 - noiseLvl * 0.72;\n    col = sqrt(alphaBar) * col + sqrt(1.0 - alphaBar) * (0.45 + epsNoise * 0.95);\n  }\n\n  float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));\n  col = mix(col, vec3(0.95, 0.97, 1.0), sep);\n\n  fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);\n}",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-30",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "gamengen",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-30T20:35:48.000Z",
     "renderer": "Headless EGL Tesla T4/PCIe/SSE2, OpenGL 3.30 Core, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.5052,
      "std": 0.2015,
      "min": 0.1823,
      "max": 0.9138
     },
     "image": "/specimens/gamengen-live.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "genie-world-models",
  "marble-world-model",
  "neural-radiance-caching"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "genie-world-models",
   "why": "Latent-action models can supply control labels that a GameNGen-style next-frame diffusion model would otherwise need from game logs."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/genai/gamengen.json"
 },
 "solves": [
  "can a neural network replace the game engine rendering loop",
  "want a playable neural simulation from recorded gameplay",
  "predict next frame from player actions with diffusion",
  "need real time interactive video generation",
  "generated game world forgets what was behind me"
 ],
 "authority": "Valevski et al., 2024",
 "url": "https://texelatlas.vercel.app/t/gamengen/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 13.08,
  "tier": "moderate",
  "p50_ms": 0.4303,
  "p95_ms": 0.4472,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 32,
  "preset_id": "gamengen-live",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 11.77,
   "tier": "moderate",
   "p50_ms": 0.1871,
   "p95_ms": 0.1901,
   "speedup_x": 2.3,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 8.3,
   "tier": "moderate",
   "p50_ms": 0.2391,
   "p95_ms": 0.2434,
   "speedup_x": 1.8,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}