Skip to content
Isthimius edited this page Jul 8, 2026 · 11 revisions

What Is Gondwana?

Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It targets desktop (Windows, Linux, macOS) via explicit WinForms and Avalonia adapters, and web support via Blazor.

It is a code-first engine with no editor or scene GUI required. Developers own the game loop and rendering pipeline directly. Gondwana uses a component-based, code-first architecture with explicit scene, rendering, input, audio, and hosting subsystems. It is not a traditional Entity Component System; instead, it favors object-oriented engine primitives and composable rendering/game components.


Key Technologies

Technology Role
.NET 8 / C# Primary language and runtime
SkiaSharp Cross-platform 2D rendering (GPU + bitmap backbuffers)
NAudio Audio playback and mixing
LibVLCSharp Experimental video playback
SDL2 Optional gamepad input (via Gondwana.Input.SDL2)
WinForms Desktop host adapter for Windows
Avalonia Cross-platform desktop host adapter for Win / Mac / Linux
Blazor / WebAssembly Browser-based host adapter
Nerdbank.GitVersioning Deterministic versioning from version.json

Solution Structure

The solution (Gondwana.sln) is composed of multiple focused projects.


Core Library

Gondwana/

The main engine library. Contains:

  • Engine.cs — Central game loop (timing, input polling, scene updates, rendering)
  • EngineManagers.cs, EngineDispatcher.cs — Lifecycle and dispatch

Rendering

  • Backbuffers (BitmapBackbuffer, GpuBackbuffer)
  • RefreshQueue
  • RenderSurfaceHost
  • Views / Camera / Viewport

Scenes

  • Scene
  • SceneLayer
  • SceneLayerTile
  • Hierarchical scene graph

Drawing

  • Sprites
  • Tilesheets
  • Animations
  • Collision shapes
  • Direct drawables:
    • DirectImage
    • DirectRectangle
    • TextBlock
    • DirectParticles
  • Coordinates, overhang, tiles

Input

  • Keyboard, mouse, and gamepad polling abstractions

Movement

  • MovementController
    • Follow
    • Integrated
    • Scripted modes
  • Easing functions

Audio

  • AudioResourceManager
  • PlatformAudioFactory
  • Stereo panning

Timers

  • High-resolution timing
  • Scheduled callbacks

Collisions

  • Bounding-volume detection
  • Kinematic physics

Supporting Infrastructure

  • Configuration
  • Extensibility
  • Logging
  • SkiaSharp integration

Platform Adapters

  • Gondwana.Hosting/

    • GameHostBase — base class for platform hosts
  • Gondwana.WinForms/

    • WinForms-specific rendering surface
    • Input wiring
    • Audio integration
  • Gondwana.WinForms.Hosting/

    • WinForms hosting glue
  • Gondwana.Avalonia/

    • Avalonia-specific rendering surface
    • Cross-platform host integration
    • Input and presentation wiring for Avalonia applications
  • Gondwana.Avalonia.Hosting/

    • Avalonia hosting glue
    • Connects Avalonia application lifecycle to the Gondwana engine loop
  • Gondwana.Blazor/

    • Blazor/WebAssembly-specific rendering surface
    • Browser canvas presentation support
    • JavaScript interop for browser-hosted rendering
  • Gondwana.Blazor.Hosting/

    • Blazor hosting glue
    • Connects Blazor application lifecycle to the Gondwana engine loop

Optional Add-on Libraries

  • Gondwana.Audio.Midi/

    • MIDI file reading and synthesis
    • Bundled .sf2 soundfont support
  • Gondwana.Input.SDL2/

    • SDL2-based gamepad input provider
  • Gondwana.Video/

    • Video playback via LibVLCSharp (VlcVideoPlayer)

Demos

  • Demos/Gondwana.CoordinateTest — Coordinate system test demo
  • Demos/Gondwana.ParticleTest — Particle system demo
  • Demos/Slider, Demos/Spot — Additional sample games/demos

Runtime Flow (How It Works)

Each engine cycle:

  1. Dirty-region tracking
    State changes enqueue world-space dirty rectangles into the affected SceneLayer's RefreshQueue.

  2. View rendering
    ViewRenderer iterates active View instances in Z-order.
    Each applies its Camera/Viewport transform and redraws the affected regions into a backbuffer.

  3. Composition & presentation

    • Sprites and tiles are drawn from cached tilesheets
    • Animations advance
    • Final backbuffer is presented by the active platform host
    • WinForms, Avalonia, and Blazor hosts each handle presentation through their own adapter layer
  4. Timers & input

    • High-resolution timers advance simulation time
    • Input adapters poll keyboard, mouse, and gamepad
    • Scene state is updated accordingly

Rendering Notes

Gondwana’s render path is intentionally explicit.

For bitmap backbuffers, Gondwana uses dirty-region redraw: only changed regions are redrawn, rather than blindly repainting the full frame.

For GPU-backed backbuffers, rendering is delegated through GPU-backed Skia surfaces. The GPU path may favor full-surface redraw or GPU-side optimization instead of the bitmap dirty-rectangle path.


Key Design Principles

  • World-space first
    All logic uses world coordinates; camera/viewport transforms occur only at render time.

  • Dirty-region rendering
    Bitmap backbuffers redraw only changed regions, not the full screen.

  • GPU-aware rendering
    GPU-backed surfaces use a different optimization path than bitmap-backed surfaces.

  • Layered scenes with parallax
    A Scene contains multiple SceneLayers, each with independent refresh tracking and parallax settings.

  • View-centric rendering
    Multiple cameras/viewports are first-class: split-screen, HUD layers, minimaps, and alternate views are all natural fits.

  • Platform adapters at the edges
    Core engine logic is platform-agnostic. WinForms, Avalonia, and Blazor support live in separate adapter projects.

  • Host glue stays separate
    Platform-specific hosting concerns are isolated in .Hosting projects, keeping the core adapters cleaner.

  • Deterministic ordering
    Stable sorting for Z-order, layers, and drawables ensures predictable rendering.


Versioning

The project uses Nerdbank.GitVersioning.

  • Canonical version is defined in version.json
  • Automatically applied via Directory.Build.props
  • Do not hard-code <Version> or <FileVersion> in .csproj files

Where to Go Next

Clone this wiki locally