Skip to content

Getting started

How to get the editor, build the engine from source, make a game and find your way around the code. Each section links to the design doc that covers its subject in full; the overview lists them all.

The editor lives in its own repository, mainframe-editor. Download it for your platform from its releases: macOS (Apple Silicon), Windows x64 or Linux x64. Creating and playing game projects needs the .NET 11 SDK. Its README covers installing, updates and building it from source.

Requirements: the .NET 11 SDK, Git LFS (images, audio, goldens) and just. The Vulkan SDK is recommended for development (validation layers, slangc); nothing needs installing to run on macOS (MoltenVK is bundled).

Terminal window
git clone --recurse-submodules <this repo> mainframe-engine # Plugins/Spine is a submodule
cd mainframe-engine
just build # dotnet build MainframeEngine.slnx (warnings are errors)
just demo # the Demo game: one scene per feature
just test # engine unit tests

Or open MainframeEngine.slnx in Rider or Visual Studio (the Demo has its own solution, Examples/Demo/Demo.slnx). just lists every recipe (render tests, Demo screenshots, benchmarks, shaders, localization, packaging).

macOS: Vulkan runs through MoltenVK. A copy is bundled via Silk.NET.MoltenVK.Native, so nothing needs to be installed to run. Installing the Vulkan SDK is still recommended for development — it provides the validation layers and slangc. VulkanLoaderBootstrap hands the Vulkan library to SDL (SDL_Vulkan_LoadLibrary) and Silk.NET explicitly, because modern macOS dyld no longer finds /usr/local/lib when the loader is dlopened by name.

Project configuration: every project targets net11.0 with nullable reference types, implicit usings and unsafe code enabled (required for Vulkan buffer/matrix operations); content files (shaders, textures) are copied to the build output. See Build & platforms.

Games are their own projects; the engine runs them with GameHost from a project.mfproj (no Engine subclass). The engine is the MainframeEngine NuGet package (engine, source generator, natives, engine content and build integration), so a game needs neither this repo nor the editor:

Terminal window
dotnet add package MainframeEngine # in any .NET 11 project

The mfgame template sets up a whole game project (the editor’s New Project uses the same template):

Terminal window
dotnet new install MainframeEngine.Templates
dotnet new mfgame -n MyGame # references MainframeEngine of the template's version
dotnet run --project MyGame/MyGame.Desktop

To build a game against a checkout of this repo instead (engine work):

Terminal window
git clone --recurse-submodules <this repo> mainframe-engine # Plugins/Spine is a submodule
dotnet new install mainframe-engine/Templates/MainframeEngine.Templates/content/mfgame
dotnet new mfgame -n MyGame --engine-source project --engine-path "$PWD/mainframe-engine"

This creates MyGame/ (your node types — start from Src/Spinner.cs), MyGame.Desktop/ (GameHost.Run(args, ...)), project.mfproj (main scene, window, physics, input actions, autoloads, …) and Assets/Scenes/Main.mfscene. Read input through actions (Input.IsActionPressed("spin_faster")), and see Projects & GameHost for the project file, GameHost flags (--scene, --max-frames, --hidden, --editor-port) and the editor link, and Distribution via NuGet for the packages.

The editor opens game projects, makes new ones from the same mfgame template, plays them in their own process over the editor link and reloads their C# code. See the editor’s docs. Run › Play and Record (F10) records the game to MP4 (Gameplay recording).

Skeletal animation follows Godot 4 (Animation and skinning):

  1. In Blender, rig the mesh to an armature and make one action per move (idle, run, swing, …). To loop a clip or mark a moment, give the action custom properties: loop (a bool) and events (a group of name → seconds, e.g. HammerFist = 0.42). Export glTF (.glb) with Include → Custom Properties, skins and animations.
  2. Put the file in Assets/. It imports to the armature’s Skeleton3D, the skinned MeshInstance3D under it and an AnimationPlayer with one animation per action. Loop modes, renames and events can also go in the model’s .mfmeta ("clips": [ { "name": "run", "loop": "Linear" } ]), which is how FBX files get them.
  3. Instance it in a scene (drag it from the FileSystem panel, or ResourceLoader.Load<PackedScene>(…).Instantiate()), and drive the player from your code:
var player = crew.GetNode<AnimationPlayer>("AnimationPlayer");
player.PlaybackDefaultBlendTime = 0.15f; // crossfade on every switch
player.Play("run"); // loops (extras or .mfmeta)
player.Play("roll", customSpeed: (float)(player.GetAnimation("roll")!.Length / rollSeconds)); // fit to a duration
player.Queue("idle"); // after the roll ends
player.AnimationEvent += (clip, name) => { if (name == "HammerFist") Hit(); }; // also on a --headless server
var hand = new BoneAttachment3D { BoneName = "Hand.R" }; // a child of the Skeleton3D
crew.GetNode<Skeleton3D>("Armature").AddChild(hand);
hand.AddChild(tool); // the tool and a torch light ride on the hand

For clips that travel (a walk that covers ground, a leap), let the clip move the body: set the player’s RootMotionTrack to the skeleton ("Armature"), RootMotionBone to the hips (or a root bone above them) and CallbackModeProcess to Physics, put the character under a CharacterBody3D, and call ApplyRootMotion(player) before MoveAndSlide() in its OnPhysicsProcess (Root motion).

Skinned meshes cast shadows, take outline overlays and are picked in their pose. The Demo’s Animation 3D scene shows all of it.

Examples/Demo is a standalone game project (project.mfproj, a node library and its desktop project) with one scene per feature: Basic 3D and 2D, Audio 2D and 3D, Sound FX, UI, Physics 2D and 3D, and Spine. A navigation bar switches scenes and every scene has a small RmlUi panel with its controls. Press F12 in the Demo (or in any game) to open the developer overlay: frame, renderer, shadow-map, GPU, audio, physics and network panels, plus light and axis gizmo toggles (Developer overlay). Its scenes, localization catalogs and tests live in the project, so it is also the reference for how a game is laid out. Its Spine example is Esoteric Software’s, not MIT (and the sky panorama is CC0): see its NOTICE.md. The editor’s Project Manager has Demo… (Download Demo Project): it fetches the Demo zip of its engine version from this repo’s GitHub Releases.

Terminal window
just demo # the Basic 3D scene
just demo --scene Assets/Scenes/physics_2d.mfscene # any scene (--max-frames, --screenshot, ... are GameHost flags)

Two larger games live in mainframe-engine-showcase, with the engine as a submodule: the Forest, a first-person walk through a generated valley (Esc opens a pause menu with live graphics, audio and control settings and its cameras: a fly-over, the reference shots R1–R8 and a free camera), and Neon, a cyberpunk loft 20 floors up in a rainy city (E uses things, Esc pauses). The editor’s Download menu fetches either; just forest and just neon run them in that repository. See Demo, Forest and Neon.

Games made from the template use GameHost (above). Tools and tests subclass Engine, load a scene into the engine-owned scene tree, and let it run the frame:

public sealed class Game(in EngineOptions options) : Engine(options)
{
protected override void OnLoad()
{
base.OnLoad(); // window, renderer, servers
Tree.ChangeSceneToFile("Assets/Scenes/Main.mfscene");
}
// Optional legacy hooks: OnUpdate, OnShadowPass, OnRenderMainPass.
}

Engine manages the SDL window, Vulkan renderer, input context and the SceneTree, and drives the game loop. GameTime provides per-frame timing (DeltaTime, FPS, FrameTimeMs, FrameCount). EngineOptions configures startup:

new EngineOptions
{
GameName = "My Game",
RenderingBackend = RenderingBackend.Vulkan,
WindowSize = new Vector2D<int>(1280, 720),
IconPath = "Assets/icon.png"
}

The frame loop order is:

  1. OnUpdate — game logic (legacy hook)
  2. Scene tree tick — fixed-step OnPhysicsProcess + physics, OnProcess, deferred calls and QueueFree, transform sync, UI update
  3. Frame preparation — the render server culls, sorts and uploads meshes
  4. Shadow pass — OnShadowPass, then the render server’s shadow casters; then sub-viewports and picking passes
  5. Main pass — the render server draws the sky and visuals into the HDR target, then OnRenderMainPass
  6. Overlay — tonemap, 2D canvas, screen gizmos, game UI, then the dev overlay on top

See Engine lifecycle.

Everything in a game is a node in a Godot-style tree: Node (name, parent, children, owner, groups, signals, ProcessMode), Node3D / Node2D (cached, dirty-flagged transforms; quaternion rotation), and front-ends for the renderer: Camera3D, DirectionalLight3D / OmniLight3D / SpotLight3D, WorldEnvironment (sky), MeshInstance3D, Sprite3D, SpineNode, Grid3D, SubViewport. The SceneTree runs OnEnterTree / OnReady / OnPhysicsProcess / OnProcess / OnExitTree, input (OnInput), groups, CallDeferred and QueueFree; servers (RenderServer, …) own the GPU objects behind the nodes.

public sealed class Spinner : Node3D
{
[Export] public float DegreesPerSecond { get; set; } = 45;
[Signal] public event Action? Spun;
protected override void OnProcess(in GameTime time) =>
RotationDegrees += new Vector3(0, DegreesPerSecond * time.DeltaTime, 0);
}
var level = ResourceLoader.Load<PackedScene>("Assets/Scenes/Level.mfscene").Instantiate();
Tree.Root.AddChild(level);
level.GetNode<SpineNode>("Player/Body").SetAnimation("walk");
SceneSaver.Save(level, "Assets/Scenes/Level.mfscene");

Scenes (.mfscene) and resources (.mfres) are JSON with stable UIDs, nested scene instances with overrides, and only non-default values. [Export] members are registered by the MainframeEngine.Generators source generator (no runtime reflection). NetworkNode manages the ENet library lifecycle and wraps the server and client message buses as a node; it polls them every frame in OnProcess (or call Poll()). NodeId is a runtime-unique node identifier (starts at 1; 0 = invalid); SceneTree.Find(id) looks a node up. See Scene graph & nodes and Scene serialization.

Server-authoritative multiplayer over ENet (UDP) or in-process loopback: [Replicated] members are sent as delta snapshots and interpolated on clients, [Rpc] methods are checked against per-node authority, and the generator writes the change detection, serialization and RPC dispatch (0 bytes allocated per network tick). See Networking.

public sealed class Ship : Node3D
{
[Replicated(Interpolate = true)] public Vector3 NetPosition { get => Position; set => Position = value; }
[Replicated] public int Hull { get; set; } = 100;
[Rpc(RpcMode.Authority)] public void Thrust(Vector3 input) => NetPosition += input; // owner → server
}
var mp = engine.Multiplayer;
var shipScene = mp.RegisterScene("Assets/Scenes/Ship.mfscene"); // same scenes, same order, on both ends
// Server
mp.Host(7777, maxClients: 8);
mp.PeerJoined += peer => mp.Spawn<Ship>(shipScene, authority: peer);
// Client
mp.Connect("127.0.0.1", 7777);
myShip.RpcThrust(Vector3.UnitZ); // generated sender

AudioServer (registered by Engine at startup; a silent null device when there is no audio device) mixes Godot-style audio nodes through a bus tree (Master → Music, SFX, UI, Voice: volume, mute, solo, effects):

var hum = new AudioPlayer3D
{
Stream = AudioStream.Load("Assets/Audio/engine.ogg"), // WAV, OGG, MP3, FLAC; memory or streamed
Bus = "SFX", VolumeDb = -6, Loop = true, Autoplay = true,
UnitSize = 3, MaxDistance = 50, AttenuationModel = AttenuationModel.Inverse,
};
car.AddChild(hum); // attenuated and panned around the listener
Servers.Get<AudioServer>()!.PlayOneShot(click, bus: "UI"); // fire and forget

ZzfxStream is a sound made from a ZzFX line (ZzfxStream.FromLine("zzfx(...[…])"), ZzfxPresets for coins, lasers, explosions…) and synthesised on first play; the editor’s sound designer edits it. See Audio.

label = Tr._("Settings"); // allocation-free lookup
status = Tr.N("{0} enemy left", "{0} enemies left", n); // plural rules per language; n is {0}
open = Tr.P("menu", "Open"); // context
Tr.SetLocale("es"); // runtime switch: nodes re-translate (OnLocaleChanged)
[Export(Translatable = true)] public string Title { get; set; } = ""; // scene text, shown with Atr(Title)
  • Catalogs: Assets/locale/<locale>/LC_MESSAGES/messages.mo, fallback chain pt_BR → pt → en; compiled from .po at build time by the in-house mf-l10n (byte-identical to GNU msgfmt, so no gettext install is needed).
  • just l10n-extract (C# via the GetText.NET extractor, RML documents and [Export(Translatable)] scene strings → messages.pot → every .po + the qps pseudo-locale), just l10n-compile, just l10n-check, just l10n-stats.

See Localization.

Log — severity levels (Debug, Info, Warning, Error, Fatal); every message becomes a structured LogEntry (UTC time, [Category], message, call site) routed to ILogSinks: colored console (default), a rotating FileLogSink in the per-user data folder, a MemoryLogSink ring for tools, and the editor link. Filtered-out messages — including interpolated $"..." ones — allocate nothing. See Projects & GameHost.

mainframe-engine/
├── MainframeEngine/ # Core engine library
│ ├── Src/
│ │ ├── Core/ # Engine base class, EngineOptions, timing
│ │ ├── Scene/ # Node, SceneTree, Node2D/Node3D, transforms, camera/light/sky/mesh nodes, input
│ │ ├── Resources/ # Resource, PackedScene, ResourceLoader/Saver, AssetDatabase, UIDs, importers
│ │ ├── Serialization/ # [Export]/[Signal] attributes, TypeRegistry, JSON scene reader/writer
│ │ ├── Servers/ # ServerRegistry, RenderServer
│ │ ├── Rendering/ # Vulkan renderer, GPU memory, meshes/materials/textures, sky, shadows, post, Spine
│ │ ├── Lighting/ # LightEnvironment and the lights behind the light nodes
│ │ ├── UI/ # RmlUi binding, VulkanUiRenderer, UiServer/UiLayer/UiDocument
│ │ ├── Physics/ # PhysicsServer3D (Jitter2) / PhysicsServer2D (Box2D.NET), bodies, shapes, queries
│ │ ├── Audio/ # AudioServer, buses, audio nodes, streams, decoders (SoundFlow)
│ │ ├── Recording/ # GameRecorder: gameplay recording through an ffmpeg child process
│ │ ├── Networking/ # MultiplayerApi replication, messages, transports, pooled buffers
│ │ ├── Localization/ # Tr (gettext catalogs, locale switching), RML text, font fallback
│ │ ├── Saves/ # SaveServer, SaveSchema<T>, save storage
│ │ ├── Project/, EditorLink/ # project.mfproj, GameHost, game-assembly loading; game <-> editor protocol
│ │ ├── Steamworks/ # Steam API wrappers (over the MainframeEngine.Steamworks shim)
│ │ ├── Debugging/ # Log + ILogSink sinks, the F12 dev overlay (DevOverlay)
│ │ └── Imaging/, Utils/ # PNG codec, helpers
│ ├── Assets/ # Shaders (Slang + committed SPIR-V), UI widgets and fonts, brand icons
│ └── runtimes/ # Native libraries per RID (mfrmlui, ENet, Valve's steam_api)
├── MainframeEngine.Generators/ # Roslyn source generator: node/resource registration, replication, editor icons
├── Examples/ # Demo (one scene per feature; README screenshots)
├── Templates/ # `dotnet new mfgame` game template
├── Tools/MainframeEngine.L10n/ # mf-l10n: extract (RML, scenes), update, pseudo-locale, .po -> .mo compiler
├── Native/ # Native shim sources (mfrmlui over RmlUi + FreeType, ENet), built by natives.yml
├── Tests/ # Unit and render (+ host) tests, benchmarks
├── build/ # Scripts shared by the justfile and CI (shaders, template smoke, packaging, Linux Docker)
├── docs/ # Design docs and the roadmap (the docs site's pages)
├── docs-site/ # The website: landing page + docs (Astro Starlight)
└── Plugins/Spine/ # Spine C# runtime (vendored submodule)

The layers, assemblies and who owns what are in Architecture overview.

Shaders are Slang sources in MainframeEngine/Assets/Shaders/ (mesh instances and the object-ID pass, lit Spine, the skies, shadow depth passes, the scene grid, screen gizmos and the post-processing stack), compiled to SPIR-V by dotnet build (slangc, with shared includes in include/; the committed .spv files are the fallback when the Vulkan SDK is missing) and loaded at run time through ContentPaths. Light/shadow limits come from limits.json. After editing one, just shaders refreshes the committed SPIR-V. See Shaders.

Spine: Plugins/Spine is the Spine C# runtime (skeleton data in JSON or binary, skeletal transforms and IK, region and mesh attachments, the animation state machine, skins and slots); SpineNode draws it (Spine). It is under the Spine Runtimes License, not MIT (see the README’s licence section).

Terminal window
just test # engine unit tests (no GPU)
just test-render # render tests: golden images, Vulkan validation gate, 0-bytes-per-frame allocation gate
just render-tests-linux # the same on lavapipe in an x86_64 Docker container, like CI
just qa # one screenshot per Demo scene (docs/images/demo)
just bench # benchmarks against Tests/MainframeEngine.Benchmarks/baseline.json

The Demo’s screenshots come from just demo-screenshots (alias just qa), scaled to 1280 × 720 so the README’s grid shows them at one size.

CI (ci.yml) builds with warnings as errors and runs the unit tests on Linux, Windows and macOS, dotnet format, a shader check (committed SPIR-V matches its sources), the render tests on Mesa’s lavapipe under Xvfb, and a template smoke test (dotnet new mfgame, build, run headless). Docs-only pull requests skip all of that (build/ci-changes.sh). ci-success is the single required check on main. See Testing and Build & platforms.

The version lives only in git tags (vX.Y.Z, SemVer, first release v1.0.0). publish.yml (manual, main only) re-runs CI, bumps the patch of the latest tag, attaches the Demo zip and the packages to a GitHub Release, and pushes the MainframeEngine and MainframeEngine.Templates packages to nuget.org. just publish-local builds the same files locally. The editor releases from its own repository. See Release & versioning.

These pages are the repository’s Markdown in docs/, published with the landing page at engine.mainframe.games. just docs serves it locally with live reload; see Docs site.