[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ASQAZX72S5GE2Y4TDK2F6A":3,"skill-same:01M7ASQAZX72S5GE2Y4TDK2F6A":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7ASQAZX72S5GE2Y4TDK2F6A","game-engines-loop-and-architecture",null,"Use when starting a game or structuring its code: the engine decision (Unity, Unreal, Godot, custom), licensing as an engineering risk, market reality, the game loop structure (fixed vs variable time step, interpolation) and determinism, the architecture progression, ECS and when it pays off, the patterns that earn their keep (observer, command, object pool), and separating game logic from the engine. Includes the router for the whole video-game-development reference.","the-vibey-project\u002Fvibey","the-vibey-project","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F329298758?v=4","01M7AJHGZ9722CTJ4JNQZVRH0Q","the vibey project","01M7AJHGZVMG2K7TGXQ6XFHVG3",5,"MIT","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvideo-game-development\u002Fskills\u002Fgame-engines-loop-and-architecture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: game-engines-loop-and-architecture\ndescription: \"Use when starting a game or structuring its code: the engine decision (Unity, Unreal, Godot, custom), licensing as an engineering risk, market reality, the game loop structure (fixed vs variable time step, interpolation) and determinism, the architecture progression, ECS and when it pays off, the patterns that earn their keep (observer, command, object pool), and separating game logic from the engine. Includes the router for the whole video-game-development reference.\"\n---\n\n# Game Development: Engines, the Game Loop, and Code Architecture\n\n> **Part 1 of 5** of the *Video Game Development* reference (plugin `video-game-development`), covering §0–§3. Sibling skills: `game-rendering-physics-animation-and-audio` (§4–§7), `game-ai-networking-and-tools` (§8–§10), `game-performance-feel-and-shipping` (§11–§15), `game-development-reference` (§16–§20). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §17 → `game-development-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not tutorial. Sections are independent. Three markers:\n> - **[DURABLE]** — real-time systems reality, human perception, or a lesson the industry\n>   has relearned every console generation. Does not expire.\n> - **[VERSIONED]** — specific to an engine version, API, platform, or market condition.\n>   Verify before relying on it.\n> - **[CONTESTED]** — practitioners genuinely disagree, usually because the right answer\n>   depends on team size and genre.\n>\n> **⚠️ GOTCHA** boxes mark the mistakes that ship broken games, blow the frame budget, or\n> destroy a studio's schedule.\n>\n> **The three framings that organize everything below:**\n> 1. **A game is a soft-real-time simulation with a hard deadline, 60 times a second.**\n>    16.67 ms at 60 fps, 8.33 ms at 120. Everything — rendering, physics, AI, audio,\n>    networking, streaming, GC — shares that budget. **Consistency beats peak framerate**;\n>    a stable 30 feels better than a 60 that stutters.\n> 2. **Games are content pipelines with a game attached.** On any team above about five\n>    people, the tools, build system, and iteration loop determine your output more than\n>    your engine code does. Ten-minute iteration times will cost you the game.\n> 3. **Scope is the thing that kills projects, not technology.** The overwhelming majority\n>    of unfinished games died of ambition, not of a hard technical problem. §14 → `game-performance-feel-and-shipping` is the\n>    section most people need and skip.\n\n---\n\n## §0. Routing\n\n### 0.1 The question router\n\n| Asked about... | Go to |\n|---|---|\n| Which engine, and what it costs | §1 |\n| The game loop, time step, determinism | §2 |\n| Code architecture: ECS, components, objects | §3 |\n| Rendering: pipelines, graphics APIs, shaders | §4 → `game-rendering-physics-animation-and-audio` |\n| Physics and collision | §5 → `game-rendering-physics-animation-and-audio` |\n| Animation | §6 → `game-rendering-physics-animation-and-audio` |\n| Audio | §7 → `game-rendering-physics-animation-and-audio` |\n| Gameplay AI and pathfinding | §8 → `game-ai-networking-and-tools` |\n| Networking and multiplayer | §9 → `game-ai-networking-and-tools` |\n| Tools, content pipeline, iteration | §10 → `game-ai-networking-and-tools` |\n| Performance, frame budget, memory | §11 → `game-performance-feel-and-shipping` |\n| Game feel, juice, input latency | §12 → `game-performance-feel-and-shipping` |\n| Build, test, QA, certification | §13 → `game-performance-feel-and-shipping` |\n| Production, scope, and shipping | §14 → `game-performance-feel-and-shipping` |\n| Business: monetization, live ops, platforms | §15 → `game-performance-feel-and-shipping` |\n| Accessibility | §16.7 → `game-development-reference` and below |\n| \"Don't do this\" | §15.4 → `game-performance-feel-and-shipping` \u002F §15.5 → `game-performance-feel-and-shipping` → see §15 → `game-performance-feel-and-shipping` table |\n| \"Which approach is better?\" | §16 → `game-development-reference` (contested) |\n| \"Is this still current?\" | §17 → `game-development-reference` |\n| Books, talks, people | §18 → `game-development-reference` |\n\n*(Anti-patterns are consolidated in the table at the end of §15 → `game-performance-feel-and-shipping`.)*\n\n---\n\n## §1. Engines\n\n### 1.1 The decision\n\n**[DURABLE] Use an existing engine.** Writing your own is justified when you have an\nunusual technical requirement no engine serves, a large experienced team, or the engine\n*is* the product. \"I'll learn more\" is a fine reason for a hobby project and a poor reason\nfor a commercial one.\n\n**[VERSIONED — mid-2026 landscape.]**\n\n| Engine | Language | Cost model | Best at |\n|---|---|---|---|\n| **Unreal Engine 5.x** | C++ \u002F Blueprints | Free to **$1M lifetime gross**, then **5%** royalty | High-fidelity 3D, AAA, photoreal. **Nanite** (virtualized geometry) and **Lumen** (real-time GI) eliminate traditional LOD and light-baking work |\n| **Unity 6.x** | C# | Seat-based subscription; **Personal free under $200K\u002Fyr revenue**, Pro above | Mobile (~**70% of top-grossing mobile titles**), cross-platform breadth, 2D, XR |\n| **Godot 4.x** | GDScript \u002F C# \u002F C++ | **MIT — free forever, no royalty, no revenue threshold** | 2D (best-in-class workflow), small teams, licence-risk-averse studios |\n| **GameMaker** | GML | Tiered | 2D, beginners, fast prototyping |\n| **Bevy \u002F raylib \u002F SDL \u002F MonoGame \u002F LÖVE** | Rust \u002F C \u002F C# \u002F Lua | Open source | Custom engines, jams, programmers who want control |\n| **In-house** | — | Your salaries | ~14% of surveyed developers. Justified at scale or for a unique requirement |\n\n### 1.2 Licensing is an engineering risk, not just a finance question\n\n**[DURABLE, learned the hard way] Your engine licence can change under you mid-project,\nand that is a real technical risk requiring a real mitigation.** The canonical case:\n\nUnity's 2019 Terms-of-Service change (which blocked SpatialOS) prompted enough backlash\nthat Unity added a protective commitment — if terms changed adversely, developers could\nelect to continue under the prior terms. **That clause was quietly removed on 3 April\n2023**, five months before the runtime fee was announced. In September 2023 Unity\nannounced a **per-install runtime fee of up to $0.20**; the backlash was severe, the CEO\ndeparted, and **new CEO Matt Bromberg cancelled it entirely in September 2024**, reverting\nto seat-based subscriptions.\n\nThe consequences are still visible in 2026: measurable migration to Godot and Unreal, and\na persistent trust deficit that shows up in *new-project* engine selection more than in\nexisting projects.\n\n**What to actually do about it:** read the current licence rather than the summary you\nremember; **archive the version of the terms you agreed to**; keep gameplay logic\nseparated from engine-specific APIs where cheap (§3.4); and treat \"could we port this if\nwe had to?\" as a question with a real answer. Godot's structural pitch is precisely this —\n**a nonprofit foundation and an MIT licence, so there is no pricing model that can change**.\n\n### 1.3 Market reality\n\n**[VERSIONED]** The numbers that matter for hiring, asset availability, and community\nsupport as of 2026:\n- **Unreal out-earned Unity on Steam for the first time since 2018** — 31% of 2024 Steam\n  revenue vs. Unity's 26% (Video Game Insights) — while **Unity still ships the most games**\n  (51% of 2024 Steam releases).\n- **Developer mindshare has flipped**: **42% named Unreal their primary engine vs. 30% for\n  Unity** (GDC State of the Game Industry 2026).\n- **Godot is the fastest-growing engine by every open metric**: Steam releases grew from\n  618 (2023–24) to **2,864 (2025–26), roughly 4.6×**; ~114,700 GitHub stars as of mid-2026.\n- **Unity remains dominant on mobile** — roughly half of all mobile games, ~70% of the\n  top-grossing.\n\n**[DURABLE] Read those as \"where the ecosystem is,\" not \"which is better.\"** Asset store\ndepth, tutorial coverage, hireable experience, and middleware support follow market share,\nand those are often worth more than a feature comparison.\n\n---\n\n## §2. The Game Loop\n\n### 2.1 The structure\n\n```\nwhile (running) {\n    processInput();\n    while (accumulator >= FIXED_DT) {   \u002F\u002F fixed-step simulation\n        update(FIXED_DT);\n        accumulator -= FIXED_DT;\n    }\n    render(accumulator \u002F FIXED_DT);      \u002F\u002F interpolate between sim states\n}\n```\n\n**[DURABLE] \"Fix Your Timestep!\" (Glenn Fiedler) is the single most-referenced article in\ngame programming, and for good reason.** The variants and their failure modes:\n\n| Approach | Problem |\n|---|---|\n| **Variable delta time everywhere** | Physics behaves differently at different framerates. Non-deterministic. **Tunneling at low fps.** Simple, and wrong for anything with physics |\n| **Fixed timestep, no interpolation** | Deterministic but produces visible judder when render rate ≠ sim rate |\n| **Fixed timestep + accumulator + render interpolation** | **The standard correct answer.** Deterministic sim, smooth render |\n| **Semi-fixed with a max frame time clamp** | Necessary in practice — prevents the \"spiral of death\" |\n\n> **⚠️ GOTCHA — the spiral of death.** If a frame takes longer than real time, the\n> accumulator grows, so you run more sim steps, so the frame takes longer still. **Always\n> clamp the maximum accumulated time** (e.g. never simulate more than 5 steps in one\n> frame) and accept slow-motion over a freeze. Every engine that skips this eventually\n> hangs on someone's machine.\n\n### 2.2 Determinism\n\n**[DURABLE] You need determinism for**: rollback netcode (§9.3 → `game-ai-networking-and-tools`), replays, lockstep\nmultiplayer, reproducible bug reports, and automated testing. It is much easier to design\nin than to add later.\n\nRequirements: **fixed timestep**, **fixed iteration order** (⚠️ hash-map iteration order is\nthe classic determinism bug), a **seeded, explicitly-managed RNG** (separate streams for\nsimulation and cosmetics), and **no floating-point divergence** across platforms — which\nis the hard one, since compiler flags, `x87` vs. SSE, FMA contraction, and library\nimplementations of `sin`\u002F`cos` all differ. **Fixed-point arithmetic** is the sledgehammer\nanswer, used by many fighting games and RTSs for exactly this reason.\n\n---\n\n## §3. Code Architecture\n\n### 3.1 The progression\n\n```\nGod object            → everything in one Player class. Fine for a jam\nInheritance hierarchy → GameObject → Character → Enemy → FlyingEnemy...\n                        ⚠️ collapses at the \"flying enemy that swims\" problem\nComponent composition → an entity HAS a Transform, a Renderer, a Health...\n                        Unity's GameObject\u002FMonoBehaviour model\nECS (data-oriented)   → entities are IDs, components are plain data in packed arrays,\n                        systems are functions over component queries\n```\n\n**[DURABLE] Composition over inheritance is the one architectural lesson the industry has\nfully internalized.** Deep inheritance hierarchies for game entities fail predictably and\nalways for the same reason: real games need arbitrary combinations of behaviours that the\ntree can't express.\n\n### 3.2 ECS\n\n**Why it exists**: cache locality (§11.3 → `game-performance-feel-and-shipping`), trivially parallel systems, and runtime\ncomposition.\n```\nEntity 42  = just an integer ID\nComponents: Position[42], Velocity[42], Health[42]      ← packed contiguous arrays\nSystem:     for each entity with (Position, Velocity): pos += vel * dt\n```\n\n**[CONTESTED] How much ECS you need.** *For*: measurable performance on entity-heavy\nsimulations, clean parallelism, and no inheritance tangles. *Against*: real overhead in\nindirection and mental model, worse for one-off entities and complex singular systems,\nand cross-component logic gets awkward. **The honest synthesis: use ECS where you have\nmany similar things (particles, units, bullets, crowds); use plain objects for the few\nspecial things (the player, the camera, the UI).** Most shipped games are hybrids, and\npurity here is a much smaller win than its advocates suggest.\n\nUnity's DOTS is the mainstream version, now production-ready after a long and\noften-criticized maturation; Bevy is ECS-native; EnTT and flecs are the C++ standards.\n\n### 3.3 Patterns that earn their keep\n\n**Game Programming Patterns** (Robert Nystrom, free online — §18 → `game-development-reference`) is the canonical\nreference. The ones you'll actually use: **Update Method**, **Component**,\n**Object Pool** (⚠️ **essential** — allocating during gameplay causes hitches, §11.4 → `game-performance-feel-and-shipping`),\n**State machine** and **hierarchical state machine** (the backbone of character control),\n**Observer\u002Fevent bus** (decouples systems; ⚠️ becomes untraceable spaghetti if\noverused), **Service Locator**, **Command** (input remapping, undo, replay, netcode),\n**Spatial Partition** (§5.2 → `game-rendering-physics-animation-and-audio`), **Dirty Flag**, and **Data Locality**.\n\n### 3.4 Separating game logic from engine\n\n**[DURABLE] Worth doing to a moderate degree, not religiously.** Keeping your rules,\neconomy, and state machines in engine-agnostic code makes them unit-testable, portable,\nand usable in a headless server. Wrapping every engine call in an abstraction layer is\nover-engineering that will cost you more than it saves. **The test: could you run your\ncombat resolution in a console app with no renderer?** If yes, you've drawn the line in\nabout the right place.\n","# Game Development: Engines, the Game Loop, and Code Architecture\n\n> **Part 1 of 5** of the *Video Game Development* reference (plugin `video-game-development`), covering §0–§3. Sibling skills: `game-rendering-physics-animation-and-audio` (§4–§7), `game-ai-networking-and-tools` (§8–§10), `game-performance-feel-and-shipping` (§11–§15), `game-development-reference` (§16–§20). Section numbers are shared across the set; a reference written as §N → `skill` points into that sibling skill.\n>\n> **Currency:** Verified August 2026. See §17 → `game-development-reference` for the currency snapshot and what goes stale first.\n\n> **How to read this.** Reference, not tutorial. Sections are independent. Three markers:\n> - **[DURABLE]** — real-time systems reality, human perception, or a lesson the industry\n>   has relearned every console generation. Does not expire.\n> - **[VERSIONED]** — specific to an engine version, API, platform, or market condition.\n>   Verify before relying on it.\n> - **[CONTESTED]** — practitioners genuinely disagree, usually because the right answer\n>   depends on team size and genre.\n>\n> **⚠️ GOTCHA** boxes mark the mistakes that ship broken games, blow the frame budget, or\n> destroy a studio's schedule.\n>\n> **The three framings that organize everything below:**\n> 1. **A game is a soft-real-time simulation with a hard deadline, 60 times a second.**\n>    16.67 ms at 60 fps, 8.33 ms at 120. Everything — rendering, physics, AI, audio,\n>    networking, streaming, GC — shares that budget. **Consistency beats peak framerate**;\n>    a stable 30 feels better than a 60 that stutters.\n> 2. **Games are content pipelines with a game attached.** On any team above about five\n>    people, the tools, build system, and iteration loop determine your output more than\n>    your engine code does. Ten-minute iteration times will cost you the game.\n> 3. **Scope is the thing that kills projects, not technology.** The overwhelming majority\n>    of unfinished games died of ambition, not of a hard technical problem. §14 → `game-performance-feel-and-shipping` is the\n>    section most people need and skip.\n\n---\n\n## §0. Routing\n\n### 0.1 The question router\n\n| Asked about... | Go to |\n|---|---|\n| Which engine, and what it costs | §1 |\n| The game loop, time step, determinism | §2 |\n| Code architecture: ECS, components, objects | §3 |\n| Rendering: pipelines, graphics APIs, shaders | §4 → `game-rendering-physics-animation-and-audio` |\n| Physics and collision | §5 → `game-rendering-physics-animation-and-audio` |\n| Animation | §6 → `game-rendering-physics-animation-and-audio` |\n| Audio | §7 → `game-rendering-physics-animation-and-audio` |\n| Gameplay AI and pathfinding | §8 → `game-ai-networking-and-tools` |\n| Networking and multiplayer | §9 → `game-ai-networking-and-tools` |\n| Tools, content pipeline, iteration | §10 → `game-ai-networking-and-tools` |\n| Performance, frame budget, memory | §11 → `game-performance-feel-and-shipping` |\n| Game feel, juice, input latency | §12 → `game-performance-feel-and-shipping` |\n| Build, test, QA, certification | §13 → `game-performance-feel-and-shipping` |\n| Production, scope, and shipping | §14 → `game-performance-feel-and-shipping` |\n| Business: monetization, live ops, platforms | §15 → `game-performance-feel-and-shipping` |\n| Accessibility | §16.7 → `game-development-reference` and below |\n| \"Don't do this\" | §15.4 → `game-performance-feel-and-shipping` \u002F §15.5 → `game-performance-feel-and-shipping` → see §15 → `game-performance-feel-and-shipping` table |\n| \"Which approach is better?\" | §16 → `game-development-reference` (contested) |\n| \"Is this still current?\" | §17 → `game-development-reference` |\n| Books, talks, people | §18 → `game-development-reference` |\n\n*(Anti-patterns are consolidated in the table at the end of §15 → `game-performance-feel-and-shipping`.)*\n\n---\n\n## §1. Engines\n\n### 1.1 The decision\n\n**[DURABLE] Use an existing engine.** Writing your own is justified when you have an\nunusual technical requirement no engine serves, a large experienced team, or the engine\n*is* the product. \"I'll learn more\" is a fine reason for a hobby project and a poor reason\nfor a commercial one.\n\n**[VERSIONED — mid-2026 landscape.]**\n\n| Engine | Language | Cost model | Best at |\n|---|---|---|---|\n| **Unreal Engine 5.x** | C++ \u002F Blueprints | Free to **$1M lifetime gross**, then **5%** royalty | High-fidelity 3D, AAA, photoreal. **Nanite** (virtualized geometry) and **Lumen** (real-time GI) eliminate traditional LOD and light-baking work |\n| **Unity 6.x** | C# | Seat-based subscription; **Personal free under $200K\u002Fyr revenue**, Pro above | Mobile (~**70% of top-grossing mobile titles**), cross-platform breadth, 2D, XR |\n| **Godot 4.x** | GDScript \u002F C# \u002F C++ | **MIT — free forever, no royalty, no revenue threshold** | 2D (best-in-class workflow), small teams, licence-risk-averse studios |\n| **GameMaker** | GML | Tiered | 2D, beginners, fast prototyping |\n| **Bevy \u002F raylib \u002F SDL \u002F MonoGame \u002F LÖVE** | Rust \u002F C \u002F C# \u002F Lua | Open source | Custom engines, jams, programmers who want control |\n| **In-house** | — | Your salaries | ~14% of surveyed developers. Justified at scale or for a unique requirement |\n\n### 1.2 Licensing is an engineering risk, not just a finance question\n\n**[DURABLE, learned the hard way] Your engine licence can change under you mid-project,\nand that is a real technical risk requiring a real mitigation.** The canonical case:\n\nUnity's 2019 Terms-of-Service change (which blocked SpatialOS) prompted enough backlash\nthat Unity added a protective commitment — if terms changed adversely, developers could\nelect to continue under the prior terms. **That clause was quietly removed on 3 April\n2023**, five months before the runtime fee was announced. In September 2023 Unity\nannounced a **per-install runtime fee of up to $0.20**; the backlash was severe, the CEO\ndeparted, and **new CEO Matt Bromberg cancelled it entirely in September 2024**, reverting\nto seat-based subscriptions.\n\nThe consequences are still visible in 2026: measurable migration to Godot and Unreal, and\na persistent trust deficit that shows up in *new-project* engine selection more than in\nexisting projects.\n\n**What to actually do about it:** read the current licence rather than the summary you\nremember; **archive the version of the terms you agreed to**; keep gameplay logic\nseparated from engine-specific APIs where cheap (§3.4); and treat \"could we port this if\nwe had to?\" as a question with a real answer. Godot's structural pitch is precisely this —\n**a nonprofit foundation and an MIT licence, so there is no pricing model that can change**.\n\n### 1.3 Market reality\n\n**[VERSIONED]** The numbers that matter for hiring, asset availability, and community\nsupport as of 2026:\n- **Unreal out-earned Unity on Steam for the first time since 2018** — 31% of 2024 Steam\n  revenue vs. Unity's 26% (Video Game Insights) — while **Unity still ships the most games**\n  (51% of 2024 Steam releases).\n- **Developer mindshare has flipped**: **42% named Unreal their primary engine vs. 30% for\n  Unity** (GDC State of the Game Industry 2026).\n- **Godot is the fastest-growing engine by every open metric**: Steam releases grew from\n  618 (2023–24) to **2,864 (2025–26), roughly 4.6×**; ~114,700 GitHub stars as of mid-2026.\n- **Unity remains dominant on mobile** — roughly half of all mobile games, ~70% of the\n  top-grossing.\n\n**[DURABLE] Read those as \"where the ecosystem is,\" not \"which is better.\"** Asset store\ndepth, tutorial coverage, hireable experience, and middleware support follow market share,\nand those are often worth more than a feature comparison.\n\n---\n\n## §2. The Game Loop\n\n### 2.1 The structure\n\n```\nwhile (running) {\n    processInput();\n    while (accumulator >= FIXED_DT) {   \u002F\u002F fixed-step simulation\n        update(FIXED_DT);\n        accumulator -= FIXED_DT;\n    }\n    render(accumulator \u002F FIXED_DT);      \u002F\u002F interpolate between sim states\n}\n```\n\n**[DURABLE] \"Fix Your Timestep!\" (Glenn Fiedler) is the single most-referenced article in\ngame programming, and for good reason.** The variants and their failure modes:\n\n| Approach | Problem |\n|---|---|\n| **Variable delta time everywhere** | Physics behaves differently at different framerates. Non-deterministic. **Tunneling at low fps.** Simple, and wrong for anything with physics |\n| **Fixed timestep, no interpolation** | Deterministic but produces visible judder when render rate ≠ sim rate |\n| **Fixed timestep + accumulator + render interpolation** | **The standard correct answer.** Deterministic sim, smooth render |\n| **Semi-fixed with a max frame time clamp** | Necessary in practice — prevents the \"spiral of death\" |\n\n> **⚠️ GOTCHA — the spiral of death.** If a frame takes longer than real time, the\n> accumulator grows, so you run more sim steps, so the frame takes longer still. **Always\n> clamp the maximum accumulated time** (e.g. never simulate more than 5 steps in one\n> frame) and accept slow-motion over a freeze. Every engine that skips this eventually\n> hangs on someone's machine.\n\n### 2.2 Determinism\n\n**[DURABLE] You need determinism for**: rollback netcode (§9.3 → `game-ai-networking-and-tools`), replays, lockstep\nmultiplayer, reproducible bug reports, and automated testing. It is much easier to design\nin than to add later.\n\nRequirements: **fixed timestep**, **fixed iteration order** (⚠️ hash-map iteration order is\nthe classic determinism bug), a **seeded, explicitly-managed RNG** (separate streams for\nsimulation and cosmetics), and **no floating-point divergence** across platforms — which\nis the hard one, since compiler flags, `x87` vs. SSE, FMA contraction, and library\nimplementations of `sin`\u002F`cos` all differ. **Fixed-point arithmetic** is the sledgehammer\nanswer, used by many fighting games and RTSs for exactly this reason.\n\n---\n\n## §3. Code Architecture\n\n### 3.1 The progression\n\n```\nGod object            → everything in one Player class. Fine for a jam\nInheritance hierarchy → GameObject → Character → Enemy → FlyingEnemy...\n                        ⚠️ collapses at the \"flying enemy that swims\" problem\nComponent composition → an entity HAS a Transform, a Renderer, a Health...\n                        Unity's GameObject\u002FMonoBehaviour model\nECS (data-oriented)   → entities are IDs, components are plain data in packed arrays,\n                        systems are functions over component queries\n```\n\n**[DURABLE] Composition over inheritance is the one architectural lesson the industry has\nfully internalized.** Deep inheritance hierarchies for game entities fail predictably and\nalways for the same reason: real games need arbitrary combinations of behaviours that the\ntree can't express.\n\n### 3.2 ECS\n\n**Why it exists**: cache locality (§11.3 → `game-performance-feel-and-shipping`), trivially parallel systems, and runtime\ncomposition.\n```\nEntity 42  = just an integer ID\nComponents: Position[42], Velocity[42], Health[42]      ← packed contiguous arrays\nSystem:     for each entity with (Position, Velocity): pos += vel * dt\n```\n\n**[CONTESTED] How much ECS you need.** *For*: measurable performance on entity-heavy\nsimulations, clean parallelism, and no inheritance tangles. *Against*: real overhead in\nindirection and mental model, worse for one-off entities and complex singular systems,\nand cross-component logic gets awkward. **The honest synthesis: use ECS where you have\nmany similar things (particles, units, bullets, crowds); use plain objects for the few\nspecial things (the player, the camera, the UI).** Most shipped games are hybrids, and\npurity here is a much smaller win than its advocates suggest.\n\nUnity's DOTS is the mainstream version, now production-ready after a long and\noften-criticized maturation; Bevy is ECS-native; EnTT and flecs are the C++ standards.\n\n### 3.3 Patterns that earn their keep\n\n**Game Programming Patterns** (Robert Nystrom, free online — §18 → `game-development-reference`) is the canonical\nreference. The ones you'll actually use: **Update Method**, **Component**,\n**Object Pool** (⚠️ **essential** — allocating during gameplay causes hitches, §11.4 → `game-performance-feel-and-shipping`),\n**State machine** and **hierarchical state machine** (the backbone of character control),\n**Observer\u002Fevent bus** (decouples systems; ⚠️ becomes untraceable spaghetti if\noverused), **Service Locator**, **Command** (input remapping, undo, replay, netcode),\n**Spatial Partition** (§5.2 → `game-rendering-physics-animation-and-audio`), **Dirty Flag**, and **Data Locality**.\n\n### 3.4 Separating game logic from engine\n\n**[DURABLE] Worth doing to a moderate degree, not religiously.** Keeping your rules,\neconomy, and state machines in engine-agnostic code makes them unit-testable, portable,\nand usable in a headless server. Wrapping every engine call in an abstraction layer is\nover-engineering that will cost you more than it saves. **The test: could you run your\ncombat resolution in a console app with no renderer?** If yes, you've drawn the line in\nabout the right place.\n",{"name":5,"description":7},"develop","ae32736a1aabddabca5d2c96d665aa0ebc7d8700","src\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvideo-game-development\u002Fskills\u002Fgame-engines-loop-and-architecture",3,"https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey","https:\u002F\u002Fthe-vibey-project.github.io\u002Fvibey\u002F","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project","https:\u002F\u002Fvibewithadam.matthewsteinberger.com","freedom for software engineers","2026-11-15 05:47:42",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add the-vibey-project\u002Fvibey --skill game-engines-loop-and-architecture",{"tool":40,"command":41},"bunx","bunx skills add the-vibey-project\u002Fvibey --skill game-engines-loop-and-architecture",{"tool":43,"command":44},"pnpm","pnpm dlx skills add the-vibey-project\u002Fvibey --skill game-engines-loop-and-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fvideo-game-development\u002Fskills\u002Fgame-engines-loop-and-architecture\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7AT1FQJAE1FQYAMDTF490Y4","white-paper-writing","Use when writing white papers, technical reports, policy documents, thought leadership pieces, or any long-form authoritative document. Triggers on requests to write, structure, outline, or review white papers, technical reports, position papers, policy briefs, or evidence-driven arguments. Also use for B2B content marketing strategy, technical documentation requiring authority, academic-style reports, or any document that must educate while persuading. Use when someone asks \"how should I structure this\" for a long-form document.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fwhite-paper-writing\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7AT16BJRJJKK2MASXRZS76G","prose-technical-mechanics","Use when editing or writing prose at a technical\u002Fmechanical level: choosing between Anglo-Saxon and Latinate diction, placing information in topic vs stress positions, writing periodic vs cumulative sentences, handling sentence rhythm, punctuation as logic, transitions, paragraph structure, or phonesthetics. Use when someone wants to understand WHY prose works or doesn't, not just surface-level style advice. Triggers on word choice, sentence structure, emphasis, rhythm, diction, or any deep writing mechanics question.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-technical-mechanics\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7AT0W9HT0ZZ9Y287NW99MR3","prose-mechanics","Use when writing, editing, or analyzing prose style; when trying to avoid generic AI-sounding writing; when applying specific prose styles such as journalistic, academic, narrative, KJV biblical, Hemingway plain, Latinate\u002FJamesian, Orwellian, Augustan, Victorian, Early Modern (Bacon, Browne, Milton), or free indirect discourse; or when coaching someone on writing voice and mechanics. Triggers on any request to improve, analyze, or write in a specific prose style, to fix \"AI-sounding\" writing, to make prose more vivid or concrete, to vary sentence rhythm, or to understand how a particular writer achieves their effects.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fprose-mechanics\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7AT0KR635JX66X2X6F3E2CP","narrative-structure","Use when structuring stories, pitches, presentations, white papers, or any persuasive narrative; analyzing the hero's journey in fiction or non-fiction; applying StoryBrand for business communication; designing narrative arcs for thought leadership; or understanding Vogler, Snyder, Propp, or Campbell frameworks. Triggers on any narrative structure, storytelling, pitch structure, StoryBrand, hero's journey, three-act structure, Freytag, Save the Cat, narrative arc, or \"how should I structure this story\u002Fpitch\u002Fpresentation\" request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fnarrative-structure\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AT0AKGW09NKKZDYBT8VRDE","legal-brief-writing","Use when writing legal briefs, motions, or any court filing; when analyzing judicial cognition and persuasion; when applying elite brief-writing techniques from Roberts, Clement, Kagan, Garner; or when structuring legal arguments for maximum persuasion. Also use for autistic\u002Fneurodivergent advocates who need to understand how their natural communication style maps to elite legal advocacy. Triggers on any legal writing, brief drafting, motion preparation, or legal argument structuring request.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Flegal-brief-writing\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7AT00VWPS4Q8B5VEMXX9NQT","journal-publishability-criteria","Use whenever a research paper, article or preprint is being written, revised, reviewed or published, and specifically before every publication of docs\u002Fpaper.md. Covers what legitimate journals actually gate on, in order of gating — the editor's desk screen (scope, novelty, package problems), what reviewers judge (methodological soundness, claims the evidence can carry, statistical and qualitative reporting), EQUATOR reporting guidelines, the ICMJE authorship criteria, COPE's view of text recycling, the near-universal generative-AI policy (no AI author, disclosure, author responsibility), TOP 2025 transparency standards, how to verify a journal is legitimate, submitting without an institution, and a pre-submission checklist. Triggers on requests to evaluate, review, prepare or submit a paper, to judge publishability, to write a declarations or data-availability section, to disclose AI use, or to check a journal.","https:\u002F\u002Fgithub.com\u002Fthe-vibey-project\u002Fvibey\u002Fblob\u002Fdevelop\u002Fsrc\u002Fvibey_tools\u002Fskills\u002Fplugins\u002Fwriting-craft\u002Fskills\u002Fjournal-publishability-criteria\u002FSKILL.md",[],[]]