Shipping
Permissions
By default a project can do anything. List Permissions in Gamma.json and it can only reach outside the game in those ways:
{ "Permissions": ["Http", "Files"] }| Permission | Guards |
|---|---|
Http | Http:GetAsync, Http:DownloadAsync, Http:CreateWebStreamClient, and setting an asset to a URL (Image.Source, MeshPart.MeshId, MeshPart.TextureId) |
Files | Every Files method |
Process | Process:RunAsync, Process:GetEnvironmentVariable |
Serial | Serial:GetPorts, Serial:Open |
Location | Location:GetLocationAsync |
Network | Network:StartServer, Network:Connect |
Other members of those services still work. A guarded call without its permission errors with what to add:
Files.ReadFile needs the Files permission; add "Files" to Permissions in Gamma.json"Permissions": [] allows none. Leaving it out allows all, so older projects keep working.
Running code you don't trust. Put --sandbox before the path: Gamma run --sandbox <Folder> or Gamma play --sandbox <Folder>. Then a project gets only what it declares, and a project that declares nothing, a single script or a place file gets nothing.
Place files are checked too: a place that sets an asset to a URL without Http fails to load. Paths inside the project need no permission. An exported game keeps its project's permissions, and its update check needs none.
Exporting
Gamma export MyGame dist/MyGameWrites one executable that holds the engine and the project. It copies the Gamma you run it with, so on Windows export with the static build (build/static/Gamma) to get a single file; other Windows builds need their DLLs next to it.
- The folder needs a main file.
- Hidden files and folders (
.git,.env),build,node_modulesand earlier exports are left out..luaurcfiles are kept for their aliases. - On first start the game unpacks itself into a folder of its own and reuses it after that.
- No console window on Windows. Keeps the execute bit on Linux and macOS.
- An exported game takes
play's flags, like--framesand--window(see the CLI).
Not done yet:
- Cross-platform export. You get the platform your
Gammawas built for. Export once per platform, for example with the builds the release workflow attaches. - A window from a headless build. A game exported from
headlessruns without one, andexportwarns you. - Icons and version info. None on Windows, and no macOS app bundle.
- Hiding the source. Luau and Gama files are packed as-is and compiled at run time, so players can read them.
- Compression. Big assets make a big executable.
- Code signing. SmartScreen and Gatekeeper may warn.
Updates
An exported game can update itself. Set UpdateManifest in Gamma.json to a URL, and the game fetches it on every start, in the background:
{"Sha256": "<the executable's SHA-256>", "Url": "https://example.com/MyGame.exe", "Version": "1.1"}Write the manifest with:
Gamma manifest dist/MyGame 1.1 https://example.com/MyGame.exe dist/manifest.jsonIf the digest isn't the running executable's, the game downloads the new build, checks the digest, and asks the player whether to update and restart. Yes: it swaps in the new executable, closes normally (so Run:BindToClose runs) and starts the new one. No: it asks again next start. Failures are printed and otherwise ignored.
- Both URLs must be
https,file, orhttpto localhost, since the only check is the digest. - Saved data is keyed by the game's name, so it carries over.
- Windows can't overwrite a running executable, so the old one becomes
<Game>.oldand is deleted next start. - The game's folder must be writable. A game in
Program Filescan't update itself. - Runs with
--screenshotor--framesnever check. - New builds aren't signed, so SmartScreen may warn about each one.