PlayFlow
PlayFlow is a client for PlayFlow Cloud dedicated-server
hosting. A game client requests a server, polls until it is running, then
Net.connects to its host:port. PlayFlow runs your headless Linux
--server build; the server itself needs no PlayFlow SDK.
PlayFlow is a static facade (like Audio/Net), desktop-only. Every method safely
returns a falsey value when networking isn’t compiled in or no API key is configured.
PlayFlow
Section titled “PlayFlow”Import from the engine module:
import "engine" for PlayFlow, NetPlayFlow.isConfigured()
Section titled “PlayFlow.isConfigured()”Returns: Bool — true if a client API key is set (via PLAYFLOW_CLIENT_KEY).
PlayFlow.requestServer(region, customData)
Section titled “PlayFlow.requestServer(region, customData)”Request a dedicated server. Blocking HTTP call — use it at matchmaking time, not per frame.
Returns: String — the server’s instanceId, or "" on failure.
Parameters:
region(String) — a PlayFlow region id (e.g."us-east"), or""for the default.customData(String) — opaque data forwarded to the server (e.g. a JSON string), or"".
PlayFlow.serverInfo(instanceId)
Section titled “PlayFlow.serverInfo(instanceId)”Look up a server’s status and endpoint. Poll until status is "running".
Returns: Map — { "ok": Bool, "status": String, "host": String, "port": Num, "error": String }.
host/port are populated once status == "running".
Matchmaking flow
Section titled “Matchmaking flow”import "engine" for PlayFlow, Net, Logger
class Game { construct new() { _id = ""; _connected = false }
init() { _id = PlayFlow.requestServer("us-east", "") // -> instanceId if (_id == "") Logger.error("could not request a server") }
update(dt) { if (_id != "" && !_connected) { var info = PlayFlow.serverInfo(_id) // poll (throttle this in a real game) if (info["status"] == "running") { Net.connect(info["host"], info["port"]) _connected = true } } for (ev in Net.poll()) { /* handle connect / data / disconnect */ } }}Hosting the server
Section titled “Hosting the server”Package the headless Linux --server build with docker/server.Dockerfile (or a zip) and
upload it to PlayFlow. PlayFlow injects the assigned port via the PLUME_SERVER_PORT env
var (which overrides [Network].port) and stops the server with SIGTERM. See the
Dedicated Server guide and the engine RUNBOOK.md.