Skip to content

Engine Architecture Overview

Isthimius edited this page Jan 18, 2026 · 17 revisions

This page explains how Gondwana thinks.

If you understand this page, the codebase stops feeling large.


High-Level Architecture

Gondwana is composed of a small number of explicit systems:

  • Engine
  • Scene
  • SceneLayer
  • View
  • Camera
  • Viewport
  • Rendering pipeline

Each system has a narrow responsibility and minimal overlap.


Engine

The Engine owns:

  • The main loop
  • Timing and tick coordination
  • Dispatcher contexts
  • Global orchestration

It does not own game rules, scene content, or rendering decisions.

Think of the Engine as the conductor, not the orchestra.


Scenes and SceneLayers

A Scene represents a world.

A SceneLayer represents a spatial slice of that world. Most layers are tile-based or sprite-based, but the engine does not enforce a data model.

SceneLayers:

  • Have world-space bounds
  • Own their drawables
  • Support visibility, z-order, and parallax
  • Can be independently refreshed or culled

There is no required ECS, inheritance hierarchy, or asset system.


Views, Cameras, and Viewports

A View answers the question:

What part of the world are we looking at, and how is it projected onto the screen?

  • Camera defines world-space position, zoom, and rotation
  • Viewport defines the screen-space rectangle
  • View binds the two together

Multiple views are first-class and expected. Split screen, picture-in-picture, mini-maps, and debug overlays are built-in concepts, not hacks.


Rendering Pipeline

Rendering is explicit and multi-pass.

At a high level:

  1. SceneLayers determine which drawables intersect the view
  2. World-space coordinates are transformed via the Camera
  3. Screen-space clipping is applied via the Viewport
  4. Dirty regions are resolved
  5. The backbuffer is published

World pixels and screen pixels are tracked separately, by design.

If something redraws, there is always a reason.


Backbuffers and Refresh Queues

Gondwana uses dirty-region rendering to maintain predictable performance.

  • World-space refresh queues track what changed
  • Screen-space dirty rectangles track what must be redrawn
  • Full redraws are explicit and intentional

This approach scales to large worlds without relying on brute-force redraws.


DirectDrawing

DirectDrawing exists for cases that do not belong to a SceneLayer:

  • UI-like overlays
  • Debug visuals
  • Transient effects

DirectDrawing is powerful and sharp. It bypasses some of the engine’s safety rails.

If DirectDrawing becomes your default tool, it is usually a sign that a layer abstraction is missing.


Serialization and State

The engine favors explicit serialization and stable engine state snapshots.

This design supports save/load, replay, tooling, and future editor integration without forcing those concerns into the runtime loop.


Design Intent

Gondwana assumes:

  • You want to understand the engine
  • You prefer predictability over convenience
  • You value explicit control over hidden automation

It trades approachability for long-term sanity.

Clone this wiki locally