Safi Engine
A pure-C game engine

SDL3 GPU ยท Bevy-style ECS ยท MicroUI ยท zero-setup CMake

SafiEngineSafiEngine
๐ŸงŠ

Pure C11, zero dependencies to install

Just CMake and a C/C++ compiler. FetchContent pulls SDL3, flecs, cglm, cgltf, stb, and MicroUI on first configure. No brew, no apt, no submodules, no C++ in the engine.

๐ŸŽฎ

SDL_gpu renderer

Modern explicit GPU API with Metal, Vulkan, and D3D12 backends. Current milestone targets Metal on macOS with shaders authored in MSL; cross-platform shader pipelines are a planned follow-up.

๐Ÿงฌ

Bevy-style ECS in C

Powered by flecs. Components, queries, systems, pipelines, observers, and singletons โ€” with a familiar Bevy-inspired API, just in plain C.

๐ŸชŸ

MicroUI debug overlay

Tiny pure-C immediate-mode UI (~1100 SLOC) with a custom SDL_gpu batched-quad backend. Drop inspectors, number fields, and tooling into any scene without dragging C++ into a C engine.

๐Ÿ“ฆ

glTF 2.0 loader

Load .gltf and .glb straight into a GPU mesh and material via cgltf and stb_image. The starter demo rotates a textured box with the arrow keys and WASD.

๐Ÿงฑ

Procedural primitives

Plane, box, sphere, and capsule generated on the fly. Drop a SafiPrimitive component on an entity and edit shape, dimensions, color, or texture path live in the inspector โ€” the engine rebuilds the mesh for you.

๐Ÿ”Š

Audio with miniaudio

2D and 3D positional audio, mixer buses (master/music/sfx/ui), streaming for long files, and built-in WAV/FLAC/MP3 decoding. One handle-based C API, zero extra setup.

โšก

Zed / clangd friendly

CMake emits compile_commands.json and symlinks it to the project root. Open any file in Zed, VS Code, or Neovim โ€” clangd resolves every engine header with no extra config.