Game servers
One running copy of a game — creating one, its states, putting it to sleep, and what it costs.
projects/{project}/locations/{location}/gameServers/{game_server}Creating one
The only required field is game, and it must name a game that can be run — a
branch of the catalogue like games/minecraft has nothing to install, and asking
for a server of one is refused when you create it. plany games list --deployable server lists the games you can run.
Servers → New server → choose a game, a region and a machine type → Createmachine_type is the size, from the catalogue. Leave
it empty and you get the smallest type that meets the game's own minimum. Add
spot to run on spare capacity at 60% off. Set vpc to put
the server on one of the project's private
networks rather than the
default; it is fixed at create, and players connect the same way either way.
secrets puts a secret in the server's environment, or in a
file, without the value passing through your configuration.
Creating returns a long-running operation; see Operations.
The CLI waits for it unless you pass --wait=false.
The build is fixed when the server is created. A game's build moves on; a
running server's does not. An update to "Minecraft Forge 1.20.4" cannot change
what your server is running under your players' feet — build on the server
says which one it has.
States
| State | Meaning |
|---|---|
PROVISIONING | Accepted; the server is being placed and started. |
STARTING | Installing the build and launching the game. |
RUNNING | Accepting players. |
STOPPING | On its way down. |
STOPPED | Stopped, by you or because it went to sleep. The world is kept and nothing is charged for compute. |
FAILED | Something failed. error says what. |
DELETING | Being removed. |
state_message says, in a sentence, why the server is where it is. See
GameServer.State.
Sleeping when nobody is playing
Set sleep_after_idle and a server with nobody on it goes to sleep after that
long. A sleeping server is STOPPED, with a state_message saying it is asleep;
it costs nothing to run and keeps its world — and the next player who connects to its
address wakes it, usually in seconds.
grpcurl -H "authorization: Bearer $PLANY_API_KEY" \ -d '{"game_server": { "name": "projects//locations//gameServers/", "sleep_after_idle": "900s"}, "update_mask": "sleep_after_idle"}' \ api.plany.cloud:443 plany.playpute.v1.PlayputeService/UpdateGameServerA server is only put to sleep when Plany has actually seen it empty: no player on
it, no connection open, nobody waiting to join, for the whole of
sleep_after_idle. A server whose players Plany cannot yet see — see Players
and sessions — stays awake rather
than being put to sleep on a guess. The clock restarts when the server wakes, so
a connection that wakes a server and then leaves gives it a fresh
sleep_after_idle before it sleeps again. A server whose game has told the
Agones SDK it is allocated or reserved is somebody's match, and is never put to
sleep. Zero, the default, keeps a server awake.
sleep_after_idle is set through the API. A server you stopped yourself also
wakes when a player connects to it.
Ephemeral servers
ephemeral: true keeps nothing. The world and everything on disk go when the
server stops.
That is the right shape for a match rather than a world: a minigame round has
nothing worth carrying into the next one. An ephemeral server cannot sleep — it
has nothing to wake into — so sleep_after_idle is refused on one.
ephemeral cannot be changed after creation. A server that spent a week
ephemeral has nothing for a later false to keep.
Who can reach it
exposure decides who can reach the server, and also cannot be changed after
creation.
EXPOSURE_PUBLIC (the default)›
Every public port the game declares gets a Plany address, and that is what players are given and what the server advertises. See Addresses and waking.
EXPOSURE_PROJECT_INTERNAL›
No public address at all. The server is reachable only from inside your own project — by another server, or by a matchmaker you run there.
An internal server is not woken by a player connecting, because there is nothing for them to connect to. Whatever directs traffic to it has to start it.
Internal is the right choice for a fleet behind a matchmaker: a public address on each member would be an entry point nobody intended.
Identity
Leave service_account empty and Plany creates one per server, granted
roles/playpute.gameServerAgent on that server and nothing else. A server
runs your own code and mods, so the identity it holds reaches exactly the one
thing it needs.
Set it to a service account you own and the server acts as that instead. The point is a fleet: grant one service account a role somewhere else, attach it to twenty servers, and those twenty can use it while the rest of the account cannot.
Attaching one requires iam.serviceAccounts.actAs on that service account,
not merely permission to create a server. A server acts with everything its
identity can do, so handing it a broader identity is a decision that needs its
own permission.
Starting, stopping and deleting
Servers → the server → Start, Stop, Restart or Delete| Call | Effect |
|---|---|
StartGameServer | Starts it, with its world as it was. |
StopGameServer | Clean shutdown, with the world written out. force skips the clean shutdown, for a server that has hung — and risks losing whatever it had not saved. |
RestartGameServer | Stop, then start. |
DeleteGameServer | Removes the server and its world. |
All four return long-running operations.
Deleting a group member by hand does not stick — its size is the group's to decide, so the group creates another. See Autoscaling.
Changing a server
display_name, settings, secrets, sleep_after_idle, machine_type and
spot can be changed on an existing server. Settings and secrets reach the game
the next time it launches; a new machine type or spot setting takes effect on the
server's next start. game, ephemeral, exposure and vpc cannot be changed —
create a new server instead.
Reading a server back
GetGameServer gives you state, state_message, endpoints, machine_type,
resources, build and, for a spot server, spot_status. Who is playing on it
is presence.
instance is an identifier for the machine behind the server. It is output-only
and not something you act on — quote it if you are asking Plany about a specific
server.
What it costs
A running server is charged for its machine type's vCPUs and memory and for its disk, by the minute. A stopped or sleeping server is not charged for any of them. See What it costs and Machine types.