Build Plan
A step-by-step plan for building the foundation of Gamma. It is written so an agent can pick up the next unchecked step and finish it without further context. The design it implements is in docs.md.
How to work through this plan
- Read AGENTS.md and contributing.md first. Their rules apply to every step.
- Take the first unchecked step. Do not start a step whose earlier steps are unchecked.
- Do only what the step lists. If something outside the step looks necessary, add it to "Open questions" at the bottom instead of building it. Work the user asks for outside the plan is fine; list it under "Work outside the plan" so later steps know it exists.
- A step is finished when every item under "Done when" is true and the checks below pass. Then tick its checkbox in this file and commit, using the commit title given for the step.
- One step is one commit, or one small pull request. Never combine steps. A step that says it may be several commits is still one step.
- Stop and ask the user when a step needs a decision this plan does not make, when a library does not behave as the step assumes, or when a "Done when" item cannot be met. An open question marked "Ask the user" must be answered before its step starts.
- Check a library's current documentation before using its API. Do not write calls from memory for Luau, SDL3, bgfx, Dear ImGui, luau-lsp or vcpkg ports. Check that a vcpkg port exists at the pinned baseline, and which features it has, before planning around it.
- Before starting a step, read the open questions that name it and the "Work outside the plan" list. Earlier work may already cover part of the step, or change how it should be done.
Checks for every step
These are what CI runs, so a step that skips them fails its pull request.
cmake --build --preset debugandctest --preset debugpass.clang-format --dry-run --Werrorpasses on the changed C++ files (CI pinsclang-format23.1.5).stylua --check .andselene .pass.- Every feature exposed to Luau has a
*.spec.luaufile as well as its C++ tests (from step 9 on). - New user-facing behaviour is documented in
DOCS/when a step says so, or when it changes something already documented there, such as projects.md.
Layout
All steps use this layout. Create a folder only when the step that needs it arrives.
CMakeLists.txt
CMakePresets.json
vcpkg.json
rokit.toml
gamma.yml selene std for Gamma's globals
Source/
Core/ signals, logging, shared utilities
Instances/ Instance, reflection, Variant, DataModel and the instance classes
Services/ RunService, LogService and the other services
DataTypes/ Vector3, CFrame, Color3, UDim2, Enum and the other value types
Scripting/ Luau VM, scheduler, require, definitions, project loading
Bindings/ Luau bindings for instances and datatypes
Rendering/ window, bgfx, scene and UI drawing
Ui/ UI nodes, styles and layout (from step 21)
Runtime/ the Gamma executable (main)
Tests/ doctest tests, one file per system
Luau/ Luau specs (*.spec.luau), the Test.luau helper and fixtures
Projects/ project folders, each run by ctest through Gamma run
DOCS/ design, contributing rules, this plan and one page per user-facing system
Assets/ files compiled into the engine, such as the default fonts and their licence
cmake/ CMake scripts the build runsEverything except Runtime/ builds into one static library, GammaEngine. Runtime/ builds the Gamma executable and Tests/ builds GammaTests, both linking GammaEngine. Each Tests/Luau/*.spec.luau and each Tests/Projects/* folder is its own CTest entry.
Phase 0: Tooling
[x] Step 0: Check the machine
State on 2026-11-12 (Windows 11): CMake 4.4, Ninja, Rokit, StyLua, Selene and gh are installed. vcpkg, clang-format and a C++ compiler were not found on PATH, and VCPKG_ROOT is not set.
- Check for Visual Studio 2022 Build Tools with the C++ workload (
vswhere). MSVC is normally absent fromPATHoutside a developer shell, so a missingcldoes not prove it is missing. - Check for vcpkg and
clang-formatagain. - Do not install anything yourself. Report what is missing to the user with the install command for each, and wait.
Done when: a C++20 compiler, vcpkg (with VCPKG_ROOT set) and clang-format are all available. No commit.
[x] Step 1: Build skeleton
CMakeLists.txt: C++20, warnings on, theGammaEngine,GammaandGammaTeststargets,enable_testing()and doctest test discovery.CMakePresets.json: one Ninja preset each for debug and release, using the vcpkg toolchain file fromVCPKG_ROOT.vcpkg.json: manifest mode with a pinnedbuiltin-baseline. The only dependency isdoctest..clang-formatmatching the naming rules in AGENTS.md, and a.gitignorecoveringbuild/and vcpkg output.Source/Runtime/Main.cppthat prints the version and exits, andTests/Main.cppwith one trivial passing test.
Done when: configure, build and ctest succeed from a clean checkout, and Gamma runs. Commit: [CHORE] Add CMake and vcpkg build skeleton
[x] Step 2: Luau tooling and real commands
rokit.tomlpinningluau-lsp, StyLua and Selene. Addstylua.toml,selene.tomland a.luaurc.- Replace the planned commands in the "Commands" section of AGENTS.md with the real ones from step 1, and remove the note saying the build is not set up.
Done when: rokit install, stylua --check . and selene . run cleanly. Commit: [CHORE] Add Luau tooling configuration
[x] Step 3: Continuous integration
- A GitHub Actions workflow that configures, builds and tests on Windows and Linux, with vcpkg binary caching.
- A second job that runs
clang-format --dry-run --Werror,stylua --checkandselene.
Done when: both jobs pass on a pull request. Commit: [CHORE] Add build and lint workflows
Phase 1: Instance system
No Luau in this phase. Everything is plain C++ and tested with doctest.
[x] Step 4: Signal
Source/Core/Signal.h: a typed signal withConnect,Once,Disconnecton the returned connection, andFire.- Disconnecting or connecting from inside a handler while the signal is firing must be safe.
Done when: tests cover firing order, disconnect during fire, connect during fire and Once. Commit: [MINOR] Add Signal
[x] Step 5: Instance tree
InstancewithName,ClassName,Parent,GetChildren,GetDescendants,FindFirstChild,FindFirstChildOfClass,IsA,IsDescendantOf,GetFullName,DestroyandClearAllChildren.- Signals:
ChildAdded,ChildRemoved,DescendantAdded,DescendantRemoving,AncestryChanged,Destroying. - Ownership: a parent holds its children with
std::shared_ptrand a child holds its parent weakly. Record this choice in a short comment at the class. - Reject a parent change that would create a cycle.
DestroylocksParent, disconnects all signals and destroys the descendants.
Done when: tests cover reparenting, cycle rejection, event order and every Destroy rule above. Commit: [MAJOR] Add Instance tree
[x] Step 6: Reflection
- A class registry holding, for each class: its name, its superclass, a factory, and descriptors for its properties, methods and events.
- A
Varianttype for property values. Start with nil, bool, number, string and Instance reference. Later steps add to it. Instance::GetPropertyandSetPropertyby name,ChangedandGetPropertyChangedSignal, and aCreateInstance(ClassName)function.- Register
Instanceitself and aFolderclass through the registry, as the proof that it works.
Done when: tests create a Folder by name, read and write Name through the generic property path, and see Changed fire once per actual change. Commit: [MAJOR] Add class registry and property reflection
[x] Step 7: DataModel and services
DataModelwithGetServiceandFindService. A service is created on first request and exists once.- Empty
Workspace,ReplicatedStorage,ServerScriptServiceandRunServiceclasses.RunServicegetsHeartbeatandSteppedsignals and aStep(DeltaTime)function that fires them. - Services cannot be created with
CreateInstance, reparented or destroyed.
Done when: tests cover the service lifetime rules and Heartbeat firing with the given delta time. Commit: [MAJOR] Add DataModel and core services
Phase 2: Luau
[x] Step 8: Embed Luau
- Add Luau to the build. Use the vcpkg port if it provides the VM, compiler, analysis and require targets. Otherwise use
FetchContentpinned to a release tag. Check which is true before choosing, and write the result in "Open questions". Source/Scripting/ScriptEngine: create a state, compile and run a source string, report compile and runtime errors with a traceback, enable the sandbox (luaL_sandbox), and sendprintandwarnto a replaceable output callback.Gamma run <File.luau>runs a file and exits with a non-zero code on error.
Done when: tests run a script, capture its print output, and get a readable error for both a syntax error and a runtime error. Commit: [MAJOR] Embed Luau
[x] Step 9: Luau test runner
- A small Luau test helper in
Tests/Luau/withexpectstyle assertions, and a CTest entry that runs every*.spec.luaufile throughGamma run. - From this step on, every feature exposed to Luau gets a spec file as well as its C++ tests.
Done when: one passing spec runs under ctest, and a deliberately failing spec makes ctest fail (then remove it). Commit: [CHORE] Add Luau spec runner
[x] Step 10: Instance bindings
- Push an
Instanceto Luau as userdata. The same instance must always give the same userdata, so==and table keys work. A userdata keeps its instance alive. __indexand__newindexdriven entirely by the registry from step 6: properties first, then methods, then events, then children by name. No per-class binding code.- Signals as objects with
Connect,OnceandWait, returning a connection withDisconnectandConnected. - Globals:
Instance.new(ClassName, Parent?),game,workspace, andtypeofreturning"Instance". - Errors use Roblox's wording where practical (
X is not a valid member of Folder "Y"), since packages match on it.
Done when: specs build a tree from Luau, connect to ChildAdded, call game:GetService("Workspace"), and check the identity and error rules above. Commit: [MAJOR] Bind instances to Luau
[x] Step 11: Task scheduler
- The
tasklibrary:spawn,defer,delay,wait,cancel. Plus the legacywaitandspawnglobals. - The scheduler resumes waiting threads from
RunService:Step. Signal handlers run in their own coroutine so a handler can yield. Gamma runkeeps stepping at 60 Hz until no threads are waiting and no connections are left that could wake one, then exits.
Done when: specs cover resume order for spawn and defer, task.wait returning elapsed time, task.cancel, and yielding inside a Heartbeat handler. Commit: [MAJOR] Add task scheduler
[x] Step 12: Datatypes
- Add GLM. Implement
Vector3,Vector2,Color3,UDim,UDim2andCFramewith their Roblox constructors, operators, methods and constants. - Decide whether
Vector3uses Luau's nativevectortype, and record the decision in "Open questions". It is faster, but check howtypeofand theVector3library table would work first. Enumwith theEnum.X.Yaccess pattern andEnumItemvalues, generated from the registry.- Add each type to
Variant. One commit per type or closely related pair; this step may be several commits.
Done when: specs for each type compare against values taken from Roblox's documented behaviour, including CFrame multiplication and Lerp. Commit: [MINOR] Add <Type> datatype
[x] Step 13: Scripts and require
Script,LocalScriptandModuleScriptclasses with aSourceproperty. AScriptruns when it enters the DataModel under a container that runs scripts. Each script gets its ownscriptglobal.require(ModuleScript)runs a module once and caches the result.require("./Path")and.luaurcaliases use Luau's require library.Gamma run <Folder>loads a folder as a project: a small mapping from files to instances (Name.server.luau,Name.client.luau,Name.luau,init.luau). Keep the mapping minimal and document it inDOCS/.
Done when: specs cover module caching, a cyclic require error, path and alias requires, and a project folder with a script that requires a module. Commit: [MAJOR] Add script instances and require
[x] Step 14: Package check
- Vendor two pure-logic Roblox packages into
Tests/Packages/, a Signal and a Promise implementation, with their licences. - Write a spec that uses each one. Fix what breaks in Gamma, not in the package. List anything that cannot be fixed yet in "Open questions".
Done when: both specs pass with the packages unmodified. Commit: [CHORE] Add package compatibility specs
Phase 2b: Hardening
Small steps that make the next phases safer to build. They change no engine behaviour.
[x] Step 14a: Sanitizer build
- An
asanconfigure, build and test preset that builds debug with AddressSanitizer and UndefinedBehaviorSanitizer on GCC and Clang. MSVC only supports AddressSanitizer; leave the preset Linux-only unless it works there unchanged. - A Linux CI job that builds and runs
ctestwith that preset. Leak detection stays on: an instance tree that is never freed is a bug here (see theObjectValueand reparenting-test fixes).
Done when: the job passes on a pull request, and a deliberately leaked Instance in a test makes it fail (then remove it). Commit: [CHORE] Add sanitizer preset and CI job
[x] Step 14b: Luau definitions from the registry
Gamma definitions <Directory>writes a luau-lsp definitions file and a selene std file generated from the class registry, the enums and the datatype bindings, so they cannot drift from the engine.- Replace the hand-written
gamma.ymlwith the generated std, and point.luaurcor the luau-lsp settings at the definitions file. Commit the generated files. - A CI step regenerates both and fails if they differ from the committed ones.
- Check the luau-lsp definitions format and its
analyzecommand against its current documentation first.
Done when: selene . passes with the generated std, luau-lsp analyze reports no unknown-global or unknown-member errors in Tests/Luau/ (the vendored packages may be excluded), and the CI check fails after a registry change that was not regenerated. Commit: [MINOR] Generate Luau definitions from the registry
Phase 3: Window and rendering
[x] Step 15: Window and input
- Add SDL3.
Gamma play <Folder>opens a window, runs the project, stepsRunServiceevery frame and closes cleanly.Gamma runstays headless and never initialises SDL's video subsystem. UserInputServicewithInputBegan,InputEnded,InputChangedandIsKeyDown, and anInputObjectclass carryingKeyCode,UserInputType,UserInputState,PositionandDelta. Add theKeyCode,UserInputTypeandUserInputStateenums.- Keep the SDL translation in
Rendering/and giveUserInputServicean engine-side entry point that takes Gamma's own input event, so tests can feed it without SDL or a display. - Before starting, answer the step 15 question in "Open questions" about
LocalScriptandRunService:IsClient().
Done when: doctest and a spec drive UserInputService through the engine-side entry point and see the right events, IsKeyDown state and gameProcessedEvent argument (always false until there is game UI); a manual project under Tests/Manual/ prints key presses in Gamma play (not run by ctest); and the headless tests still pass on CI with no display. Commit: [MAJOR] Add window and input
[x] Step 16: Renderer
- Add bgfx. Check first that the vcpkg port at the baseline builds
shaderc(itstoolsfeature) and works with SDL3's native window handles; if not, stop and ask. - Initialise bgfx on the SDL window, handle resize, and clear the screen. Compile shaders in the build with
shaderc. BasePartwithSize,CFrame,Position(derived fromCFrame),Color,TransparencyandAnchored, andPartunder it.CamerawithCFrameandFieldOfView.Workspace.CurrentCamerais created with theWorkspaceand is a reference property.- Draw every
BasePartunderWorkspaceas a box with simple directional lighting. AddRunService.RenderStepped, which fires only inGamma play, before drawing, soGamma runexit rules do not change. Gamma play <Folder> --screenshot <File.png> --frames <N>renders N frames, saves the last one and exits, so the result can be checked without a person watching.
Done when: a project under Tests/Manual/ that spawns parts and moves the camera on RenderStepped shows the expected scene, the --screenshot output is attached to the pull request, and Part and Camera properties have doctests and specs that run headless. Commit: [MAJOR] Add bgfx renderer with Part and Camera
Phase 4: Editor and saving
[x] Step 17: Place files
- A readable JSON format that stores a tree with class names, properties, attributes, tags and instance references, written with stable ordering (properties and attributes by name, children in tree order) so diffs stay small.
- Write numbers with the shortest form that reads back to the same
double(std::to_chars), and everyVarianttype (Vector3,CFrame,Color3,UDim2,EnumItem,NumberRangeand the rest) in a fixed shape, so output is byte-identical on every platform. - Reuse
Source/Instances/Jsonfor reading and writing, moving it toCore/if needed. Add simdjson only if loading a large place is measurably slow, and record that in "Open questions". - Save and load through the registry only. A property marked as not serialised is skipped, and an instance with
Archivablefalse is not saved, as in Roblox. A reference to an instance outside the saved tree is saved as nil. References use ids local to the file, asClonerewrites them. Gamma run <Place.json>loads a place and runs it like a project folder.- Document the format in
DOCS/.
Done when: a round-trip test saves, loads and saves a tree again and gets byte-identical output; tests cover every Variant type, a reference inside and outside the tree, a non-archivable instance and a skipped property; and a spec runs a place file through Gamma run. Commit: [MAJOR] Add text place files
Notes: built before steps 14b, 15 and 16, at the user's request to keep adding features (step 15 and 16 cannot be built in this container). The format is documented in places.md. Only properties that differ from a new instance of the class are written, which keeps files small; a changed engine default therefore changes what an old place loads as. PropertyDescriptor::Serialized marks a property place files skip; Archivable is the first, since only archivable instances are saved. Every Variant type has a written form, but TweenInfo, Ray, DateTime and the two keypoint types are tested only through their code, since no property or attribute holds them yet. The C++ tests ran here through a stand-in for doctest; the Gamma run place test (Tests/Places/Basic.json) could not be run here.
[x] Step 18: Editor shell
- Add Dear ImGui (docking branch) with its SDL3 and bgfx backends. Check that the vcpkg
imguiport offers the docking branch and both backends at the baseline before starting.Gamma edit <Place>opens the editor. - Panels: Viewport (the scene rendered to a texture, with a fly camera), Explorer (tree, select, rename, delete, insert from the registry's creatable classes), Properties (generated from the registry, with enum properties as dropdowns) and Output (listening to
LogService.MessageOut, coloured byMessageType). - Keep each editor operation (insert, rename, delete, set property, select) as a function on the engine side, separate from the ImGui drawing, so it can be tested with doctest. Store the selection in a
Selectionservice, as Roblox does, so later plugins can read it. - Save and open through step 17. One commit per panel.
Done when: a place can be opened, edited through Explorer and Properties, saved and reopened with the changes intact; and doctests cover each editor operation and that a save after open with no edits writes the same bytes. Commit: [MAJOR] Add editor shell then [MINOR] Add <Panel> panel
[x] Step 19: Play mode
- Play copies the edited DataModel, runs scripts in the copy and shows it in the viewport. Stop discards the copy and returns to the edited tree.
- Copy by saving the edited DataModel to the step 17 format in memory and loading it into a new
DataModel. Services cannot be cloned, and this keeps one copy path. - Closing a
DataModelmust be defined first (see the step 7 question): stop every script, cancel its threads, delayed callbacks, tweens andDebrisitems, disconnect handlers, and free the tree. EachDataModelhas its ownScriptEngineand scheduler. - During play,
RunService:IsRunning()is true in the copy andIsEdit()is false; in the edited treeIsEdit()is true. Update the step 11 answer that says Gamma always answers as a running server.
Done when: changes made by scripts during play are gone after stop, edits made before play are still there, a script left yielding or a tween left playing at stop does not run again, and ten play and stop cycles in a test free every instance (checked by the step 14a sanitizer job). Commit: [MAJOR] Add play mode
Direction change (15 Nov 2026)
Phases 0 to 4 built a Roblox-style game engine. At the user's request Gamma is now a general-purpose engine for apps, tools, UIs and games, with no built-in editor and a clean break from Roblox compatibility. The reasons and what stays are in docs.md, and the new UI system is designed in ui.md. Steps 18 and 19 (the editor) are undone by step 20. Everything checked above stays as history; later steps change or remove some of it, and say so.
The phases below replace the old "Later" list. The items on it that still apply (physics, audio, glTF, the binary format, hot reloading, the Luau debugger, standalone export, opt-in networking) come after phase 9 and are not planned in detail yet. Undo/redo, gizmos and the command bar were editor features and are dropped.
Phase 5: Remove the editor
[x] Step 20: Remove the editor
- Move
Source/Editor/ImGuiRenderertoSource/Rendering/: the old Roblox-style GUI (Rendering/GuiOverlay) still draws through it until step 27. - Delete the rest of
Source/Editor/(the editor, its operations and state,PlaySessionand the panels), theGamma editcommand, the editor tests (Tests/EditorOperations.cpp,Tests/PlaySession.cpp) andDOCS/editor.md.Core/Profilerstays forGamma play --profile. - Remove the
Selectionservice and its spec, which only the editor used.RunService's edit/studio answers go in phase 9 with the rest of the Roblox names. - Drop the imgui
docking-experimentalfeature fromvcpkg.json, and regenerate the definitions.
Done when: the build, tests and lint pass without Source/Editor/, and nothing in DOCS/ describes the editor as current. Commit: [MAJOR] Remove the editor
Phase 6: UI foundation
Builds the node tree, style properties and layout of ui.md next to the old GUI, without drawing yet. Everything is testable headless.
[x] Step 21: UI nodes and flex layout
- Add
yogatovcpkg.json(port 3.2.2 at the baseline). Source/Ui/:UiNode(base of every UI node),ViewandSurface, registered through the class registry so properties,Changedand the Luau bindings work as for every other class.- A
Lengthvalue holding a number and a unit (Px,Percent,Auto,None). Luau sets length properties with strings ("12px","50%","auto","none") or plain numbers of pixels, and reads them back as strings, so no new Luau datatype is needed. The box shorthands (Margin,Padding,BorderWidth,Inset,Gap) take CSS's one to four values. - Layout properties with CSS names and meaning:
Display,Position,Width,Height, the min and max sizes,Margin,Padding,BorderWidth,Insetsides,FlexDirection,FlexWrap,JustifyContent,AlignItems,AlignSelf,AlignContent,FlexGrow,FlexShrink,FlexBasis,Gap,AspectRatio.FlexDirectiondefaults toColumnandBoxSizingis always border-box, as in React Native. Surface:Layout(width, height)syncs a Yoga tree with the UI nodes (only for nodes whose layout inputs changed) and writes each node's read-onlyLayoutRect, relative to the surface.LayoutChangedfires when a node's rect changes.- A
Uiglobal with constructors that take a props table:Ui.View({ Width = "50%", Children = { ... } }), setting properties and parenting children, andUi.new(className).
Done when: doctests cover row and column, grow and shrink, percent sizes, padding with gap, wrap, absolute insets, Display = None and that an unchanged tree is not laid out again; a spec builds a tree with the constructors and checks LayoutRect; definitions are regenerated. Commit: [MAJOR] Add UI nodes and flex layout
Notes: the Text node moved to step 24, since a text node needs measurement to take part in layout. Display, PositionType, FlexDirection, FlexWrap, Justify and Align are registered enums whose items also accept their names as strings. The Position property takes PositionType. AspectRatio 0 means none. Positions in LayoutRect are relative to the surface; a Surface inside another UI tree is skipped by its parent's layout. Yoga's children are synced with the tree lazily, at the start of each Surface:Layout.
[x] Step 22: More lengths and grid
- Lengths
em,rem,vw,vh,frand sums such as"100% - 24px"(resolved before Yoga sees them). Display = Grid:GridTemplateColumns/Rowswithfr,minmax(),repeat()andauto-fill,GridColumn/GridRowplacement, gaps and auto-placement, laid out by Gamma and handed to Yoga as absolute children.
Done when: doctests cover each unit and the grid cases above; specs cover grid from Luau. Commit: [MINOR] Add relative lengths and length sums then [MINOR] Add grid layout
Notes: FontSize was added here, ahead of step 24, because em needs it; it defaults to "1em", which inherits. Lengths now reach Yoga during Surface:Layout rather than when set. A sum of a percentage and other units is resolved against the parent's content box from the previous pass, and a grid measures its items over three passes (widths with no width set, heights at their column's width, then stretched to their cells), so Layout repeats passes until nothing changes, at most 12. Track sizing is a simplified form of CSS's: content sizes come from those measurements, spanning items spread extra size evenly over their auto tracks, and auto tracks stretch when there are no fr tracks. Named areas, JustifyItems/JustifySelf, column-first flow and dense packing are not built. Display items no longer match Yoga's numbering, since Grid is 2.
Phase 7: UI rendering and text
[x] Step 23: UI renderer
Rendering/UiRenderer: one batched bgfx pass that draws signed-distance rounded rects with fill colour, per-cornerBorderRadiusand per-side solid borders, in tree order withZIndexand stacking contexts, clipped byOverflow = Hidden.- Paint properties:
Background(colours in#hex,rgb(),hsl()andColor3),BorderColor,BorderRadius,Opacity,ZIndex,Overflow. Gamma playdraws everySurfacewhoseTargetis the window (andOverlayover the scene); aSurfacesized to the window is laid out each frame.
Done when: a project under Tests/Manual/Ui shows nested views with radii, borders and clipping, its --screenshot matches what is expected, and doctests cover draw order and clipping rects. Commit: [MAJOR] Add the UI renderer
Notes: the draw list (Ui/DrawList) is built on the CPU and tested headless; Rendering/UiRenderer turns it into one bgfx view (3) of signed-distance rounded rects batched by clip rectangle. Surface.Target is None or Window; a window surface is drawn over the scene, so the plan's separate overlay target is the same thing until a program can turn the scene off. Simplified for now: Opacity is multiplied down the tree instead of fading a group, clipping is rectangular (not rounded), the border colour defaults to black instead of currentColor, a border is drawn over the background rather than blended with it, and units are window pixels. Under Xvfb with Mesa the whole frame, scene included, comes out sRGB-encoded (brighter than the colours given); that is the headless driver, not the UI renderer.
[x] Step 24: Text
- The
Textnode. Text with stb_truetype: font loading from files, a glyph atlas, measurement that Yoga uses forTextnodes, wrapping,TextAlign,LineHeight,TextOverflow = Ellipsis,Color,FontSize,FontFamilywith fallback, and a bundled default font. - Inherited text properties (
Color,FontFamily,FontSize,FontWeight,LineHeight,TextAlign) flow from ancestors.
Done when: doctests cover measurement and wrapping, the manual project shows wrapped and aligned text, and specs cover inheritance. Commit: [MAJOR] Add UI text
Notes: the default font is Noto Sans, regular and bold, under the SIL Open Font License (Assets/Fonts/OFL.txt), compiled into the engine by cmake/EmbedFile.cmake. Static faces, because stb_truetype cannot set a variable font's axes. WhiteSpace (Normal, NoWrap) was added, since an ellipsis needs a line that does not wrap. The inherited properties read "inherit" until set. Simplified: advances and kerning only (no shaping, ligatures, bidi or spans), fallback is per character in the family list, weights pick the nearest face with no synthesis, a text node's children are not laid out, and glyphs are rasterized per size into one 2048 by 2048 atlas that starts again empty when full.
[x] Step 25: Gradients, shadows, images and transforms
- Linear, radial and conic gradients and layered backgrounds;
BoxShadow;ImagewithObjectFitand nine-slice; 2DTransformandTransformOrigin(drawing and hit testing).
Commit: [MINOR] Add gradients, shadows, images and transforms
Notes: done in several commits, one per feature. Left for later: inset shadows, repeating gradients, colour hints and several background layers. A shadow is a rounded box whose edge the UI shader blurs across the nearest edge, so it is drawn under a translucent box too. Gradients are sampled into rows of a 256 by 256 texture each frame.
Phase 8: UI input, styling and reactivity
[x] Step 26: UI events and focus
- Pointer, wheel, keyboard and focus events with capture and bubble phases,
StopPropagationandPreventDefault, pointer capture, hover and active state,PointerEvents,TabIndexand keyboard navigation, andUi.Shortcut. Input a UI handles is not passed on to the program's own input handlers.
Commit: [MAJOR] Add UI events and focus
Notes: done in two commits, pointer events then Shortcut, which is an instance with Keys and Activated (Ui.Shortcut({ Keys = "Ctrl+S", Activated = save })) rather than a function. Left for later: the capture phase, double clicks, context menus, drag and drop, and gamepad focus.
[x] Step 27: Replace the old GUI
- Remove
ScreenGui,Frame,TextLabel,TextButton,ImageLabel,ImageButton,UIPadding,UIListLayout,StarterGui,PlayerGui,UDim/UDim2,Rendering/GuiOverlay,ImGuiRenderer, the ImGui shaders and the imgui dependency. PortExamples/OrbRushand the manual GUI tests to the new UI.
Commit: [MAJOR] Replace the Roblox-style GUI with the new UI
Done early, at the user's request, as part of phase 9: [MAJOR] Remove the Roblox-style GUI, UDim and Dear ImGui. Nothing needed porting, as Examples/OrbRush already drew its HUD with parts, and Tests/Manual/Gui was removed rather than ported, since Tests/Manual/Ui covers the new UI.
[x] Step 28: Style sheets
Ui.StyleSheetfrom Luau tables and.gssfiles: selectors (type, class, id, descendant, child, siblings, the state and structural pseudo-classes in ui.md, attributes), specificity, inheritance,Inherit/Initial/Unset,var()custom properties and media queries. Only nodes affected by a change are restyled..gssfiles reload when they change.
Commit: [MAJOR] Add UI style sheets
Notes: a StyleSheet instance holds its rules as text in Source, which places save; Ui.StyleSheet writes a Luau table as that text, sorting its selectors, since a table has no order. A property set on a node directly, by a script, a place or a tween, wins over every sheet for good, and the node keeps its own value to restore and to save. :disabled, :checked and :selected read boolean attributes, :focus-visible is :focus, and variables come from -- declarations and -- attributes. Styles apply at the start of a surface's layout, and a change to anything a selector reads restyles the whole surface rather than only the nodes it affects. .gss files do not reload when they change yet, except through --watch.
[x] Step 29: Reactive state and animation
Ui.State,Ui.Computed, binding states to properties, styles and children,Ui.ForEachwith keys,Transitionand@keyframes, andUi.Animated.
Commit: [MAJOR] Add reactive UI state and animations
Done over several commits: reactive state, Transition, tweens of UI strings, @keyframes with Animation, and style sheets that follow states.
[x] Step 30: Text input and the widget library
TextInput(selection, clipboard, undo, IME),ScrollView, and the Luau widget library (button, checkbox, radio, switch, slider, select, tabs, menu, tooltip, dialog, virtualised list, number input, colour picker, table, tree), each with specs.
Commit: [MAJOR] Add TextInput, ScrollView and the widget library (several commits, one per widget group)
Phase 9: Clean break from the Roblox API
One commit per system. Each updates the specs, the definitions, Examples/ and DOCS/. Done on 4 Dec 2026 at the user's request, ahead of steps 25, 26 and 28 to 30, on the clean-break branch; docs.md lists what went. Scripts now run anywhere in the game, and the legacy wait, spawn, delay, tick, elapsedTime, _G and shared globals went too.
- Remove
Players,Player, characters,LocalScript,RunContextand the server/client split; a program has one kind of script. - Remove
BrickColor, thegame/workspaceglobals and Roblox-onlyRunServiceanswers (IsStudio,IsEdit,IsServer,IsClient,IsRunMode). - Rename services and datatypes whose Roblox names no longer fit (decide the names first; see "Open questions").
- Remove
Tests/Packages(vendored Roblox packages) and their specs. - Replace project folders named after Roblox services with a layout for programs (
main.luauand modules), and update projects.md.
Work outside the plan
Built after step 14 at the user's request. The details and the choices made are in "Open questions" below; this is the index. Later steps must account for these, especially step 17 (what to save) and step 19 (what to stop when a game closes).
Instance:FindFirstChildWhichIsA,FindFirstAncestor,FindFirstAncestorOfClass,FindFirstAncestorWhichIsA,IsAncestorOf,WaitForChild, attributes, tags,CloneandArchivable.- Scripts:
Script.Enabled(a script owns the threads and connections it creates),Script.RunContext, modules that yield while loading,_Gandshared, and enum names or numbers wherever an enum is expected. - Value objects:
BoolValue,IntValue,NumberValue,StringValue,ObjectValue(held weakly),Vector3Value,CFrameValue,Color3Value. BindableEventandBindableFunction, with tables passed as copies (VariantgainedDictionary).- Services:
Debris,HttpService(JSONEncode,JSONDecode,GenerateGUID; no network),TweenServicewithTweenandTweenInfo,CollectionService,ServerStorage, andRunService'sIsServer,IsClient,IsStudio,IsRunning,IsEditandIsRunMode(these first answered as a running server everywhere; step 19 changed them, see its entry under "Open questions"). - Datatypes:
Random(PCG32, so a seed gives the same sequence every run but not Roblox's numbers),NumberRange,Ray,Rect,Region3,NumberSequence,ColorSequence,DateTimeandBrickColor. Examples/: example projects run withGamma play, starting withOrbRush, a small arena game that uses most of the engine. Its notes are inExamples/README.md.- Profiler:
Core/Profilertimes nested zones and per-frame counters on the main thread.Gamma play --profile <File>writes a report and--vsync offstops waiting for the display; the editor has a Profiler panel; scripts usedebug.profilebeginanddebug.profileend. Definitions now declare engine additions to Luau's own libraries astypeof(lib) & { ... }. - Renderer for large scenes: parts are drawn instanced, from growable GPU buffers, so there is no limit on visible parts.
Rendering/PartRegistrykeeps a flat copy of eachBasePart's bounds and draw data, updated throughBasePart's observer when a part changes, and the GPU keeps a copy of that between frames. Parts that change move to a dynamic region at the end of the copy, and back once they stop, so each frame uploads one range of the moving parts and a few scattered slots instead of every part. Opaque parts are drawn straight from the GPU's copy without CPU culling; only the partly transparent ones go throughRendering/SceneBatch, which culls and sorts them acrossCore/ThreadPool. bgfx renders on its own thread, except on macOS.Tests/Manual/StressandTests/Manual/RenderEdgeCasesexercise it. Workspace:Raycast(origin, direction, params)against parts, with no physics engine: aBallpart is a sphere as wide as its smallest side and every other part its box (aCylindertoo, for now). A ray that starts inside a part does not hit it.RaycastParams.new()returns a plain table ofFilterDescendantsInstances,FilterType(Enum.RaycastFilterType),IgnoreWater,RespectCanCollideandCollisionGroup, and the result is a table ofInstance,Position,NormalandDistance, sotypeofgivestablefor both. Jolt (Later) should replace the search.game:BindToCloseandScriptEngine::Close, whichGamma runcalls once nothing is left to run, stepping for up to 30 seconds while the callbacks yield.Gamma playcalls it too when its window closes; the editor's play copy does not yet.- Game UI instances, before the UI renderer:
GuiBase2d(AbsolutePositionandAbsoluteSize, worked out on each read fromSize,PositionandAnchorPointup to theScreenGui, which coversWorkspace.CurrentCamera.ViewportSize; they fire no change notifications),ScreenGui,GuiObject,Frame,TextLabel,ImageLabel,GuiButton(ActivatedandMouseButton1Click, fired byUserInputServicewhen a left click begins and ends on the topmost visible button in the local player'sPlayerGui; that click'sInputBeganandInputEndedpassgameProcessedEventas true, and other elements do not block clicks yet),TextButton,ImageButton, theStarterGuiservice andPlayerGui.Camera.ViewportSizeis 1280 by 720 until a window sets it. The local player has aPlayerGuifrom the start and gets a copy of eachStarterGuichild as it joins. Default sizes (100 by 100, or 200 by 50 for text and text buttons) and texts (Label,Button) are Gamma's own.UIPaddinginsets its parent's content, andUIListLayoutplaces its parent's visibleGuiObjects one after another (FillDirection,SortOrder,Padding; no alignment yet). No other layouts, fonts,TextBoundsor rich text yet. - Single player:
LocalScripts and theClientrun context run, andRunService:IsClient()is true (the step 15 answer).DataStoreServicesaves data locally, documented in datastores.md;Gamma playgives it a per-user save directory.Playershas oneLocalPlayer(Player, namedPlayer,UserId0) that exists from the start and joins, firingPlayerAdded, on the first step afterPlayersis in a game.Player.Characteris a weak reference that firesCharacterAddedandCharacterRemovingwhen set; nothing makes characters until there are parts and physics. - From the instance-system branch (see the 15 Nov merge note):
Modelwith pivots,Playerswith aLocalPlayer,UserInputService:GetKeysPressedandIsMouseButtonPressed,Workspace:GetPartBoundsInBox,GetPartBoundsInRadiusandGetPartsInPart,Model:GetBoundingBox,TweenService:SmoothDamp,HttpService:UrlEncode,Instance:IsPropertyModified, thetick,time,elapsedTimeanddelayglobals, andRunService'sPreAnimation,PreSimulationandPostSimulation. MeshPartwithMeshId,TextureIdand the read-onlyMeshSize, documented in projects.md.Core/Meshreads models with assimp (in place of fastgltf, which reads only glTF) into one rigid shape fitted to a unit box, and loads them in the background likeUi/Image.Rendering/MeshRendererdraws them instanced per model and texture, with mipmapped textures, cut-out alpha in the opaque pass and partly transparent meshes sorted after the transparent parts.PartRegistryleavesMeshParts out.cmake/FixedPortsoverlays vcpkg'skubazipport, an assimp dependency whose release archive changed hash after the baseline.- Ray tracing:
Core/Bvhbuilds bounding volume hierarchies, and every loaded model keeps one over its triangles.Workspace:Raycastuses it to hit aMeshPart's triangles rather than its box."Shadows": "RayTraced"inGamma.jsonturns on per-pixel sun shadows, documented in projects.md.Rendering/ShadowScenepacks a top-level hierarchy over the opaque parts and every model's triangles into float textures, andShaders/Shadows.shwalks them in the part and mesh pixel shaders. bgfx has no hardware ray tracing, so this uses only texture reads, which every backend has (the web build is untried). The walk keeps no stack, following miss links laid out depth first, because a stack in a local array lost its writes on every backend tried (Direct3D 11 and 12, Vulkan and OpenGL).TraceShadowRaywalks the same texels on the CPU, for tests. - Lighting, documented in lighting.md: the
Lightingservice (sun fromClockTimeandGeographicLatitude, ambient, environment scales, exposure, fog,GlobalShadows,ShadowSoftness),PointLight,SpotLightandSurfaceLight, theBloomEffect,SunRaysEffectandColorCorrectionEffectpost effects,Atmosphere, andBasePart.MaterialandReflectance. Names, defaults and enum values follow Roblox, like the rest of the current API, so the "Clean break" phase renames them with everything else. Their settings live in one plain struct per class (SettingsInstanceinInstances/Lighting.h), which the renderer reads each frame. - Post-processing:
Rendering/PostProcessdraws the scene into an RGBA16F frame buffer (BGRA8 where the GPU cannot draw into floats), multisampled 4x where the GPU allows, in place of the multisampled window. It then blooms (Call of Duty: Advanced Warfare's 13 tap downsample with a Karis average on the first level, and tent filter upsampling, one level per halving ofBloomEffect.Size), tone maps with Stephen Hill's ACES fit, appliesColorCorrectionEffects and dithers onto the window orDrawSceneToTexture's texture. Part colours and textures are decoded from sRGB in the shaders. The scene owns views 0 toSceneViewCount- 1 (32), and the overlays draw after them. - Physically based lighting:
Rendering/SceneLightingworks out the sun, moon and sky colours fromLighting(GetSkyLight), gathers the 32 lights whose reach comes nearest the camera (GatherLights), holds the material table and draws the sky.Shaders/Shading.shshades with Lambert and GGX, analytic sky lighting and reflections (Karis's environment fit), the lights, emission, the Atmosphere's haze and fog. A part's material and reflectance are packed into its colour's alpha beside its opacity (seePartInstance), which keeps instances at 64 bytes and leavesPartBatchboxes as plain Plastic.Shaders/PartFragment.scdraws procedural surface patterns per material in part space. There are no textures for materials and no image based lighting from the scene itself. - Cascaded shadow maps, the default
Shadowsmode (ShadowMap):Rendering/ShadowMapsfits 4 cascades around slices of the view out to 500 studs (FitCascades, bounding spheres snapped to whole texels so edges do not shimmer) in one 4 by 1 depth texture, laid out side by side because how a view rectangle lands vertically in a frame buffer differs between backends. Opaque parts,PartBatchboxes and meshes (with cut-out pixels discarded) are drawn into each cascade.Shaders/Shadows.shfilters 16 samples on a Vogel spiral, turned per pixel, with normal offset and depth bias, and fades out at the last cascade.Renderer::SetShadowstakes aShadowMode, andLighting.GlobalShadowsturns either mode off.MeshRenderernow gathers inPrepareand draws inSubmitShadowCastersandSubmit. Only the sun or moon casts shadows; local lights do not. - Ambient occlusion:
Rendering/AmbientOcclusiondraws the opaque scene's view space normals and depth into an RGBA16F target (with the scene's own vertex shaders, so the normal fragment shaders take every one of their varyings, as bgfx makes a program only when they match exactly), then works out occlusion at half resolution from 12 samples in the normal's hemisphere, turned per pixel, and blurs it in two depth-aware passes.Shading.shmultiplies only the ambient and sky reflection terms by it, in the opaque pass.MeshRenderer::SubmitShadowCastersbecameSubmitOpaque, shared by the cascades and this pass. - Part shapes:
PartRegistrymarks the slots ofParts whoseShapeis notBlock(GetShaped) and leaves them undrawn, andMeshRendererdraws them instanced with generated meshes for the ball, cylinder, wedge and corner wedge, so they share its sorting, shadow casting and ambient occlusion.Part:SetShapenow tells the part's observer. They have no surface pattern and no ray-traced shadow.
Open questions
Add an entry here when a step raises a decision. Give the step number, the question and, once answered, the answer. Entries marked "Ask the user" are not answered yet.
Phase 9: is
Instancerenamed (for example toObjectorNode), and areCFrame,Enumand the service names kept? Answer (user):InstanceandEnumstay; services become globals with new names (Scene,Run,Inputand the rest),CFramebecomesTransformandColor3becomesColor, in the Luau API. The C++ types keep their names.Phase 9: should script files keep the
.server.luau/.client.luausuffixes during the transition, or is the program layout changed in one step? Answer (user): in one step, to amain.luauand anassetsfolder; relative asset paths resolve against the project folder (Core/Assets).Step 21: does a UI tree live in the same object tree as everything else (under the
DataModel), or in a separate tree per surface? Answer for now: the same tree, so registry, saving and bindings are reused; aSurfacecan sit anywhere.Step 24: which font is bundled as the default? It must have a licence that allows shipping it inside programs (for example Inter or Noto Sans under the OFL). Answer: Noto Sans regular and bold, under the OFL; see step 24.
Step 2: which selene standard library to use? Answer: the built-in
luaustd. Therobloxstd would accept Roblox-only globals that Gamma does not have. Gamma globals now live in the custom stdgamma.yml; step 14b generates it.Step 6: how does a method return a table or a signal? Answered in step 10 below.
Step 6: member lookup walks the superclass chain on every access. gargantuan flattens each class's inherited members into one table once. Worth doing if lookup shows up in profiles.
From gargantuan, for later steps: property descriptors there carry a serialisable flag and a default value (useful for step 17's "not serialised" marker and for writing only changed properties), and read/write permission levels (useful for sandboxing). Class definitions there are generated from Luau data files, which could also feed step 14b.
Step 7: gargantuan's RunService uses Roblox's newer
PreSimulation,PostSimulationandPreRenderevents. The plan keepsHeartbeatandStepped; the newer names can be added beside them later.Step 7:
DataModelderives fromServiceProvider, as in Roblox (idea taken from gargantuan), sogame:IsA("ServiceProvider")holds. Destroying aDataModelis not handled:ClearAllChildrenon it throws at the first service. Step 19 defines closing a place.Step 8: vcpkg port or
FetchContentfor Luau? Answer: the vcpkg port (luau0.746 at the current baseline). It builds static libraries and exportsunofficial::luau::Luau.VM,Luau.Compiler,Luau.Analysis,Luau.Require,Luau.CodeGenand the rest throughfind_package(unofficial-luau CONFIG). Engine headers are underinclude/luau, including the VM's internal headers.Step 8:
printandwarnjoin their arguments with a space, as Roblox does, not with Luau's tab. EachScriptEngine::Runuses a new sandboxed thread, so a script's globals do not leak into the next one._Gandsharedare not built; decide how scripts share them when a package needs it.After step 8 (asked for by the user):
LogServicereplaces step 8's output callback.ScriptEnginetakes aDataModeland writesprint,warnand script errors to itsLogService, which firesMessageOut(Message, MessageType). Step 18's Output panel listens toMessageOut.MessageOutandEnum.MessageTypewere registered in step 12.GetLogHistoryis not built.Step 9: specs need a shared helper before step 13's
require. Answer (user): bring Luau's require library forward for files.ScriptEngine::RunFileloads a file with an@pathchunk name andrequire("./Path")resolvesx.luau,x.luaandx/init.luaurelative to the requiring file, with.luaurclookup for aliases. Module chunk names are relative to the working directory, which assumes it does not change while scripts run.Step 9: the helper (
Tests/Luau/Test.luau) fails fast: the first failedexpectstops the spec. Each spec runs from the source root so error paths stay short.Step 10: how do methods return a table or a signal (the step 6 question)? Answer (user): extend
Variantwithstd::shared_ptr<const Array>andstd::shared_ptr<const EventReference>. Both sit behind a pointer because they contain Variants, and compare by identity.GetChildren,GetDescendantsandGetPropertyChangedSignalare method descriptors, and event access by name builds the sameEventReferencethroughMakeEventReference.EventDescriptorgainedOnce.Dictionarywas added the same way later, for attributes.Step 10: a Luau handler runs synchronously inside
Fire, in a new thread, so it can yield and its error is logged without stopping the code that fired it.Signal:Waitresumes the waiting thread directly fromFire. Both are still immediate after step 11. Roblox now defaults to deferred signal behaviour, so revisit this if a package depends on handlers running later.Step 10: a Luau handler connected to an instance's signal holds a registry reference to its function, so a closure that captures that instance keeps it alive until the connection is disconnected or the instance is destroyed, as in Roblox.
Step 10: luau-lsp has no definitions for Gamma globals yet, so specs show type errors in the editor. Step 14b generates them.
Step 11: what counts as "connections that could wake a thread" for
Gamma run? Answer: only connections toRunService.SteppedandHeartbeat, because those fire on every step with no script running. Any other signal can only fire from a running thread, so when nothing is scheduled it can never fire. A thread waiting on such a signal does not keepGamma runalive, and a Heartbeat connection that is never disconnected keeps it running forever. Playing tweens step onHeartbeat, so they keep it running until they finish. If the file's main chunk is left waiting when nothing can resume it,Gamma runexits 1.Step 11: the scheduler steps from a C++-only
RunService.EngineSteppedsignal (first namedResumeWaitingThreads), fired betweenSteppedandHeartbeat, so its own connection does not count as pending work.Debrisuses it too. Deferred threads run when the outermostScriptContext::Resumereturns, which is after the thread that deferred them yields or finishes. There is no limit on re-deferring (Roblox stops at 80), so a thread that re-defers itself forever hangs the engine.Step 11: the legacy
waitbehaves astask.wait(no 1/30 s minimum, one return value) and the legacyspawn(f)astask.delay(0, f).Gamma runsteps with a fixed 1/60 s delta and exits non-zero if any error was logged, including errors in threads resumed after the file returned.Step 12: does
Vector3use Luau's nativevector? Answer: no. Datatypes are tagged userdata, becausetypeofon a native vector cannot return"Vector3". The shared userdata helpers are inScripting/Userdata.h. Revisit only if vector math shows up in profiles.Step 12:
CFrameand the other datatypes are plain C++ types inDataTypes/, independent of Luau, so the renderer and place files can use them. Vector negation keeps negative zero, as Roblox prints it. Enums are registered in the class registry.Step 13:
Name.server.luaugives aScriptwith theLegacyrun context, as Rojo does. AScriptstarts at the next point where the engine gets control back from Luau, not in the middle of the change that put it there.game,workspaceandscriptare compiled as mutable globals, because Luau otherwise resolves paths such asscript.Parent.Nameonce at load. The rules are in projects.md.Step 14: both packages (sleitnick/signal 2.0.3 and evaera/promise 4.0.0) passed without changes to Gamma beyond a selene exclusion for the vendored files. Nothing is left to fix.
Step 14a: the
asanpreset is Linux only. MSVC has AddressSanitizer but no leak detection, which is what this job is for. Luau and the other vcpkg ports are built without sanitizers; only Gamma's own code is instrumented.Step 14a: the lint job had been failing before any of its Luau checks ran, because two lines in
ClassRegistrywere not clang-formatted, so the hand-writtengamma.ymlhad 20 selene errors nobody saw. Step 14b formatted those lines and replaced the file.Step 14b: how precisely are members typed? Answer (user): names now, types later. Every member is
any, and methods take and return...any. Typing them needs a Luau type on each property, method and event descriptor and each datatype member; add that when the editor or a package needs it.Step 14b: the definitions use luau-lsp's
declare extern typesyntax (declare classno longer parses). The registry has no member types, so the datatype bindings each list the members their__indexresolves (GetDataTypeMembers), and a doctest indexes every listed member. A member added to a binding but not to its list shows up as an unknown member in the editor. Operators come from each userdata type's metatable. Every class has a[string]: Instanceindexer, since the engine looks up children by name and indexers are not inherited.scriptis added by hand, because it exists only on each script's own thread.Step 14b:
luau-lsp analyzestill reports errors inTests/Luauthat are not about unknown globals or members:requireof an instance (it needs a Rojo-style sourcemap) and mixed-type tables that strict mode rejects. CI does not runanalyze; add it once those are fixed.Step 15: should
Gamma playrunLocalScripts and answer as a client? Answer (user): yes, as Play Solo does:Gamma playrunsScripts andLocalScripts in one process, andIsClient()andIsServer()are both true there;Gamma runstays server only. The user added that Gamma is mainly for single player games, so there should not really be a separate server; a multiplayer service can come later if it is needed.RunService.RunsClient(C++ only) holds the answer and must be set before theScriptEngineis made.Step 15: where does a
LocalScriptrun withoutPlayers? Answer: where aRunContext.Clientscript runs, underWorkspaceorReplicatedStorage, since there is noPlayerGui,BackpackorPlayerScripts. Revisit when a player exists. ALocalScriptignores itsRunContext.Step 15: Luau specs feed input through
VirtualInputManager(SendKeyEvent,SendMouseButtonEvent,SendMouseMoveEvent,SendMouseWheelEvent, with Roblox's signatures), which calls the sameUserInputService::ProcessInputentry point as the window.KeyCodeitem 0 isNone, as in Roblox's current API (its legacy nameUnknownis not registered), and the deprecatedWorld0toWorld95keys are left out. Only keyboard and mouse input exist; touch, gamepads, text input andFocusevents are not sent.Step 16: the bgfx port at the baseline (1.129.8940-496) builds
shadercwith itstoolsfeature and exportsbgfx_compile_shaders, which compiles the shaders inSource/Rendering/Shadersinto headers for every backend at build time. bgfx renders on the main thread (renderFramebeforeinit) with vsync, soGamma playsteps once per displayed frame instead of at a fixed 60 Hz. Each frame firesRenderStepped, draws and then stepsRunService, in Roblox's order.Step 16:
BasePartandCameraderive fromInstance, not from Roblox'sPVInstance, soIsA("PVInstance")is false.Sizeis not clamped to Roblox's 0.001 to 2048 range, andPart.Shapedoes not exist: every part is drawn as a box. Transparent parts are drawn after opaque ones, back to front, without writing depth.Workspace.CurrentCamerais held weakly. Roblox makes a new camera when the current one is destroyed or set to nil; Gamma does not, and the renderer then draws from an identityCFramewith a 70 degree field of view.Step 16:
Workspacenow always has aCamerachild, which step 17 must handle when it loads a saved Workspace into a game that already made one.Step 17: the format is in places.md.
Source/Instances/Jsonbuilds and parses each value, and the place writer lays out the instance tree itself, one property per line, so diffs stay small; it stays inInstances/, since it works onVariant. simdjson was not added: no place is large enough yet to measure.PropertyDescriptor.Serializedmarks a property that place files leave out (Archivable,BasePart.Position). Float components are written in their shortest float form and read back through adouble; a test checks 100,000 random floats come back bit for bit.Step 17: loading is strict: an unknown class or property, or a value of the wrong shape, stops the load rather than being skipped, and a reference saved as
nullleaves the property at its default. Services are saved only when they hold something, and in class name order. Loading aWorkspacethat setsCurrentCameradestroys the camera the newWorkspacewas made with.LoadPlaceadds to the game it is given; step 19 loads into a newDataModel, which is the case it is built for.Step 17: the ctest entry for a place is a place file in
Tests/Places, run byGamma run, whoseScriptchecks what was loaded. A Luau spec cannot do it, because a place's scripts have no file torequirethe spec helper by path.Step 18: the vcpkg
imguiport (1.93.0) has the docking branch and the SDL3 backend, but no bgfx backend, since upstream ImGui has none. Answer (user): write a small one.Editor/ImGuiRendererdraws ImGui in bgfx view 2, after the scene's views 0 and 1, with shaders compiled by shaderc like the part shaders, and supports ImGui's texture requests (ImGuiBackendFlags_RendererHasTextures). ImGui adds glyphs to its font texture after creating it, and bgfx makes a texture created with its pixels immutable, so textures are created empty and filled withupdateTexture2D.Step 18: the viewport has its own fly camera rather than moving
Workspace.CurrentCamera, which Roblox Studio does, so looking around never changes the saved place. The layout is built in code every run (IniFilenameis null) instead of writing animgui.iniwherever the editor was started. Open asks for a typed path until a file dialog is added. Undo is not built; it is in "Later".Step 18:
MessageType::Infowas added for the editor's own messages, such as "Saved". Editor operations live inEditor/EditorOperationsand throw with a message, which the panels send to the Output panel.Step 19: closing a game is two steps, in this order: destroy its
ScriptEngine, which closes the Luau state and with it every script, thread, delayed callback and Luau handler, thenDataModel::Close, which destroys every instance under the services and disconnectsRunService's step handlers, so tweens,Debrisand the scheduler never step again even if something still holds the oldRunService. Then the tree is freed.PlaySessiondoes both at Stop. A test runs ten play and stop cycles of a script that leaves connections, a tween, aDebrisitem, delayed and looping threads and references running, and checks every instance of every copy is freed.Step 19:
RunService's answers now come from the game:IsClientis true inGamma playand in the editor's play copy;IsEditis true andIsRunningfalse only in the place being edited;IsStudiois true for both the edited place and its play copy;IsServeris always true andIsRunModealways false, since only Play Solo exists.Gamma runandGamma playanswer as before.Step 19: while playing, the viewport shows the copy from its
Workspace.CurrentCamera, the Explorer and Properties show and edit the copy (those edits are lost at Stop, as in Studio), and input reaches the copy'sUserInputServiceonly while the viewport has focus. Save during play saves the edited place, not the copy. Each frame of play firesRenderStepped, stepsRunServiceand then draws.Merge of the instance-system branch on 15 Nov (asked for by the user): that branch was built in parallel with steps 15 to 19 and had its own window, place files, parts, editor operations,
Selection,UserInputServiceand definitions generator. Play mode's versions of those were kept, and the rest was ported onto them, one commit per feature. Decisions that changed:- LocalScripts and the
Clientrun context run wherever aScriptruns, inGamma runas well asGamma play, andRunService:IsClient()is always true (that branch's single player answer below).RunService.RunsClientis gone. ALocalScriptstill also runs underReplicatedStorage, since there is noPlayerScripts. - Step 14b: members are typed now, with that branch's generator (the user's choice), replacing the one that typed every member as
any. A definition can add to one of Luau's own libraries, whichdebug.profilebeginanddebug.profileenduse. - Step 16:
BasePartandCameraderive fromPVInstance,Sizeis clamped to at least 0.001, andPart.Shapeexists, though the renderer draws every shape as a block.Workspaceis aModel, and its camera is still saved in place files. - The datatypes added there (
Ray,Rect,Region3, the sequences,DateTime,BrickColor) are written in play mode's place format, listed in places.md. - That branch's notes follow as it wrote them. Where they disagree with the notes above, the notes above and this entry win.
- Step 2: which selene standard library to use? Answer: the built-in
luaustd. Therobloxstd would accept Roblox-only globals that Gamma does not have. Gamma globals (Vector3,task,game) will need a custom std file once Luau specs use them. - Step 6:
GetChildren,GetDescendantsandGetPropertyChangedSignalhave no method descriptors yet, becauseVariantcannot hold an array or a signal. Step 10 needs to decide how a method returns a table or a signal to Luau (an array alternative inVariant, or a descriptor that pushes to the Luau stack directly). - Step 6: member lookup walks the superclass chain on every access. gargantuan flattens each class's inherited members into one table once. Worth doing if lookup shows up in profiles after step 10.
- From gargantuan, for later steps: property descriptors there carry a serialisable flag and a default value (useful for step 17's "not serialised" marker and for writing only changed properties), and read/write permission levels (useful for sandboxing). Class definitions there are generated from Luau data files, which could also feed the luau-lsp type definitions.
- Step 7: gargantuan's RunService uses Roblox's newer
PreSimulation,PostSimulationandPreRenderevents. The plan keepsHeartbeatandStepped; the newer names can be added beside them later. (PreAnimation,PreSimulationandPostSimulationwere added on 14 Nov;PreRenderwaits for step 16.) - Step 7:
DataModelderives fromServiceProvider, as in Roblox (idea taken from gargantuan), sogame:IsA("ServiceProvider")holds. Destroying aDataModelis not handled:ClearAllChildrenon it throws at the first service. Decide what closing a place does when play mode (step 19) needs it. - Step 8: vcpkg port or
FetchContentfor Luau? Answer: the vcpkg port (luau0.746 at the current baseline). It builds static libraries and exportsunofficial::luau::Luau.VM,Luau.Compiler,Luau.Analysis,Luau.Require,Luau.CodeGenand the rest throughfind_package(unofficial-luau CONFIG). Engine headers are underinclude/luau, including the VM's internal headers. - Step 8:
printandwarnjoin their arguments with a space, as Roblox does, not with Luau's tab. EachScriptEngine::Runuses a new sandboxed thread, so a script's globals do not leak into the next one; step 13 may need to revisit this when scripts share state through_Gorshared. - After step 8 (asked for by the user):
LogServicereplaces step 8's output callback.ScriptEnginetakes aDataModeland writesprint,warnand script errors to itsLogService, which firesMessageOut(Message, MessageType). Step 18's Output panel listens toMessageOut.MessageOutis not in the registry yet, becauseVarianthas noEnum.MessageType; register it in step 12.GetLogHistoryis not built. - Step 9: specs need a shared helper before step 13's
require. Answer (user): bring Luau's require library forward for files.ScriptEngine::RunFileloads a file with an@pathchunk name andrequire("./Path")resolvesx.luau,x.luaandx/init.luaurelative to the requiring file, with.luaurclookup for aliases. Step 13 still addsrequire(ModuleScript), cyclic require errors and the project folder mapping. Module chunk names are relative to the working directory, which assumes it does not change while scripts run. - Step 9: the helper (
Tests/Luau/Test.luau) fails fast: the first failedexpectstops the spec. Each spec runs from the source root so error paths stay short. - Step 10: how do methods return a table or a signal (the step 6 question)? Answer (user): extend
Variantwithstd::shared_ptr<const Array>andstd::shared_ptr<const EventReference>. Both sit behind a pointer because they contain Variants, and compare by identity.GetChildren,GetDescendantsandGetPropertyChangedSignalare now method descriptors, and event access by name builds the sameEventReferencethroughMakeEventReference.EventDescriptorgainedOnce. - Step 10: a Luau handler runs synchronously inside
Fire, in a new thread, so it can yield and its error is logged without stopping the code that fired it.Signal:Waitresumes the waiting thread directly fromFire. Step 11 decides whether either should be deferred to the scheduler. A script that yields at the top level now counts as success; nothing resumes it except a signal it waits on. - Step 10: a Luau handler connected to an instance's signal holds a registry reference to its function, so a closure that captures that instance keeps it alive until the connection is disconnected or the instance is destroyed, as in Roblox.
- Step 10: selene uses a custom std (
gamma.yml, based onluau) declaringgame,workspaceandInstance.new. Instances areanythere. luau-lsp has no definitions for Gamma globals yet, so specs using them show type errors in the editor; a definitions file could be generated from the registry. - Step 11: what counts as "connections that could wake a thread" for
Gamma run? Answer: only connections toRunService.SteppedandHeartbeat, because those fire on every step with no script running. Any other signal can only fire from a running thread, so when nothing is scheduled it can never fire. A thread waiting on such a signal does not keepGamma runalive, and a Heartbeat connection that is never disconnected keeps it running forever. - Step 11: the scheduler steps from a C++-only
RunService.ResumeWaitingThreadssignal, fired betweenSteppedandHeartbeat, so its own connection does not count as pending work. Deferred threads run when the outermostScriptContext::Resumereturns, which is after the thread that deferred them yields or finishes. There is no limit on re-deferring (Roblox stops at 80), so a thread that re-defers itself forever hangs the engine. - Step 11: the legacy
waitbehaves astask.wait(no 1/30 s minimum, one return value) and the legacyspawn(f)astask.delay(0, f).Gamma runsteps with a fixed 1/60 s delta and exits non-zero if any error was logged, including errors in threads resumed after the file returned. - Step 12: should
Vector3use Luau's nativevectortype? Answer: no, it is a tagged userdata like the other datatypes.typeofon a native vector always returns"vector"(luaT_objtypenamestrreads__typeonly from userdata metatables), and packages checktypeof(x) == "Vector3"; changing that means patching the VM. The cost: aVector3is a heap allocation, and two equal vectors are different table keys, which differs from Roblox. Components are single precision, as in Roblox. Revisit if vector maths shows up in profiles. - Step 12: the build container for this run had no vcpkg (its bootstrap was blocked), so Luau 0.746 (with the vcpkg port's patch), doctest 2.5.3 and GLM 1.0.3 were built from source at the vcpkg baseline's versions into a local prefix. StyLua and Selene were not available, and the local clang-format is 18 rather than CI's 23.1.5, so CI's lint job is the first real check of those commits.
- Step 12: Roblox's docs fix some details the specs check:
Color3:ToHSVgives hue 1, not 0, for pure red;Color3:ToHexis lowercase;white:Lerp(black, 0.85)prints0.15, soLerpruns in double precision before rounding to float; negating keeps-0(CFrame.new().LookVectorprints-0, -0, -1). Unknowable from the docs and chosen here:UDimoffsets truncate toward zero;CFrame:ToAxisAngleof the identity gives the X axis;CFrame:FuzzyEqcompares each rotation matrix element, not an angle;CFrame.lookAtfalls back to the X axis as up when looking alongup.Color3:GetLuminancewas added because the docs list it. - Step 12: enums live in the class registry (
ClassRegistry::AddEnum). The owner of an enum registers it (LogServiceaddsMessageType); the datatype enums (Axis,NormalId,RotationOrder) are registered inClassRegistry.cpp. A C++ enum converts to anEnumItemthrough anEnumTraits<T>specialisation naming its registered enum, mapped by value, so the C++ values must match Roblox's (MessageTypeis nowOutput = 0, Warning = 2, Error = 3).Enum, eachEnum.Xand eachEnumItemis one cached userdata, so they work as table keys.LogService.MessageOutis now registered. Not built: Roblox's coercion of strings and numbers to enum properties, which step 15/16 may need once instances have enum properties. - Step 13 (approved by the user): how should
require("./Path")resolve for instance scripts? Answer for now: by file. A script loaded from a project keeps its file inLuaSourceContainer::SourcePath(C++ only, not reflected) and uses it as its chunk name, so path and.luaurcalias requires go through the existing file navigator. When that navigator loads a file that aModuleScriptin the game came from, it requires theModuleScriptinstead, so both kinds of require share one cached result. A script with no file (made at runtime) is named by its full name (=ServerScriptService.Main), as in Roblox, and can only require instances. The alternative is a second navigator that walks the instance tree, as Roblox's own require-by-string does; it would let runtime scripts require by path, but.luaurcaliases have no place in the instance tree. Switch if packages need it. - Step 13: a
Scriptruns when it is underWorkspaceorServerScriptService(exact classScript), once per instance, deferred to the next resumption point;TaskScheduler::Stepnow starts by resuming deferred threads so scripts added from C++ start on the next step.LocalScriptderives fromScript, as in current Roblox, and never runs: there is no client yet (step 15 may wantGamma playto run them). Not built:RunContext. (Enabledand stopping a script's threads were added later, outside the plan; see the entry below.) - Step 13: module errors use Roblox's wording (
Requested module was required recursively,Module code did not return exactly one value,Requested module experienced an error while loading, with the module's own error appended), andrequireof a non-module isAttempted to call require with invalid argument(s).. A failed module is not cached, so requiring it again retries. A module may not yield (Roblox allows it); file modules already had this limit. - Step 13: the project layout (documented in
DOCS/projects.md) maps top-level folders to services by name, so a project needs no project file. Onlyinit.luaumakes a folder a module;init.server.luauandinit.client.luauare not supported. - Step 14: vendored sleitnick/signal 2.0.3 and evaera/promise 4.0.0 (sources and commits in
Tests/Packages/README.md), excluded from StyLua (.styluaignore) and Selene (excludeinselene.toml). Both passed unmodified with no change to Gamma. Not fixed yet: Promise measuresPromise.delaywithos.clock, which is wall time, while the scheduler counts fixed 1/60 s steps from the start of each frame, so a delay started mid-frame can report up to about a frame less than asked. The spec allows a frame of difference. Driving the scheduler clock from real frame time inGamma play(step 15) would remove most of it, at the cost of the deterministic timing the Task specs rely on, so keep the fixed step forGamma run. - Step 15 (blocked, needs the user): the vcpkg baseline pins SDL 3.4.20. Building it from source here (
release-3.4.20, X11 only, static) was refused by the session's auto-mode permission check, and so was the vcpkg bootstrap earlier, so SDL3 cannot be built or tested in this container. Xvfb is installed, so the window and input code could be exercised headlessly once SDL builds. Planned choices, pending:sdl3invcpkg.jsonwithdefault-features: falseand thex11andwaylandfeatures on Linux (droppingibus, which pulls in dbus), plus an apt step in the Linux CI job for the X11 and Wayland headers. To unblock: allow building SDL from source (or the vcpkg bootstrap) in this environment, or run Step 15 locally. - Outside the plan, while Step 15 was blocked (the user said to continue): three scripting commits.
[FIX] Read script and game members at run time: in a sandboxed environmentluau_loadresolves global paths such asscript.Parent.Nameonce, at load time, so scripts read stale values. Every chunk is now compiled throughCompileSource(Source/Scripting/Compile.cpp) withgame,workspaceandscriptas mutable globals.[FIX] Make task.wait in a newly started script wait a step:TaskScheduler::Stepresumed deferred threads before choosing the due timed threads, so a Script started by a step that calledtask.wait()resumed again in the same step. Due threads are now chosen first.[MINOR] Add Script.Enabled and stop scripts when disabled or destroyed: each run of a Script owns the threads it creates (Luau thread data, inherited through theuserthreadcallback,taskand event handlers) and the connections it makes. Disabling or destroying the script disconnects them and drops its scheduled threads; re-enabling runs it again from the start. Moving a running script out of its container does not stop it, as in Roblox. Limits: the thread that stops its own script keeps running until it yields, and threads a ModuleScript starts while loading belong to no script. Documented inDOCS/projects.md.
- Found while checking the above under AddressSanitizer, not fixed (unrelated to the change): the C++ test
Reparenting fires events in order(Tests/Instance.cpp) leaks, because its handlers capture the instances whose signals hold them. Every other test is clean under ASan and UBSan. - More Instance API, outside the plan (Step 15 still blocked). Behaviour follows the Instance page in Roblox's creator-docs; error wording the docs do not give is Gamma's own.
[MINOR] Add ancestor and WhichIsA lookups to Instance:FindFirstChildWhichIsA(withrecursive),FindFirstAncestor,FindFirstAncestorOfClass,FindFirstAncestorWhichIsA,IsAncestorOf.[MINOR] Add Instance:WaitForChild: yields until a child with the name is added; with a time out it resumes with nil; without one it warnsInfinite yield possible on '<FullName>:WaitForChild("<Name>")'after 5 seconds. It is bound inInstanceBindings.cpprather than the registry, because registry methods cannot yield.TaskScheduler::DelayCallbackwas added for the time out and the warning. Not handled: a child renamed to the name after it was added does not end the wait.[MINOR] Add instance attributes:SetAttribute,GetAttribute,GetAttributes,GetAttributeChangedSignal,AttributeChanged. Names: 1 to 100 of letters, digits,_ . - /, not starting withRBX. Values: boolean, number, string, Vector3, Vector2, Color3, UDim, UDim2, CFrame, EnumItem. Setting the same value again fires nothing.Variantgained aDictionarytype forGetAttributes.[MINOR] Add Instance:Clone and Archivable: copies writable registry properties (all butParent), attributes and archivable descendants. Not copied:LuaSourceContainer::SourcePath(C++ only), so a cloned file-backed script can no longer require by relative path. Instance references inside the cloned tree are not remapped yet; no property holds one besidesParent.
- The user approved every decision recorded above, including the Step 13 require-by-file choice.
- Run at 07:21 Oslo, 13 Nov (SDL build still refused, so scripting work continued):
[MINOR] Add value objects:BoolValue,IntValue,NumberValue,StringValue,ObjectValue,Vector3Value,CFrameValue,Color3ValueunderValueBase, all one C++ class (Source/Instances/Values.cpp) told apart by class name.Changed(and the deprecatedchanged) passes the new value, as Roblox documents;GetPropertyChangedSignal("Value")still works. Chosen where the docs say nothing:IntValuedrops a fraction toward zero, likeUDim.Offset; a type error readsUnable to assign property Value. <type> expected, got <type>.StringValuerejects more than 200,000 characters withString too long, as documented.[FIX] Point cloned references at the copied instances:Clonerewrites an instance-valued property that points inside the cloned tree (such asObjectValue.Value) to the copy, as the ObjectValue docs describe.[FIX] Hold ObjectValue references weakly: anObjectValuepointing at its own ancestor made a reference cycle that AddressSanitizer reported as a leak. It now holds its instance weakly, so an instance kept alive only by anObjectValueis freed and the value reads as nil. This differs from Roblox, where the reference keeps the instance alive; change it back if that matters more than the cycle. (The clone-references commit was pushed before the leak was caught; this commit fixes it.)[MINOR] Add the Debris service:AddItem(item, lifetime = 10), counted in RunService steps, not tied to the script that called it, capped at 1000 items with the oldest destroyed to make room, as documented. A service passed to it is rejected at once (<Name> cannot be destroyed).RunService.ResumeWaitingThreadsis renamedEngineStepped, the internal per-step signal both the scheduler and Debris use; it is not counted as pending work, so pending debris does not keepGamma runalive.
- Session on 13 Nov, "fix the open questions and add features" (all pushed; 102 tests pass, and the whole suite is clean under AddressSanitizer and UBSan):
[FIX] Stop the reparenting test leaking its instances: the one ASan failure left; its handlers captured their own instances.[MINOR] Let modules yield while they load: closes the Step 13 note "a module may not yield". Everyrequireof a module that yields waits for it (a continuation onrequire) and gets the same result or error; a cycle through yielded modules is stillRequested module was required recursively. A path require cannot wait, so a module it loads must still not yield.ScriptContext::FinishHandlerslets C++ take over the end of a thread.[FIX] Make WaitForChild notice renames and end its timers: closes the rename gap; it also cancels the 5 second warning timer when the wait ends, which had keptGamma runalive for 5 seconds after any WaitForChild that yielded.[FIX] Fail Gamma run when the file is left waiting: found while doing the above. A spec whose main chunk stayed suspended forever exited 0 without running its remaining tests. Now it fails with<file> did not finish: it is still waiting, and nothing is left that could resume it. Projects are not checked, since their scripts may wait for events on purpose.[FIX] Keep a cloned script's source file: closes the Clone gap.Instance::CopyUnreflectedStatelets a class copy state that is not a property;LuaSourceContainercopiesSourcePath.[MINOR] Add BindableEvent and pass tables as copies: Luau tables now read intoVariant(ReadVariant): keys exactly 1 to n make anArray, anything else aDictionarywith keys turned into strings (luaL_tolstring, so an Instance key becomes its name), metatables dropped, cycles and functions rejected. This is what Roblox documents for bindables. A mixed table becomes a dictionary (Roblox says elements may be dropped; it does not say which).[MINOR] Add BindableFunction:InvokeandOnInvokeare bound inInstanceBindings.cppbecause they hold Luau functions and yield. Invoke waits for a callback that yields or is not set yet; an error in the callback is raised by Invoke. ReadingOnInvokeerrors, as in Roblox. If the script that set the callback has stopped, Invoke fails withthe script that set OnInvoke has stopped(Gamma's choice).[MINOR] Add HttpService JSON and GUIDs:JSONEncode,JSONDecode,GenerateGUID(Source/Instances/Json.cpp, hand-written; step 17 plans simdjson for place files and could reuse it for decoding). Choices the docs leave open: object keys are written sorted; values JSON cannot hold (Vector3, Instance, ...) becomenull; a mixed table is an object; GUIDs are lowercase as in the docs' examples; a JSONnullmember is dropped from the decoded dictionary. No network calls (GetAsyncetc.);UrlEncodewas added on 14 Nov.[MINOR] Add TweenService, Tween and TweenInfo: theEasingStyle,EasingDirectionandPlaybackStateenums with Roblox's values, theTweenInfodatatype,TweenService:CreateandGetValue, andTween(Play,Pause,Cancel,Completed,PlaybackState,Instance,TweenInfo). Easing uses Robert Penner's curves, with Out and InOut built from In; Roblox's exact Elastic and Back constants are not documented, so those may differ slightly. Not documented, chosen:RepeatCountandReversesplay as legs ofTimeseconds with no delay between repeats; booleans and EnumItems switch at the end; a tweened UDim offset is rounded.TweenService:SmoothDampis not built. Playing tweens step onHeartbeat, connected only while one plays, so they keepGamma rungoing and Completed:Wait works in specs.
- Still open: Promise.delay vs fixed steps (by design for
Gamma run); StyLua/Selene and clang-format 23 not run here; CI never run on this branch; Step 15 blocked on building SDL3. - Run at 12:21 Oslo, 13 Nov (SDL build still refused):
[MINOR] Add tags and CollectionService:Instance:AddTag/RemoveTag/HasTag/GetTags(Clone copies tags) andCollectionService(AddTag,RemoveTag,HasTag,GetTags,GetTagged,GetAllTags,GetInstanceAddedSignal,GetInstanceRemovedSignal,TagAdded,TagRemoved). An instance counts once it is in the game; a move within the game fires nothing. Differences: Roblox defersTagRemoved; Gamma fires it at once.GetAllTagsis sorted. Collections (CreateCollection) are not built.[MINOR] Add the ServerStorage service: scripts in it do not run; projects can use it as a top-level folder.[MINOR] Add Script.RunContext:Enum.RunContextandBaseScript.RunContext. Legacy runs under Workspace or ServerScriptService, Server also under ReplicatedStorage (per Roblox's "Script locations" page), Client and Plugin never run. Project files keep Rojo's mapping (.server.luauis a Legacy Script); Roblox's Script Sync would make it Server, which would start.server.luaufiles in ReplicatedStorage. Change it if Script Sync compatibility matters more than Rojo's.
- "Add more", 13 Nov:
[MINOR] Add the Random datatype:Random.new(seed?),NextInteger,NextNumber,NextUnitVector,Shuffle,Clone, following the documented rules (seed floored, inclusive ranges, bounds truncated and swapped, Fisher-Yates with raw access, holes rejected). The generator is PCG32: Roblox does not document its own, so seeded sequences differ from Roblox's.[MINOR] Add the NumberRange datatype:NumberRange.new(value)/(min, max), 32-bitMinandMax; a Variant type, so attributes take it. The error for min > max and thetostringform ("-1 2.5") are Gamma's own.[MINOR] Add the RunService environment queries:IsServertrue,IsClient,IsStudio,IsEdit,IsRunModefalse,IsRunningtrue.
- Next ideas: none recorded.
- Plan revision on 13 Nov (asked for by the user): steps 12 to 14 ticked; the "Checks for every step" list, rules 3, 7 and 8, and the "Work outside the plan" index added; steps 14a (sanitizer preset and CI job) and 14b (Luau definitions generated from the registry) inserted before phase 3, lettered so existing step numbers stay valid; steps 15 to 19 given checks that need no person watching. Step 18's Output panel listens to
LogService.MessageOut, which replaced the step 8 callback. Step 17 reusesSource/Instances/Jsonand adds simdjson only if loading is measurably slow. - Step 10, still open: Luau handlers and
Signal:Waitresume immediately insideFire. Roblox now defaults to deferred signal behaviour (and defersTagRemoved), so revisit this if a package depends on handlers running later. - Step 15 (Ask the user, as well as the SDL block above): Gamma has no client, so
LocalScripts never run andRunService:IsClient()is false, butUserInputServiceis a client service in Roblox. ShouldGamma playrunLocalScripts and answer as client and server at once, as Roblox's Play Solo does, or should input be read fromScripts until networking exists? Answer (the user): Gamma is for single player games first, and multiplayer comes later as an opt-inMultiplayerServicerather than a server/client split. So the game is its own client and server, inGamma runas well asGamma play:LocalScripts and theClientrun context run where aScriptwould ([MAJOR] Run LocalScripts in single player games),IsServerandIsClientare both true, andUserInputServiceis read from any script. The Roblox service names stay for compatibility. - Step 14a: the
asanpreset adds-fsanitize=address,undefined -fno-sanitize-recover=all, so undefined behaviour fails a test instead of only printing. vcpkg ports are built without sanitizers, which is enough to catch Gamma's own leaks and overflows. CI runs it as a third matrix entry of the build job (Linux only), sharing the Linux vcpkg cache. Verified here: all 105 tests pass under it and a deliberately leakedFolderfails with a LeakSanitizer report. Not verified yet: the CI job itself, since CI only runs on pull requests and pushes tomainand no pull request is open for this branch. - Run at 17:36 Oslo, 13 Nov: StyLua 2.6.0, Selene 0.32.0 and luau-lsp 1.70.1 (the
rokit.tomlversions) were downloaded from their GitHub releases, andclang-format23.1.5 from PyPI, so the lint job could be run here for the first time. It failed, and three commits fix it:[CHORE] Format Luau specs with StyLua,[CHORE] Fix Selene warnings in specs(an intended mixed table is allowed inline, a shadowedRunServiceremoved) and[FIX] Let Selene accept datatype constants and warn(Vector3.zeroand the other constants are now aDatatypestruct that takes any member, andwarnis declared), plus[CHORE] Format with clang-format 23for two pointer-to-member spacings that version 18 wrote differently. - Step 15: SDL 3.4.20 now builds from source here (static, X11 only, with the optional X11 extensions off because their headers are not installed) into the local prefix. The block recorded above is lifted for this container;
Xvfbis available for window tests. - Step 14b (answered): the registry has no types. Properties, methods and events carry only functions, the datatype bindings are hand-written Luau C functions, and some members (
WaitForChild,BindableFunction.Invoke,OnInvoke) are bound outside the registry, so a generated definitions file would type almost everything asany. Options: (a) add a Luau type string to each descriptor and each datatype binding, so the C++ stays the one source; (b) describe the API in Luau data files and generate both the definitions and registration checks from them, as gargantuan does; (c) drop the generator and keep hand-written definitions with a CI check that every registered member appears in them. (a) is the smallest change that keeps one source; (c) is the cheapest. The selene half of the step no longer blocks CI, sincegamma.ymlwas fixed by hand. - More scripting work while 14b and 15 wait for the user:
[MINOR] Accept enum names and numbers where an enum is expected: closes the step 12 note on coercion.CoerceEnumItemtakes an item of the right enum, an item's name or its number (an integer only), soscript.RunContext = "Server",TweenInfo.new(1, "Quad"),TweenService:GetValue(0.5, "Quad", "In")andVector3.FromNormalId("Top")work. Property setters useGetEnumPropertyValue<T>, registry methodsGetEnumArgument<T>and Luau bindingsCheckEnumValue. The error wording for an unknown name is Gamma's own.[MINOR] Add _G and shared: two writable tables that every script in a game shares, as in Roblox, set afterluaL_sandboxso they stay writable._Gis no longer the read-only global table, so_G.printis nil. Both are compiled as mutable globals, or_G.xwould be read once at load. Selene'sglobal_usagelint still warns on_G, which is what Roblox style guides want too.[MINOR] Add the Ray datatype:Ray.new(origin, direction),Origin,Direction,Unit,ClosestPointandDistance, as documented.ClosestPointdoes not normalise the direction, since the docs say the ray must be a unit ray, and clamps to the origin behind it. ARayis aVariant, so bindables pass it, but it is not an attribute type, as in Roblox. Thetostringform ({1, 2, 3}, {0, 0, 10}) is from memory of Roblox's output, not from the docs.[MINOR] Add the Rect datatype:Rect.new(),Rect.new(min, max)andRect.new(minX, minY, maxX, maxY), sorting the corners component-wise as documented, withMin,Max,WidthandHeight. ARectis an attribute type, as in Roblox (from memory; the vendored docs copy has no attribute type list). Thetostringform (10, 10, 80, 90) is Gamma's own.
- Run at 22:21 Oslo, 13 Nov (14b and 15 still wait for the user's answers):
[MINOR] Add the NumberSequence datatype:NumberSequenceKeypoint.new(time, value, envelope?)andNumberSequence.new(n),(n0, n1)or(keypoints), withKeypointsreturning a new array each read. Keypoint arrays are checked as documented (at least two, from time 0 to 1, non-descending). Both areVarianttypes and aNumberSequenceis an attribute type. Gamma's own, as the docs do not say: a negative envelope is an error, the error wording, and no limit on the number of keypoints (Roblox may cap it). Thetostringform (0 1 0 1 2 0, time, value and envelope per keypoint) is from memory of Roblox's output.[MINOR] Add the ColorSequence datatype:ColorSequenceKeypoint.new(time, color)andColorSequence.new(c),(c0, c1)or(keypoints), sharing the keypoint checks withNumberSequence(both now live inDataTypes/Sequences.handScripting/SequenceBindings.cpp). A keypoint color outside 0 to 1 is an error, as the docs require. AColorSequenceis an attribute type. Thetostringform (0 1 0 0 0 1 0 0 1 0, with a 0 envelope per keypoint) is from memory of Roblox's output.[MINOR] Add the DateTime datatype:now,fromUnixTimestamp(floored to the second),fromUnixTimestampMillis,fromUniversalTime,fromLocalTime,fromIsoDate,UnixTimestamp,UnixTimestampMillis,ToUniversalTime,ToLocalTimeandToIsoDate, following the documented rules (years 1400 to 9999, invalid dates raise, out-of-range time units roll over, fractions floored,fromIsoDategives nil on bad input). Local time comes from the C library's time zone (localtime_r/localtime_s). Gamma's own: comparisons with<and<=,fromIsoDatealso takes fractional seconds and a+HH:MMoffset,ToIsoDateadds.mmmonly when the milliseconds are not zero,tostringgives the milliseconds, and the error wording.FormatUniversalTimeandFormatLocalTimewere added later, for en-us only. ADateTimeis aVariantbut not an attribute type.
- Verification of the single player session's work (from
[MAJOR] Run LocalScripts in single player gameson): this container could not build Luau or doctest (the auto-mode check refused building downloaded code, and the vcpkg bootstrap), soctestwas never run. The C++ tests that do not touch scripting ran under AddressSanitizer and UBSan, with leak detection, through a small stand-in for doctest's macros; every C++ file was syntax-checked against Luau's headers and formatted with clang-format 23.1.5. The Luau specs, theTests/Placesplace and the C++ tests inScriptEngine.cpp,Scripts.cppand the other scripting files were not run. StyLua and Selene were not run either. Run CI before merging. - Run at 02:21 Oslo, 14 Nov, in the container that can build Luau: the single player session's 13 commits were fast-forwarded onto the work here (no conflicts) and checked. The
asanbuild is clean, all 154 tests pass under AddressSanitizer and UBSan (C++ tests, every Luau spec, the project folders andTests/Places/Basic.json), Selene and clang-format 23.1.5 are clean, and StyLua needed one change ([CHORE] Format the UserInputService spec with StyLua). CI has still not run on this branch. - Step 15, the SDL half (
[MAJOR] Add window and input), done before step 14b for the same reason step 17 was: the step 15 question is answered and SDL builds here, while 14b still waits for the user.sdl3is invcpkg.jsonwithdefault-features: falseand only thex11feature on Linux (no Wayland, ibus or dbus; Wayland desktops run it through XWayland), and the Linux CI job installs the X11 headers the port needs.Rendering/SdlInputtranslates SDL events toInputEvents (ASCII keys by value, the rest by table; SDL's right and middle buttons swap to Roblox's MouseButton2 and 3; a flipped wheel is negated) and has doctests that need no display.Rendering/Windowowns the SDL window and its video subsystem, soGamma runnever starts it.Gamma playloads likeGamma run, setsCurrentCamera.ViewportSizefrom the window, steps at a fixed 1/60 s in real time while the window is open, and closes the game (BindToClose) when it is closed. Errors do not stop it; with no display it prints SDL's reason and exits 1. The window is not drawn into until step 16.Tests/Manual/Keyswas checked under Xvfb with a small XTest program that pressed W and clicked: it printed the viewport, the press and release, the click at window coordinates, andclosingon SIGTERM. Not built: text input, gamepads, a frame-time delta (steps stay fixed at 1/60 s, so the Promise.delay note under step 14 still applies), and a save directory for data stores inGamma play. CI has not run this yet. - Run at 07:21 Oslo, 14 Nov:
- Step 16 is blocked in this container: bgfx 1.129.8940-496 (the vcpkg baseline's version, the same bgfx.cmake release with its SHA-512 checked) configures only with the OpenGL development files, which are not installed, and installing
libgl-devwas refused by the session's permission check. To unblock: allow installinglibgl-devhere (CI's Linux job will need it too, with the X11 headers), or build step 16 on a machine with them. The vcpkg port providesshadercthrough itstoolsfeature as a host dependency, as the step assumed. [MINOR] Give Gamma play a save directory for data stores: closes the step 15 note.Gamma playsetsDataStoreService's save directory toSDL_GetPrefPath("Gamma", <game name>), the game name being the project folder's or place file's name. Checked under Xvfb: two plays of a project that callsIncrementAsyncprinted 1 then 2, and the store's JSON file was in the data folder. Two games whose folders share a name share their saves; a game setting (a name in the place or project) would fix that later.Gamma runstill keeps stores in memory.[MINOR] Add TweenService:SmoothDamp: for numbers,Vector2andVector3, returning the new value and velocity. Roblox does not document the algorithm, so it is the critically damped spring from Game Programming Gems 4 (8.1), as in Unity, including clamping tomaxSpeed * smoothTimeand stopping at the target instead of overshooting; results may differ slightly from Roblox.dtdefaults to 1/60 s, the step Gamma always takes. Not built:CFrame, whose velocity type the docs do not give.MethodDescriptorgainedReturnsTuple, so a registry method can return several values (theCallreturns anArray).
- Step 16 is blocked in this container: bgfx 1.129.8940-496 (the vcpkg baseline's version, the same bgfx.cmake release with its SHA-512 checked) configures only with the OpenGL development files, which are not installed, and installing
- Run at 12:21 Oslo, 14 Nov (14b still waits for the user; step 16 still blocked on the OpenGL headers):
[MINOR] Add DateTime:FormatUniversalTime and FormatLocalTime: every documented composite and elemental token, with the documented en-us expansions, matching the longest token first. Gamma's own, as the docs do not say: every locale formats as en-us (other locales need locale data), text in[brackets]is copied as it is (as in moment.js, whose tokens these are), and any other character is kept.[MINOR] Add the BrickColor datatype: the 208 colors of the table on Roblox's BrickColor page, generated intoDataTypes/BrickColor.cpp(name, number, palette index, 0 to 255 RGB; the 128 palette indices are complete).BrickColor.newby number, name, r, g, b orColor3(closest by the documented sum of absolute channel differences, the first in the table on a tie),palette(an error outside 0 to 127),random(from the palette), the eight documented shortcuts, andNumber,Name,Color,r,g,b. An unknown name or number gives "Medium stone grey", as documented. Gamma's own: four names appear twice in the table (Gold, Rust, Lilac, Deep orange), andnew(name)gives the one in the palette, which matches the docs'palette(70)example being "Gold". ABrickColoris an attribute type and is saved in place files as{"BrickColor": number}. Not built:BasePart.BrickColor.[MINOR] Add BasePart.BrickColor: theBrickColorclosest toColor; setting it setsColorto the brick's color. It is not saved in place files (Serialized = false), sinceColorholds it. ChangingColorfiresBrickColor's change notification too, afterColor's, but only when the closest brick changes (Gamma's choice; Roblox does not document it).
- Step 14b, answer (the user, 14 Nov): option (a), the one recommended: a Luau type string on each descriptor and each datatype binding, so the C++ stays the one source. Built in three commits:
[MINOR] Add Luau types to registered members:PropertyDescriptor,MethodDescriptorandEventDescriptorgainedType(a property's Luau type, a method's function type withoutself, an event's handler type pack), set per class withClassDescriptor::SetTypesat the end of eachRegister. Members thatInstanceBindingsbinds itself (WaitForChild,BindToClose,UpdateAsync,Invoke,OnInvoke) are recorded as type-onlyLuauMemberson their class. A doctest fails for any member without a type, so a new member cannot be added untyped. Enum types are writtenEnum<Name>(EnumRunContext), as in luau-lsp's Roblox definitions;RaycastParamsandRaycastResultare table types declared with the globals.[MINOR] Add Luau definitions for datatypes and globals: each datatype binding, the signal types, thetasklibrary and the plain globals (game,workspace,script,wait,spawn,warn,shared) have aLuauDefinition(Scripting/Definitions.h) next to the code that binds them: the extern type's members and the global's fields, written in definitions-file syntax, plus a sample expression. A doctest makes a sample of each type and checks that every member and field it lists exists, so a definition cannot name something the binding does not have. The other direction (a binding member missing from its definition) is caught by luau-lsp over the specs.Instance.new,Enumand the class types are written from the registry by the generator.[MINOR] Generate Luau definitions from the registry(the step's commit):Gamma definitions <Directory>writesgamma.d.luau(luau-lsp) andgamma.yml(the selene std, replacing the hand-written one), both committed at the root. Classes are written from the registry, superclasses first;GetService/FindServicegain an overload per service andInstance.newone per creatable class, sogame:GetService("RunService").HeartbeatandInstance.new("Part").Sizeare typed; each enum becomesEnum<Name>(anEnumItem) with anEnum<Name>_INTERNALholding its items, as in luau-lsp's Roblox definitions. luau-lsp 1.70.1 facts this relies on, checked here: extern types are declared withdeclare extern type X with ... end(declare classis no longer accepted), a generic signal type must be a table type alias, aliases must beexport typefor scripts to see them, declared methods cannot be generic, and rest parameters are written...: T. The selene std keeps argument counts and simple types (number, string, bool) for global functions, takes anything for overloaded ones, and makes every value a struct of anything.- How the "Done when" items are met: selene passes with the generated std (and still rejects unknown fields, wrong argument counts and undefined globals); luau-lsp finds no unknown globals and no errors in the definitions file across
Tests/Luau,Tests/ProjectsandTests/Manual, which the lint job now checks; aDefinitionsctest regenerates both files and fails when they differ from the committed ones, so a registry change that was not regenerated fails locally and in CI (both files areeol=lfin.gitattributesso Windows checkouts compare equal). Changed from the step: unknown members are not checked, because the specs index children by name (folder.Child), which a definitions file cannot type without a Rojo sourcemap; in--!strictcode luau-lsp does report unknown members. Not done: an editor settings file, since luau-lsp's VS Code setting format could not be checked here; AGENTS.md gives theluau-lsp analyzecommand instead.
- Run at 17:22 Oslo, 14 Nov (step 16 still blocked on the OpenGL headers):
[MINOR] Add the tick, time, elapsedTime and delay globals:tick()gives seconds since the Unix epoch in UTC (Roblox's is documented as the local machine's, and may include the time zone on some platforms; UTC is Gamma's choice),time()the game time since the first step (RunService::GetElapsedTime, the sum of step deltas, so it advances 1/60 s per step inGamma run),elapsedTime()the wall time since the engine started, and the legacydelay(t, f)runs liketask.delaywithout returning the thread. The vendored docs copy has no globals reference, so these follow Roblox's behaviour as remembered.[MINOR] Add Instance:IsPropertyModified and ResetPropertyToDefault: both compare with a new instance of the class, made once per class by its factory (GetDefaultInstancein the registry), so a freshPart'sNameandSizeare unmodified and resetting a read-only property fails as setting it does. A class without a factory, such asDataModel, reports nothing modified and resets nothing (Gamma's choice).FindFirstDescendantwas not added: Roblox documents it as disabled.[MINOR] Add RunService PreAnimation, PreSimulation and PostSimulation: each fires every step with the step's delta:PreAnimationfirst,PreSimulationstraight afterStepped,PostSimulationstraight afterHeartbeat(Roblox does not document the order between a legacy event and its replacement; this is Gamma's choice). A connection to any of them keepsGamma rungoing, asSteppedandHeartbeatdo.PreRenderandRenderSteppedbelong to step 16, since they fire before drawing.
- Run at 22:21 Oslo, 14 Nov (step 16 still blocked on the OpenGL headers):
[MINOR] Add HttpService:UrlEncode: percent-encodes every byte that is not an ASCII letter or digit, in uppercase hex, which matches the documented example (.becomes%2E, so even RFC 3986's unreserved- . _ ~are escaped). A space is%20, not+.[MINOR] Add the Region3 datatype:Region3.new(min, max)keeps the corners as given, soSize(max - min) may be negative, as documented;CFrameis the unrotated midpoint, andExpandToGrid(resolution)floors the minimum and ceils the maximum to multiples of the resolution. Gamma's own: a resolution of 0 or less is an error, and thetostringform ({2, 3, 4}, {4, 6, 8}, center then size). ARegion3is aVariant(not an attribute type) and is saved in place files as six numbers. Not built:Region3int16, andWorldRoot:FindPartsInRegion3, which Roblox has deprecated.[MINOR] Add Workspace:GetPartBoundsInBox and GetPartBoundsInRadius: return theBaseParts under the workspace, in tree order, whose world-aligned bounding boxes overlap a rotated box (a separating axis test over 15 axes) or a sphere, as documented ("bounding boxes" rather than shapes, so aBallcounts as its box here).OverlapParams.new()is a plain table likeRaycastParams, withFilterDescendantsInstances,FilterType,MaxParts(0 for no limit),Tolerance(clamped to 0 to 0.05, growing the query),RespectCanCollide,BruteForceAllSlowandCollisionGroup; the last two are accepted and ignored, as there are no collision groups or query flags yet. Not built:ExcludeInstances,IncludeInstancesandAddToFilter(newer API, needs a userdata rather than a table);GetPartsInPartwas added on 15 Nov.PassesRaycastFilteris now shared by raycasts and bounds queries.
- Run at 02:21 Oslo, 15 Nov (step 16 still blocked on the OpenGL headers):
[MINOR] Add Workspace:GetPartsInPart: returns the parts, other than the query part, whose own shapes overlap the query part's: aBallis a sphere as wide as its smallest side (as for raycasts) and every other part its box, tested with a separating axis test between rotated boxes, sphere against box and sphere against sphere. Gamma's choices: touching counts as overlapping, aWedgeorCornerWedgeis tested as its box, and a query part outside the workspace is an error (Roblox says it must be in the same WorldRoot).OverlapParams.Tolerancegrows the query part's box or sphere.
- Run at 07:21 Oslo, 15 Nov (step 16 still blocked on the OpenGL headers):
[MINOR] Add Model:GetBoundingBox and GetExtentsSize: the smallest box turned like the model's pivot (itsPrimaryPart'sCFrame, or else the unrotated centre of its parts) that holds everyBasePartin the model, returned as aCFrameand aVector3tuple;GetExtentsSizereturns only the size. A model with no parts gives its pivot and a zero size (Gamma's choice). Not built:Model.WorldPivot, which the docs use when there is noPrimaryPart.
- LocalScripts and the