skip to content

Game Engine Architecture

The machinery under every engine: the game loop and timestep, ECS and data-oriented layout, job systems, allocators and asset cooking. Senior interviews open here whichever engine you shipped on.

on this pageshow

explore

questions

page 1 of 2

In a game asset pipeline, what is the difference between importing a source asset and cooking it for a target platform?

level: juniorimportance: must knowfreq 55%

answer

  1. two conversions at two moments
  2. editor-side vs runtime-side data
  3. platform-neutral intermediate first
  4. per-platform formats, layout, stripped data

basics

~20 s

Importing turns an artist's source file into a platform-neutral editor asset with its settings, often with a stable ID; cooking converts that asset into the runtime bytes one platform loads fastest, stripping editor-only data and baking in platform-specific encodings.

solid answer

~40 s

**Import** runs when a source file changes: it reads the authoring format (a layered image, an exported mesh scene) and writes an engine-owned intermediate plus metadata such as import settings and, in many engines, a stable identifier. That intermediate is the same for every platform and is what the editor works with. **Cooking** runs once per target platform: it compresses textures into the formats that platform's GPU samples, lays meshes out in the vertex layout its renderer expects, compiles shaders for it, strips editor-only data, matches its endianness and alignment, and packs the results into archives. The shipped game never parses source files, because that would cost load time, memory and code it does not need, and because each platform wants different bytes.

go deeper

for a junior

Recall the split: import makes a platform-neutral editor asset from a source file, cooking makes load-ready runtime data for one platform.

for a middle

Explain what each step actually does to a texture or mesh, and why the cooked output is per platform while the imported intermediate is shared.

for a senior

Connect the split to production pain: where conversion time goes, which data is stripped, and how a single changed source file is re-imported and re-cooked for hot reload.

for a principal

Frame the split as an ownership boundary: what the editor team and the platform teams each control, and how many platforms multiply cook cost.

## Two conversions at two moments An asset pipeline is the chain of tools that turns what artists and designers author into what the game loads. Most engines split it into two conversions that run at different moments and for different consumers: - **Import** happens when a source file is added or changes. Its consumer is the editor. - **Cooking** (also called baking or building content) happens when a playable build for a specific platform is made. Its consumer is the runtime on that platform. Engines name these stages differently, and some fold the per-platform conversion into what they call import and cache one result per target; the two jobs are the same whatever they are called. Keeping them apart is what lets one set of source files feed several platforms without anyone editing per-platform copies by hand. ## What import does Source files are written by content-creation tools in their own formats: a layered paint file, an exported mesh scene with cameras and lights the game does not want, a high-sample-rate audio recording. Import reads one of these and writes an **intermediate asset** the engine owns. Along the way it typically: 1. parses the authoring format and keeps only what the engine understands (pixels, vertices, skeleton bindings, audio samples); 2. records **import settings** next to the asset, such as whether a texture is a colour map or a normal map, or how a mesh should be scaled; 3. assigns or reads a **stable identifier** so other assets can refer to this one even if its file moves; 4. stores everything in a platform-neutral form, often at full precision. The editor works from these intermediates and their settings, though some editors also display a version converted for the platform being previewed. They are convenient to edit, but they are not what a console or phone should load. ## What cooking does Cooking takes the intermediate assets that a build needs and converts each one into the **runtime format** for one platform. Typical steps include: - compressing textures into the block-compressed formats that platform's GPU can sample directly, and dropping resolution where the platform's memory budget demands it; - reordering mesh data into the vertex layout and index width that platform's renderer expects; - compiling shaders for that platform's GPU family; - converting audio to the codec the platform decodes cheaply; - **stripping editor-only data** such as thumbnails, source settings and debugging names; - writing structures with the target's **endianness, alignment and pointer size**, so they can be read with little or no parsing; - packing many small files into a few large archives, so the device makes fewer, larger reads. Because each step depends on the target, a build for each platform has its own cook output. The platform-neutral conversion, by contrast, needs to run only once no matter how many platforms ship. | | Import | Cook | |---|---|---| | Runs when | a source file changes | a build for a platform is made | | Runs how often | once per source change | once per source change, per platform | | Output is for | the editor | the shipped runtime | | Output format | platform-neutral intermediate | platform-specific, load-ready | | Keeps editor data | yes | no | ## Why the game does not load source files directly It is tempting on a small project to load the original image or mesh file at run time. It stops scaling for several reasons: 1. **Load time.** Parsing a general-purpose authoring format and converting it at run time costs CPU on every launch, on the slowest hardware the game supports. 2. **Wrong bytes.** The GPU wants compressed texture blocks and a specific vertex layout; the source file has neither, so the conversion would run on the player's device every time. 3. **Size.** Source files carry layers, history and precision the game never shows, which inflates downloads and memory. 4. **Code.** Every parser shipped in the runtime is more code to load, maintain and secure. ## Where this shows up in interviews Interviewers ask this early because the answer shows whether a candidate has seen a real pipeline. Weak answers merge the two steps or claim a single cooked build can run everywhere. Strong answers mention the stable identifier assigned at import, the per-platform nature of cooking, and the follow-on problems that make pipelines hard at scale: cooks that take hours, caches of derived data, and **hot reload**, where the editor notices a changed source file, re-imports it, converts just that asset for the running game, and swaps it into the running game without a restart.

  • Why must a pipeline keep platform-neutral data even when the editor previews platform-converted assets?
    Cooked data is shaped for one platform and has editor-only information stripped out: names, source settings, thumbnails and full-precision values. Re-converting for another platform, or after a settings change, needs that information and the lossless data. So pipelines keep the source plus settings, or a platform-neutral intermediate, as the master copy, and treat every platform's converted output as derived and disposable.
  • What makes cooked output differ between two platforms built from identical source assets?
    Each platform's GPU samples different compressed texture formats, its renderer may want a different vertex layout, its shaders compile for a different GPU family, and its CPU may differ in endianness, alignment or pointer size. Memory budgets also differ, so a smaller device may cook textures at lower resolution or drop detail levels. The same source therefore yields a separate cooked set per platform.

  • The shipped game should load the artists' source files directly at run time.
  • Import and cook are the same step with two different names.
  • One cooked build can be copied unchanged to every platform.
  • Cooking only compresses data; it never changes layout or strips anything.
  • Editor-only data costs nothing in a shipped build, so stripping it is optional.
open as a page

Why do game engines favour composing entities from components over deep inheritance hierarchies of game-object classes?

level: juniorimportance: must knowfreq 70%

basics

~20 s

Deep inheritance forces every game object into one fixed taxonomy, so features that cut across branches end up duplicated or hoisted into a bloated base class. Composing entities from components lets any combination exist without a new class.

open as a page

What does a game loop do on each iteration, and why is per-frame movement scaled by the elapsed frame time?

level: juniorimportance: must knowfreq 72%

basics

~20 s

A game loop repeats input handling, a simulation update and rendering for as long as the game runs. Frame lengths vary across machines and moments, so movement is written per second and multiplied by the elapsed frame time.

open as a page

Why does a game engine keep fixed-size objects such as projectiles in a preallocated pool instead of allocating each one from the general heap?

level: juniorimportance: must knowfreq 60%

basics

~20 s

A pool reserves every slot up front, so spawning or despawning a projectile is a constant-time free-list pop or push: no general-heap call, no heap fragmentation from tiny short-lived blocks, and a fixed memory cost known in advance.

open as a page

How do you turn a 60 Hz target into a millisecond frame budget, and why do engineers reason in milliseconds rather than frames per second?

level: juniorimportance: must knowfreq 72%

basics

~20 s

A 60 Hz target leaves 1000 / 60, about 16.7 ms, per frame for all work. Engineers budget in milliseconds because system costs add up in time, while frames per second is a reciprocal that hides what a change really cost.

open as a page

In a transform hierarchy, why does a child object store a transform relative to its parent instead of its world transform?

level: juniorimportance: must knowfreq 60%

basics

~20 s

Storing a local transform lets a child follow its parent automatically: its world transform is the parent's world transform composed with its local one, so moving a vehicle carries the seated character and the weapon in its hand along.

open as a page

Why do asset pipelines reference assets by a stable GUID instead of a file path, and what does that change for renames?

level: middleimportance: must knowfreq 50%

basics

~20 s

A GUID assigned at import names an asset for life, so moving or renaming its file updates one GUID-to-path mapping instead of rewriting every asset that refers to it; the same IDs also feed the dependency graph that decides what to cook.

open as a page

How does a job system with dependency counters spread a game's per-frame work across all cores instead of keeping one core busy?

level: middleimportance: must knowfreq 72%

basics

~20 s

A job system breaks each frame into many small jobs run by about one worker thread per core. Each job counts its unfinished prerequisites; when that count reaches zero the job becomes ready, so every core pulls work as dependencies resolve.

open as a page

What is the difference between array-of-structures and structure-of-arrays layouts, and why does SoA speed up a movement system over fifty thousand units?

level: middleimportance: must knowfreq 65%

basics

~20 s

Array-of-structures stores each unit's fields together; structure-of-arrays stores each field in its own array. A movement system reads only positions and velocities, so SoA streams just those bytes and fills each fetched cache line with useful data.

open as a page

Why can a character's jump height differ at 30 and 144 frames per second even when every update is scaled by delta time?

level: middleimportance: must knowfreq 66%

basics

~20 s

Accelerating motion advances in discrete steps whose result usually depends on their length, so each frame rate gives a different trajectory and apex. A fixed simulation timestep gives every machine identical steps and the same height.

open as a page

A gameplay event bus dispatches immediately: what breaks when a listener is destroyed or raises another event mid-dispatch, and what does deferred dispatch change?

level: middleimportance: must knowfreq 52%

basics

~20 s

Immediate dispatch runs listeners inside the sender's call, so a destroyed listener becomes a dangling callback and a listener that raises events recurses mid-update. Deferred dispatch queues events and flushes them at a fixed point, trading latency for safety.

open as a page

How does a per-frame linear allocator in a game engine work, and when do you need a double-buffered version instead of a single buffer?

level: middleimportance: must knowfreq 55%

basics

~20 s

A per-frame linear allocator bumps an offset through one preallocated buffer and frees everything by resetting the offset once a frame. Data still read during the next frame needs two buffers used alternately, so a reset never destroys it.

open as a page

How do dirty flags keep transform-hierarchy updates cheap, and what goes wrong if gameplay code reads a world matrix mid-frame?

level: middleimportance: must knowfreq 55%

basics

~20 s

A dirty flag marks a node whose local transform changed, so only it and its descendants get new world matrices, once per frame and parent first. Reading a cached world matrix before that pass returns last frame's value.

open as a page

With the render thread running one frame behind the main thread, how does double-buffered game state let simulation and rendering overlap, and what does it cost?

level: seniorimportance: must knowfreq 62%

basics

~20 s

The main thread simulates frame N+1 while the render thread prepares frame N from its own copy of render state, swapped at a sync point. Frame time becomes the slower thread's, not the sum, for about a frame of extra latency and a second copy.

open as a page

How does an accumulator run a fixed simulation step under a variable frame rate, and why interpolate rendered state with the leftover fraction?

level: seniorimportance: must knowfreq 64%

basics

~20 s

An accumulator banks each frame's real elapsed time and runs whole fixed steps while it holds at least one. The leftover fraction, divided by the step, blends the previous and current simulation states so motion looks smooth at any display rate.

open as a page

A game runs at 45 fps against a 60 Hz target; how do you tell whether the frame is CPU-bound or GPU-bound before optimising anything?

level: seniorimportance: must knowfreq 75%

basics

~20 s

Measure each side separately: CPU busy time per thread and GPU time per frame. The side busy for the whole 22 ms while the other waits is the bottleneck; confirm by changing only resolution or only CPU load.

open as a page

A game averages 15 ms per frame, yet players report a visible hitch every few seconds; how do you measure the hitch and track it down?

level: seniorimportance: must knowfreq 62%

basics

~20 s

Stop trusting averages: track maximum frame time, frames over budget and the 99.9th percentile. Then capture the slow frame itself, with a rolling profiler buffer saved when a frame exceeds a threshold, and compare it with the normal frames before it.

open as a page

In a game engine, what do the main (game) thread, the render thread and the audio thread each own, and why are they kept separate?

level: juniorimportance: should knowfreq 55%

basics

~20 s

The main thread runs input, gameplay and simulation and owns the game state; the render thread turns a copy of that state into graphics-driver work; the audio thread mixes sound against the device's hard deadline, so a slow frame never starves it.

open as a page

In a game's input system, why map raw device inputs to named actions instead of reading specific keys and buttons in gameplay code?

level: juniorimportance: should knowfreq 42%

basics

~20 s

An action map lets gameplay code ask for intents such as Jump or Move while a data table binds keys, buttons and sticks to them, so rebinding, extra devices and context-specific controls need no gameplay code changes.

open as a page

In an ECS, why is adding or removing a component while a system iterates its query dangerous, and how does a command buffer fix it?

level: middleimportance: should knowfreq 55%

basics

~20 s

Adding or removing a component moves an entity's data to other storage, which can skip or revisit entities and invalidate pointers mid-iteration. A command buffer records such changes and applies them later at a safe sync point.

open as a page

How do vsync and double or triple swapchain buffering trade tearing and smooth frame pacing against input latency in a game loop?

level: middleimportance: should knowfreq 46%

basics

~20 s

Vsync waits for the display's refresh boundary so images never tear, but a missed deadline costs a whole extra refresh. More swapchain buffers keep the rate up, but queued images add input latency and uneven pacing judders.

open as a page

What is reflection metadata in a game engine, and how can one description of a component's fields drive the editor, save files and script bindings?

level: middleimportance: should knowfreq 40%

basics

~20 s

Reflection metadata is a run-time description of each type and its fields' names, types, locations and flags. Editors draw property panels from it, serializers save fields by name, and script bindings expose fields, with no per-type code.

open as a page

Why do game engines refer to entities and resources through handles with generation counts rather than raw pointers, and how is a stale handle caught?

level: middleimportance: should knowfreq 50%

basics

~20 s

A handle is a slot index plus a generation number. Freeing an object bumps its slot's generation, so resolving an old handle finds a mismatch and returns nothing instead of touching a dead object or the new one that reused the slot.

open as a page

In a game whose gameplay runs in a garbage-collected scripting language, why do per-frame allocations cause periodic hitches, and how are they removed?

level: middleimportance: should knowfreq 45%

basics

~20 s

Per-frame allocations become garbage, and the collector runs when enough piles up, stealing milliseconds from whichever frame it lands in. The fix is zero steady-state allocation in gameplay scripts: preallocate, pool, reuse buffers, and schedule collections at loading screens.

open as a page

How do you measure what draw calls and batching actually cost a frame, on the CPU and on the GPU, instead of just counting draws?

level: middleimportance: should knowfreq 50%

basics

~20 s

Time both sides: CPU milliseconds on the thread that records and submits draws, and GPU milliseconds per pass from timestamp queries or a timing capture. Batching pays off mainly when the measured CPU submission time is the side over budget.

open as a page

What is the difference between an instrumenting profiler and a sampling profiler, and when does a game programmer reach for each?

level: middleimportance: should knowfreq 55%

basics

~20 s

An instrumenting profiler records exact begin and end times of code regions you marked, giving a per-frame timeline; a sampling profiler periodically records call stacks, showing statistically where CPU time goes in all code, but not exact per-frame timings.

open as a page

How does a prefab instance placed in a level store its differences from the prefab, and what breaks with nested prefab overrides?

level: middleimportance: should knowfreq 40%

basics

~20 s

An instance stores a reference to the prefab plus overrides: property paths and new values, keyed by stable object IDs. Prefab edits reach every instance except overridden properties; nested prefabs stack overrides, with the layer nearest the placed instance usually winning.

open as a page

An effect hitches the first time it appears because its shader variant was never built; where should shader permutations be compiled and cached to prevent it?

level: seniorimportance: should knowfreq 45%

basics

~20 s

Build every reachable variant before it is needed: compile it in the cook, finish device-specific compilation at load or first launch where the driver owns that step, cache the results persistently, and compile any remaining miss asynchronously.

open as a page

Textures stream in blurry for a moment whenever the player turns the camera quickly; how do you diagnose and fix the texture streamer's priorities?

level: seniorimportance: should knowfreq 42%

basics

~20 s

The streamer asks for detail only once a surface is on screen, so a quick turn reveals textures whose sharp mips are still queued; request around the camera rather than only inside the view, rank requests by on-screen need, and delay eviction.

open as a page

An engine's per-frame job graph takes 14 ms on eight cores while the worker threads sit idle most of the frame: how do you diagnose and shorten it?

level: seniorimportance: should knowfreq 50%

basics

~20 s

Compare total job work divided by cores with the longest dependency chain; a longer chain means a critical-path-bound frame. Shorten it by splitting long chain jobs into parallel batches, cutting false dependencies, prioritising chain jobs and pipelining render preparation.

open as a page

showing 1–30 of 46