Lab
Small, reproducible experiments for understanding the mechanics behind graphics and games.
Game Engineering · Volume I
Do código aos pixels — C++20 e SDL3 desde o zero
Aprenda programação construindo a Arena, um jogo 2D desenvolvido capítulo por capítulo.
R$ 20,00 Planned price
Português (Brasil) · PDF · One-time purchase
In development — not yet available for purchase.
Book detailsRaster Playground
A 512 × 512 canvas partitioned into storage tiles. Move the dirty rectangle and change tile size to see which tiles are candidates for updating.
This is application-level invalidation, not a simulation of a GPU's internal tile memory. The dirty rectangle is conservative; actual work depends on the renderer.
Polygon Lab
Move a vertex or reverse the traversal order. The absolute area stays unchanged when winding is reversed, but the signed shoelace area changes sign.
In these screen coordinates, Y increases downwards, so positive signed area corresponds to clockwise winding. This experiment assumes a simple polygon.
RGB Playground
Predict the background color before changing a channel. Setting the draw color is not the same as clearing or presenting a frame.
SDL_SetRenderDrawColor(renderer, 20, 24, 32, 255);Browser color model, not a native SDL3 render or display calibration.
Game Loop Inspector
Queue ordinary events, request close, then advance one operation at a time. Predict whether another frame will be presented.
Simplified sequential model: the close request is latched until the event queue drains. It does not model event arrival timing, GPU synchronization or frame duration.
Build Pipeline
Predict which artifact will exist when compilation or linking fails. Select a fault and advance one stage at a time.
- source
- preprocessed
- object
- executable
- running
int main() { return 0; }Conceptual native build, not a compiler. Compilation includes assembly in this model. A failed build does not necessarily remove artifacts from earlier builds; this experiment starts clean.
Resource Lifetime
Try drawing before creation and after destruction. Predict which resource remains live after each operation.
Models the explicit cleanup order used in Arena, not every valid SDL sequence. Invalid operations are rejected without calling SDL. No actual addresses, allocation, failures or GPU synchronization are simulated.
Coordinate Explorer
Predict where the point moves when only y changes. Units are logical, not physical pixels.
Rectangle Lab
Change width without moving the reference corner. Compare right, bottom and center.
SDL_FRect player{100.0f, 160.0f, 48.0f, 48.0f};Geometry can extend outside the logical arena. The diagram includes this extra space; it does not simulate pixel coverage.
Draw Order
Swap the two opaque draw calls. The geometry stays identical.
Ideal opaque coverage, sampled inside the intersection. Clear precedes both calls; Present follows both.
Logical Presentation
Resize the output. Predict whether the empty space appears above and below or on the sides.
Continuous geometric model; actual SDL output may round to pixel boundaries.
Future experiments
Physics Sandbox (fixed timestep and collision response) and Shader Playground (portable shader examples) are planned. They are not yet implemented.