Cube Engine
Cube is a modular, cross-platform 2D/3D game engine for .NET 10. It is built around a
lightweight Entity-Component-System (ECS), pluggable graphics/audio drivers (OpenGL, Vulkan,
OpenAL) and a code-first API — no editor required. You write your game in C#, describe the
runtime through a small config.json, and the engine takes care of the window, render pipeline,
input, audio and UI.
Looking for a specific type or method? Use the search box above or browse the full API Reference.
Features
- Entity-Component-System — compose game objects from reusable components and systems.
- Pluggable drivers — switch between OpenGL and Vulkan (graphics) or OpenAL (audio) via config.
- 2D & 3D rendering — forward renderer, post-processing (bloom, color grading), sprites, meshes, tilemaps.
- Code-first UI — constraint-based UI toolkit (buttons, sliders, dropdowns, scroll views, text input, …).
- Asset pipeline — load textures, shaders, fonts, sounds and configurations through the
AssetManager. - Built-in tooling — logging, performance monitoring and hot-reloadable assets.
Modules
| Module | Description |
|---|---|
| Cube.Core | Foundational types: math, events, logging, driver abstractions. |
| Cube.Framework | ECS runtime (World, entities, components, systems), CubeGame entry point, renderer & post-processing. |
| Cube.Graphics | High-level graphics: meshes, models, primitives. |
| Cube.GameSystems | Game-level assets: shaders, textures, sprites, materials, animations, tilemaps. |
| Cube.UI | Constraint-based user-interface toolkit. |
| Cube.Sounds | Sound abstractions and playback. |
| Cube.Assets | Asset loading, providers and metadata handling. |
| Cube.Driver.OpenGL / Vulkan / OpenAL | Concrete graphics and audio driver implementations. |
Getting Started
1. Add the packages
dotnet add package Cube.Framework
dotnet add package Cube.Driver.OpenGL
dotnet add package Cube.Driver.OpenAL
2. Describe the runtime (config.json)
{
"Window": {
"width": 1280,
"height": 720,
"title": "My First Cube Game",
"fullscreen": false,
"vSync": true
},
"Engine": {
"renderer": { "driver": "opengl" },
"audio": { "driver": "OpenAl" },
"logging": { "targets": [ "Console" ], "level": "info" }
}
}
3. Write your game
Derive from CubeGame, override the lifecycle methods, and start it with Run:
using Cube.Framework.Components;
using Cube.Framework.Runtime;
public sealed class MyGame : CubeGame
{
// Called once after the window and drivers are ready.
protected override void OnStart()
{
Window.Title = "My First Cube Game";
// Every scene needs a camera.
var camera = World.CreateCamera();
// Create an entity and give it a sprite.
var player = World.CreateEntity("Player");
player.AddComponent<SpriteComponent>();
}
// Called once per frame — put your game logic here.
protected override void OnUpdate(float deltaTime)
{
// move entities, read input, update state, ...
}
}
public static class Program
{
public static void Main() => new MyGame().Run("config.json");
}
That's it — Run sets up the window, graphics/audio drivers, render pipeline and ECS from your
config.json, then drives the main loop calling OnUpdate / OnRender each frame.
Next steps
- Explore the API Reference for all available components, systems and UI elements.
- Add a UI overlay by overriding
OnGuiand using theUserInterfacefromCube.UI. - Swap
"driver": "opengl"for"vulkan"in your config to try the Vulkan backend.