Skip to content

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. require works on file paths with .luaurc aliases, and the task scheduler gives scripts cooperative threads, waiting and deferred work. Gama is Gamma's own Luau-like language in .gma files, 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, UIListLayout and the rest), UDim and Dear ImGui, replaced by the new UI system.
  • The ImGui editor (Gamma edit) and the editor-only Selection service.
  • Roblox-only concepts: Players, LocalPlayer, StarterGui/PlayerGui copying, BrickColor, ReplicatedStorage, ServerScriptService and ServerStorage, LocalScript and RunContext, and RunService:IsStudio() and friends.
  • The game and workspace globals and GetService: each service is now a global of its own, named for what it does (Scene, Run, Input, Http, Files, Tweens, Tags and the rest; see projects.md).
  • Project folders named after services, replaced by a main.luau and an assets folder (projects.md).
  • The legacy wait, spawn, delay, tick and elapsedTime globals, shared and the shared _G.
  • Roblox names for datatypes: CFrame is Transform, Color3 is Color, RBXScriptSignal is Signal and RBXScriptConnection is Connection.
  • The vendored Roblox packages and the specs that checked them.

What stays, because it is generally useful:

  • The object tree (Instance), class registry, properties, Changed events and attributes/tags.
  • Signal, the task scheduler, file require, Script and ModuleScript instances for places, and the text place format.
  • Math and value types: vectors, Transform, Color, colour/number sequences, rects, ranges, rays, DateTime, tweening and Enum.
  • 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 ​

AreaLibraryNotes
ScriptingLuauVM, compiler, analyzer and require-by-string. The analyzer type checks Gama in Gamma check and Gamma lsp
Window, inputSDL3Also gamepads, clipboard, IME and multiple windows
RenderingbgfxOne API over Vulkan, D3D12, Metal and OpenGL; the UI renderer is Gamma's own on top of it
UI layoutYogaFlexbox; grid is Gamma's own
Textstb_truetype, then FreeType + HarfBuzzstb first for simple Latin text, then proper shaping, fallback and bidi
PhysicsJolt PhysicsRigid bodies for parts while Scene.PhysicsEnabled is on; see projects.md. Welds and constraints are next
AudiominiaudioSingle file, supports 3D sound
NetworkingENetReliable UDP between a game server and its clients, for multiplayer. Not in the web build
ModelsassimpMeshPart models: glTF, FBX, OBJ and the other formats assimp reads
Levels of detailmeshoptimizerSimplifies each model into the coarser copies a MeshPart is drawn with far away
Imagesstb_imagelibwebp for WebP
HTTPlibcurlHttp: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 programsThe 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 portsThe 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
WebEmscriptenWebAssembly 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)
MathGLM
Serializationsimdjson + zstdText and compressed binary formats
File dialogsnativefiledialog-extended
ProfilingTracy
Testsdoctest

Build and packages ​

  • Build system: CMake
  • C++ packages: vcpkg in manifest mode (vcpkg.json in the repo root), so dependencies are pinned and installed automatically on configure
  • Headless build: the headless preset (linux-arm64-headless to cross-compile for a Raspberry Pi) sets the GammaHeadless option, which leaves out the window, the renderer, SDL3 and bgfx, and turns off the graphics feature in vcpkg.json so they are never built. It needs no window system or GPU libraries, so it suits system tools and services such as gamma run tool.luau. It can run, export, manifest and definitions, but not play, and a program it exports runs as run does, 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)

Apache License 2.0