An engine is what makes a game work with Comms Array: it reads the game (its logs, its telemetry, whatever the game offers tools) and tells Comms Array what's going on in a small, versioned format. Comms Array does the rest: the PC panel, the phone pad, the party line, stats. You can write one for any game, publish it, and update it whenever the game patches, without waiting for a Comms Array release.
The contract is engine-api.md. This page is the short way in.
1. Pick a kind
run: {"python": ...} | run: {"program": ...} | |
|---|---|---|
| Language | Python | anything |
| Libraries | only what Comms Array's exe carries | your own |
| Runs in | Comms Array's engine host (its own process) | your program (its own process) |
| Start with | the engine link reference | examples/hello_engine/ (imports nothing of ours) |
Either way the engine runs in its own process, starts only after the player linked the game, and is restarted if it crashes. Pick a program if you need a library the exe doesn't have, another language, or a tool you already ship.
2. Write engine.json
{
"id": "mygame", "game": "mygame", "engine_api": 2, "version": "1.0.0",
"name": "My Game", "author": "Your name",
"processes": ["MyGame.exe"],
"run": {"program": "mygame-engine.exe", "args": []},
"consent": {
"terms_version": "1",
"notice": "What this engine is, and who makes the game.",
"reads": ["The game's log files: ..."],
"never": ["The game's memory", "Chat"]
},
"input_rules": {"automation": "not_allowed", "text": "What the game's terms allow for key presses."},
"show_labels": {"ship": "Ship", "place": "Location"}
}
game is the game your engine serves. For a new game, pick its id; for a game Comms Array already has (starcitizen, elite), use that id and your engine sits beside ours: players pick which one runs, and keep their pads, permissions, stats and parties when they switch. Give your engine its own id and name (and the game's name in game_name), and keep the game's value paths, action ids and situation names so saved pads keep working.
processesdecides when the game counts as running, and is the only place key presses can go. Your code can't change that at run time.consentis shown before anything is read. Bumpterms_versionwhen what you read changes; players are asked again.show_labels(optional) names yourshowtexts where a player picks what party members' rows show.
3. Speak the link
Comms Array starts your engine with CA_ENGINE_URL, CA_ENGINE_TOKEN, CA_ENGINE_DIR and CA_ENGINE_PACKAGE (engine-api.md, "How the core starts an engine"). Then:
- Open a WebSocket to
CA_ENGINE_URLwith the headerAuthorization: Bearer <CA_ENGINE_TOKEN>. - Send
{"t": "hello", "info": {...}}:idandengine_apias inengine.json, yournameandversion, the values you describe (metrics), the sharing switches and which fields each covers (share_fields), your built-in pad layouts (PhoneandTablet). - Send
status, thenframes with your views (share,pad,cockpit,identity, ...) as the game changes. - Answer each
reqwith arescarrying the sameid. Unknown ops:{"status": "bad_request"}. - Exit when the socket closes.
Keep your data in CA_ENGINE_DIR (it survives updates), never in CA_ENGINE_PACKAGE (an update replaces it).
What you don't need to do: filter what the party sees beyond your own judgement (the core drops every field whose switch is off or that share_fields doesn't declare), decide where key presses go, or hash who is playing (the core hashes your identity key before anything leaves the PC).
4. Try it
Zip engine.json, your hub.json and your code (engine.json at the top of the zip), then in Comms Array: Games > More games > Install an engine from a .zip, tick "I trust whoever made this", and link the game. The log (tray menu > Open log folder) shows your engine's stderr lines.
5. Publish
Publish the same zip from your hub developer account (the hub's docs/api-engines.md; a program must be an .exe there, so the example's run.cmd is for trying it locally only). Each version is signed by the hub as unreviewed until Comms Array reviews that version (verified); players who have a verified version get the next one once it is reviewed.
Each version you publish starts on beta: players on the beta Comms Array see it. When it has run well, promote it to stable at /me/developer (Stable and beta), and everyone sees it; you can move a version back to beta. Players see Update to X for your engine and update with a click, or by themselves if they switched automatic engine updates on (an unreviewed version always waits for their OK). It's offered as long as its engine_api is one their Comms Array speaks. A version that crashes before it has run cleanly is rolled back on their PC, and any player can click Use the previous version; either way that version isn't offered to them again, so fix it in a newer one. hub.json describes your stats and boards; the hub takes it from the package.