Updates (desktop versions sold outside Steam)
Steam delivers updates itself, but when you sell on your own site, on BOOTH or elsewhere, the game checks for new versions on its own.
- Make the files to distribute and the manifest
This createslim update-manifest --base-url https://example.com/game/updates/ --pack packs/patch1 --notes-file notes.json lim update-manifest --base-url https://example.com/game/updates/ --app windows=dist/windows/…/Game_1.1.0_Setup.exe,mac=dist/Game-mac.zip --page https://example.com/gameupdate.jsonand the files to distribute (packs as<id>-<version>.zip, and copies of the game files) indist/update/. Put its contents at the--base-urllocation - Write
"build": { "update": { "url": "https://example.com/game/updates/update.json" } }inliminalia.jsonand export (the environment variableLIMINALIA_UPDATE_URLtakes precedence;offleaves it out)
For how the game behaves (how it asks the player and what it shows), see Updates in player.md.
- Packs (
--pack): a project’spacks/<id>/(exported the same way aslim packfirst), a folder exported withlim pack, or its zip. Whether a pack is newer is decided byversioninpack.json, soversionis required.requires(which version of the game it goes into) isrequiresinpack.json, or the currentversionif there’s none - The game itself (
--app): an installer or zip for each OS (windows,mac,linux) (the Mac zip and dmg can be made as described in “Packaging” above).--pageis the download page (opened when there’s no file for the OS). The version isversioninliminalia.json(--versionoverrides it) - Release notes go in
--notes "…"or--notes-file(text, or JSON such as{"ja": "…", "en": "…"}; the one in the player’s language is shown) - If
dist/update/update.jsonalready exists, packs for other game versions that weren’t made this time are kept (so you can still deliver fixes to players of older versions).--freshdoesn’t keep them - It isn’t included in the Steam-connected version (it is with
build.update.steam: true). The automatic check after export doesn’t test it
The manifest looks like this:
{
"format": "liminalia-update", "formatVersion": 1,
"app": { "version": "1.1.0", "page": "https://example.com/game", "notes": { "ja": "…", "en": "…" },
"files": { "windows": { "url": "Game_1.1.0_Setup.exe", "sha256": "…", "size": 123 } } },
"packs": [ { "id": "patch1", "version": "1.0.1", "requires": "1.0.0", "title": "Fix 1", "url": "patch1-1.0.1.zip", "sha256": "…", "size": 456 } ]
}
- URLs can be relative to the manifest. Only https is allowed (
http://localhostis accepted for local testing).sha256is required, and a download that doesn’t match isn’t used - Packs are installed in
packs/<id>/in the save location (because the inside of a Mac app and Program Files can’t be modified, due to signatures and permissions). A pack is extracted under a different name and then swapped in, so if the process stops partway, the previous one remains. Inside the zip,pack.jsonmust be at the top level or inside a single folder, and itsidmust match the manifest - To update the game itself on Windows, a
.exeor.msiis downloaded and launched, and the game quits (the installer removes the previous version and installs the new one) - On Mac with a
.zip(made withbuild.mac.ziporlim build mac --zip) and on Linux with a.tar.gz(made bylim build linux), the game replaces itself (packages/desktop/app-swap.cjs; the same flow as Studio’s updates)- It downloads the file, checks
sha256, and extracts it into.<name>.update/next to the app (on Linux, next to the game folder) - It checks that it’s the same game at the expected version (on Mac,
CFBundleIdentifierandCFBundleShortVersionStringandcodesign --verify --deep --strict, and if the current app has a Developer ID signature, only a signature from the same Team is accepted. On Linux, the executable’s name, and the name and version inpackage.jsoninsideresources/app.asar) - The game quits (after the autosave and saving it does before closing), and a small sh script swaps the app and launches it again. The script doesn’t delete the previous version; it waits up to 120 seconds for a marker showing that the new version started.
If the marker appears, it deletes the previous version. If not, it stops the new version, goes back to the previous version and launches it (the script’s log is in
liminalia-update-<id>/in the temporary folder). The new version places the marker once the title screen (or the game, for a project without one) appears, so a version that starts but never shows the game is rolled back too - On Linux, the whole folder is replaced, so things that exist only in the old folder (the save data
savedatanext to the executable whensaves.locationis"portable",resources/packsthe player added, and so on) are moved to the new folder (and moved back when reverting to the previous version). The new version is launched with the same arguments as the current game (such as--no-sandboxon systems where the sandbox can’t be used). On Mac, the save data next to the app (<title> savedata) is outside the app, so it isn’t touched
- It downloads the file, checks
- When the app can’t be replaced (it’s in a location that can’t be written to, Gatekeeper is running it from a moved location, or the file isn’t a
.zipon a Mac (such as a.dmg) or a.tar.gzor.tgzon Linux), the downloaded file is opened as before. If there’s no file and only a page, the download page is opened
Signing the manifest (Ed25519)
So that a fake manifest can’t make the game install other files even if the update server (or something along the way) is taken over, you can sign the manifest and put the public key in the game.
- Make a key pair (only once)
lim update-key # creates the private key at ~/.liminalia/update-keys/<project id>.pem and prints the public key (--out changes the location) - Write the printed public key in
liminalia.jsonand export. A game with the public key only uses manifests whose signatures verify"build": { "update": { "url": "https://example.com/game/updates/update.json", "publicKey": "the public key printed by lim update-key (32 bytes in base64)" } } - Pass the private key when you make the manifest (
--sign-keyor the environment variableLIMINALIA_UPDATE_SIGN_KEY)lim update-manifest --base-url https://example.com/game/updates/ --pack packs/patch1 --sign-key ~/.liminalia/update-keys/my_game.pem
- The signature is
"signature": { "alg": "ed25519", "value": "…" }in the manifest. What’s signed is the manifest withoutsignature, as JSON with its keys sorted by name (canonicalJsoninpackages/desktop/update.cjs). Changing whitespace or order still verifies, but changing even one value doesn’t - If
build.update.publicKeyis set but no private key is passed, or the private key doesn’t pair with that public key,lim update-manifeststops - Keep the private key out of the project folder and version control (
lim update-keymakes it a file that only you can read). To sign in CI, store the private key as a CI secret, write it to a file, and pass that toLIMINALIA_UPDATE_SIGN_KEY - To change keys, distribute a version that lists both the old and new public keys in an array (
"publicKey": ["old", "new"]) through a manifest signed with the old key, and once it has reached players, sign with the new key. If you lose the private key, games with its public key can’t be made to accept new manifests (players will have to reinstall the game by hand) - Packs and game files are still checked with
sha256as before (there’s only one signature, on the manifest)