Gamma
NOTE: THIS IS A FOUNDATION AND MUCH OF IT WILL CHANGE.
Gamma is a general-purpose engine: a native C++ core with Luau embedded, for building games, but equally for tools, desktop apps, dashboards, visualisations, kiosks, prototypes and anything else that needs a window, input, rendering and a capable UI. A Gamma program is a folder of Luau files (and assets) that Gamma runs, and that can be shipped as its own executable.
Gamma started as a Roblox-style game framework. It no longer aims to copy Roblox: see Leaving Roblox behind.
This page is the design: what Gamma is for and why. To use it, start at the docs index. Each system gets its own page as it is built. The UI system, the biggest focus, is designed in ui.md. Every class, datatype, library and enum is listed in the API reference, which Gamma docs writes from the engine.
The idea
- One engine, any kind of program. A program can have a 3D scene, a 2D canvas, a UI, all three, or none (a command-line tool or a headless test). Nothing assumes there is a player, a character, a camera or a world.
- Everything is an object in a tree. Objects have properties, children and events, and are described by a class registry, so they can be inspected, saved, scripted and generated (for example the Luau type definitions) from one place.
- Scripts are Luau or Gama.
requireworks on file paths with.luaurcaliases, and thetaskscheduler gives scripts cooperative threads, waiting and deferred work. Gama is Gamma's own Luau-like language in.gmafiles, which Gamma translates to Luau as it loads them: it adds event handlers, scheduling, UI and instance trees, and vector and colour literals, and comes with a type checker, a language server and a VS Code extension. - The UI system is the centrepiece. It aims at close to what HTML, CSS and JavaScript give a web page: a box model, flexbox and grid, a real cascade with selectors and states, transitions and animations, rich text, form controls, DOM-like events and built-in reactivity. Game HUDs, editor panels and full desktop apps are all built with it. See ui.md.
- No built-in editor. Gamma is an engine and a runtime, not a studio. Tools such as an inspector, a scene editor or a UI designer are meant to be written as Gamma programs on the UI system. That keeps the engine small and proves the UI is good enough for real applications.
- Single process first. A program owns its whole tree. Networking (sockets, HTTP, and later replication of chosen parts of the tree) is a library a program opts into, not a client/server split every program has to design around.
Why Luau
Luau is Lua 5.1 with gradual types, good performance, string interpolation, generalized iteration and a proper sandbox. Plain Lua code mostly runs as-is, and luau-lsp gives editors autocomplete and type checking against the definitions Gamma generates (gamma.d.luau).
Gama builds on that rather than replacing it. A .gma file becomes Luau line for line, so it runs on the same VM with the same performance, and Luau.Analysis type checks it through Gamma check and Gamma lsp.
Luau packages that do not depend on any one platform (pure logic, data structures, promises, signals) can still be used through pesde or Wally and .luaurc aliases. Running Roblox-specific packages unchanged is no longer a goal.
Leaving Roblox behind
The first phases of the plan copied Roblox's API closely so Roblox packages would run. That goal is dropped, because it ties every design decision to a platform made for one kind of game. The "Clean break" phase of the plan made the change in steps.
What went:
- The Roblox GUI (
ScreenGui,Frame,TextLabel,UDim2,UIListLayoutand the rest),UDimand Dear ImGui, replaced by the new UI system. - The ImGui editor (
Gamma edit) and the editor-onlySelectionservice. - Roblox-only concepts:
Players,LocalPlayer,StarterGui/PlayerGuicopying,BrickColor,ReplicatedStorage,ServerScriptServiceandServerStorage,LocalScriptandRunContext, andRunService:IsStudio()and friends. - The
gameandworkspaceglobals andGetService: each service is now a global of its own, named for what it does (Scene,Run,Input,Http,Files,Tweens,Tagsand the rest; see projects.md). - Project folders named after services, replaced by a
main.luauand anassetsfolder (projects.md). - The legacy
wait,spawn,delay,tickandelapsedTimeglobals,sharedand the shared_G. - Roblox names for datatypes:
CFrameisTransform,Color3isColor,RBXScriptSignalisSignalandRBXScriptConnectionisConnection. - The vendored Roblox packages and the specs that checked them.
What stays, because it is generally useful:
- The object tree (
Instance), class registry, properties,Changedevents and attributes/tags. Signal, thetaskscheduler, filerequire,ScriptandModuleScriptinstances for places, and the text place format.- Math and value types: vectors,
Transform,Color, colour/number sequences, rects, ranges, rays,DateTime, tweening andEnum. - The renderer, raycasts and overlap queries, data stores, the profiler and
debug.profilebegin.
Some Roblox spellings remain and may change later: the enum names and values, method names such as GetPartBoundsInBox, studs as the unit of length, and the C++ type names (CFrame, Color3 and the *Service classes) behind the Luau names.
Planned features
Roughly in the order they matter:
UI (see ui.md)
- Primitive nodes (
View,Text,Image,TextInput,ScrollView,Canvas) and a Luau standard library of widgets built from them - Flexbox, grid, absolute/fixed/sticky positioning and the CSS box model
- Style sheets with selectors, specificity, inheritance, custom properties, media queries, transitions and keyframe animations
- Rich, shaped text with font fallback, bidirectional text, selection and IME
- Pointer, keyboard and focus events with capture and bubbling, drag and drop, clipboard
- Built-in reactive state, so trees update themselves without a framework package
- Multiple windows, UI in the 3D world and UI rendered to textures
Application
- Multiple windows, native menus, file dialogs, clipboard, notifications
- File system, processes, HTTP and sockets behind explicit permissions
- Exporting a program as a standalone executable
Graphics and simulation
- 3D rendering with PBR materials, shadows, skyboxes and post-processing
- A 2D vector canvas (paths, fills, strokes) usable inside the UI and on its own
- Rigid body physics, constraints and raycasting
- Audio, including 3D sound
- Skinned meshes and animations, played by
MeshPart
Other
- Text place format for git, plus a binary format for shipping
- Hot reloading of scripts and styles
- Sandboxing, so a script only gets the access it is given
Tech stack
Language: C++ (C++20)
Luau is written in C++, so embedding it (VM, compiler, analyzer, require library) needs no bindings layer. An object tree where everything has a parent, children and scripts holding references fits C++ ownership more directly than Rust's borrow checker, and most of the libraries below are C++ first.
Libraries
| Area | Library | Notes |
|---|---|---|
| Scripting | Luau | VM, compiler, analyzer and require-by-string. The analyzer type checks Gama in Gamma check and Gamma lsp |
| Window, input | SDL3 | Also gamepads, clipboard, IME and multiple windows |
| Rendering | bgfx | One API over Vulkan, D3D12, Metal and OpenGL; the UI renderer is Gamma's own on top of it |
| UI layout | Yoga | Flexbox; grid is Gamma's own |
| Text | stb_truetype, then FreeType + HarfBuzz | stb first for simple Latin text, then proper shaping, fallback and bidi |
| Physics | Jolt Physics | Rigid bodies for parts while Scene.PhysicsEnabled is on; see projects.md. Welds and constraints are next |
| Audio | miniaudio | Single file, supports 3D sound |
| Networking | ENet | Reliable UDP between a game server and its clients, for multiplayer. Not in the web build |
| Models | assimp | MeshPart models: glTF, FBX, OBJ and the other formats assimp reads |
| Levels of detail | meshoptimizer | Simplifies each model into the coarser copies a MeshPart is drawn with far away |
| Images | stb_image | libwebp for WebP |
| HTTP | libcurl | Http:GetAsync and images from URLs, and Http:DownloadAsync(url, path, headers?), which writes a large file to disk as it arrives. Its WebSocket support is behind Http:CreateWebStreamClient. The web build uses the browser's fetch, and cannot download to files |
| Files and programs | The OS (std::filesystem, posix_spawn, CreateProcess) | Files reads, writes, lists, moves, copies, links and removes files, with ReadFile, WriteFile, GetInfo, ListDirectory, CreateDirectory, Remove (a file, link or empty directory), RemoveAll, Move, CreateSymlink, CreateTemporaryDirectory, CopyAsync and GetSha256Async. Process has GetArguments (what follows the file in Gamma run <File.luau> [arguments...]), GetEnvironmentVariable, IsElevated (root, or an elevated administrator), Exit(code?), and RunAsync(program, arguments?, {Input?, Directory?, Timeout?}?), which yields until the program exits and returns its ExitCode, Output, Error and TimedOut. With them a Luau file can be a system tool, run as gamma run tool.luau ... |
| Serial ports | The OS (Win32 with SetupAPI, POSIX termios) | Serial:GetPorts() lists ports with their USB vendor, product and interface; Serial:Open(path, baudRate?) gives a SerialPort with Write, Close, DataReceived(data) and Closed(reason), 8 data bits, no parity, one stop bit. Not in the web build |
| Web | Emscripten | WebAssembly build on WebGL2, from the web preset, or web-threads for threads. Data stores are kept in IndexedDB, and Location:GetLocationAsync asks the browser where the device is (the desktop builds cannot yet) |
| Math | GLM | |
| Serialization | simdjson + zstd | Text and compressed binary formats |
| File dialogs | nativefiledialog-extended | |
| Profiling | Tracy | |
| Tests | doctest |
Build and packages
- Build system: CMake
- C++ packages: vcpkg in manifest mode (
vcpkg.jsonin the repo root), so dependencies are pinned and installed automatically on configure - Headless build: the
headlesspreset (linux-arm64-headlessto cross-compile for a Raspberry Pi) sets theGammaHeadlessoption, which leaves out the window, the renderer, SDL3 and bgfx, and turns off thegraphicsfeature invcpkg.jsonso they are never built. It needs no window system or GPU libraries, so it suits system tools and services such asgamma run tool.luau. It canrun,export,manifestanddefinitions, but notplay, and a program it exports runs asrundoes, with its command line as the arguments. The clipboard is Gamma's own, and every service and class is still there - Luau tooling: Rokit for tools like
luau-lsp, StyLua and Selene - Luau packages: pesde (Wally packages also supported)