🌐 Browser Demos

CNA's EasyGL (OpenGL ES 3.0) backend compiles to WebAssembly via Emscripten and renders via WebGL 2. The demos below run directly in a modern browser — no installation required. They also double as manual smoke tests for the Emscripten/WebGL 2 target: if they load and respond to input, that target is healthy.

🏠

House 3D Demo

Live

A 3D procedural house scene built entirely from CNA primitives: exterior walls, a pitched roof, windows, a door, interior floors, and surrounding ground. The player can walk and jump with full gravity. Rendered via BasicEffect and the EasyGL backend, compiled to WebAssembly with Emscripten.

Validates 3D matrix transforms, camera projection, per-vertex lighting, player physics, and the game loop — all running in-browser at interactive frame rates.

🎨

CNA 2D Demo

Live

A 2D sprite demo exercising the SpriteBatch API: texture loading, draw calls with position/rotation/scale, tinted sprites, and layered rendering. Runs in the browser via the same Emscripten/WebGL 2 pipeline as the 3D demo.

Acts as a manual regression check for 2D rendering correctness on the Emscripten target. Also validates the content loading pipeline for PNG textures under WebAssembly.

📌

Note: CNA's GitHub Actions CI currently covers the Input and Devices/Sensors subsystems. Graphics — including these WebGL demos — along with Audio and Net, are still verified via manual local ctest runs, not yet gated by CI. These demos are rebuilt and re-checked manually as the Emscripten/WebGL 2 target evolves. If the links above load and respond to input, the target is healthy as of the last rebuild.

🏃 Real-World Validation — Speedy Blupi

Unit tests verify individual types and subsystems in isolation. What they cannot verify is whether the full XNA programming model hangs together when real game code drives it. The Speedy Blupi port answers that question.

🎮

What Speedy Blupi validates

Speedy Blupi is a classic open-source action game. Porting it to CNA exercises the full stack simultaneously:

  • SpriteBatch — layered sprite rendering with correct depth ordering
  • Input handling — keyboard and gamepad state each frame
  • AudioSoundEffect and SoundEffectInstance for per-event sounds
  • Content loading — texture and audio asset pipeline
  • Game loop semantics — fixed-timestep Update / variable-timestep Draw

What it proves

Real-world XNA-style game code works on CNA. The port did not require changes to the game's core logic — only the platform-facing layer was adapted. This demonstrates that:

  • CNA's API shape is close enough to XNA 4.0 that porting is mechanical, not a rewrite.
  • The framework is stable enough to run a multi-system game loop without crashing or producing rendering artifacts under sustained play.
  • Audio, input, and rendering subsystems interoperate correctly when driven by real game state.
📱

Platform targets

The Speedy Blupi CNA port has been validated on:

  • Linux x86_64 — primary desktop target, EasyGL backend
  • Android — APK built and tested on hardware; SDL_RENDERER backend
  • WebAssembly — Emscripten/WebGL 2 build in progress

The Android validation is particularly notable: it confirms that CNA's SDL3 integration, content loading, and audio initialisation all work correctly on the Android NDK toolchain without desktop-only workarounds.

📚 Sample Applications — cna-samples

The cna-samples repository contains direct ports of the original XNA Game Studio 4.0 sample suite. Each one follows the original C# source as closely as possible — the point is to test CNA's API against what real XNA code actually demanded, not to write flattering new demos.

63 of the 86 addressable samples build today, including Platformer, MarbleMaze, RolePlayingGame, CatapultWars, HoneycombRush, NinjAcademy, GameStateManagement, Audio3D and the peer-to-peer networking samples — spanning 2D primitives, collision, AI and pathfinding, particles, complete 2D games, 3D audio, touch gestures and LAN multiplayer.

The 23 that don't build are the most informative number on this page, because they nearly all fail for the same reason: they ship custom .fx shaders, and CNA cannot compile HLSL bytecode. BloomSample, ShadowMapping, NormalMapping, SkinningSample, PerPixelLighting, DistortionSample and the rest are blocked on that one gap rather than on anything scattered across the API. Close it and most of them come along.

PrimitivesSample

Ported

Port of the original XNA Game Studio 4.0 Primitives Sample demonstrating 2D primitive rendering: lines, triangles, rectangles, and circles drawn using SpriteBatch and procedurally generated textures.

Validates: SpriteBatch.Begin/End, pixel-texture creation, 2D coordinate mapping, and the basic game loop with variable-size window support.

Primitives3D

Ported

Port of the original XNA Game Studio 4.0 3D Primitives Sample demonstrating 3D shape rendering: box, sphere, cylinder, torus, and teapot primitives rendered with BasicEffect lighting and per-object transform matrices.

Validates: BasicEffect with ambient/diffuse/specular lighting, VertexBuffer/IndexBuffer management, view/projection matrix setup, and the 3D rendering pipeline end-to-end.

🏆

CatapultWars

Ported

Port of the original XNA Game Studio 4.0 Catapult Wars — a complete two-player turn-based artillery game with scoring, animated sprites, and game-state screens.

Validates: a full game loop end-to-end, not just an isolated API — sprite animation, input handling, scoring, and screen transitions working together.

📌

GameStateManagement

Ported

Port of Microsoft's Game State Management sample: a reusable screen-stack framework (menus, gameplay, pause, transitions) used as the foundation for many of the other official XNA sample games.

Validates: a layered GameComponent/screen architecture on top of CNA's Game base class.

🧩

Pathfinding & FlockingSample

Ported

Ports of the XNA AI sample pair covering grid-based pathfinding and boid-style flocking/steering behavior, alongside related ports (ChaseAndEvade, WaypointSample, AimingSample, FuzzyLogic).

Validates: math-heavy gameplay code (vectors, steering forces, grid search) ported faithfully from C# to C++23.

🔊

Audio3D & GesturesSample

Ported

Ports covering positional 3D audio playback and touch gesture recognition (tap, drag, pinch, flick) — the two least-graphics-focused corners of the XNA API surface.

Validates: SoundEffect3D-style positional audio and Microsoft::Xna::Framework::Input::Touch gesture handling outside of pure rendering code.

🔗

Repository: All sample ports live at github.com/openeggbert/cna-samples. Each sample includes build instructions and mirrors the structure of the original XNA sample project. Additional XNA 4.0 sample ports are added as API coverage expands.

🖥 Platform Validation

CNA is built on SDL3, which provides the portability layer. The table below reflects current validated state — "validated" means demos or game code has been built and run on real hardware or a real browser, not merely that the code compiles.

Platform Backend Status Notes
Linux x86_64 EasyGL + SDL_RENDERER Validated Primary development platform. All demos and unit tests run. EasyGL (OpenGL ES 3.0) used for 3D; SDL_RENDERER available for 2D-only targets.
Android SDL_RENDERER Partial SDL_RENDERER backend validated on real hardware. Sensor and touch input API coverage needs further testing. NDK toolchain is configured and building.
WebAssembly / Browser EasyGL (WebGL 2) Validated House 3D Demo and CNA 2D Demo run live in the browser via Emscripten. Both serve as manually re-checked smoke tests for the WebGL 2 target.
Windows SDL_RENDERER Validated (cross-compiled, Wine) SDL_RENDERER backend cross-compiled with MinGW-w64 from Linux and verified running under Wine — not yet tested on native Windows hardware or with a native toolchain (MSVC 2022, clang-cl). Native Windows CI is the next step.

Backend note: CNA selects its rendering backend at compile time via the CNA_GRAPHICS_BACKEND CMake flag. The EasyGL backend (OpenGL ES 3.0) is required for 3D rendering and WebGL 2. The SDL_RENDERER backend is 2D-only and requires no OpenGL driver, making it suitable for Android and Windows targets where OpenGL ES 3.0 support may vary.