Cloud Games

A cloud game is one world played by several people on several PCs, one after another. A server keeps the sealed world between turns. It never opens a save; it holds the bytes and says whose turn it is, and tells every outside channel set on the server (a log line, and the opener's webhook: one https address per game, public hosts only, one chat-style line per move) each time the turn moves: an accepted turn, a seat that leaves holding the turn, and the admin advance.

The room and the keys
Any player may open a room; nothing is asked but a name for the room and for the player. The game knows its one server by itself: no screen shows or asks for a server address. Opening a room gives a room key to hand to the others. Each player who joins with the room key gets a seat key: one key, one seat, one game. The seat key is kept in its own file beside that game, never in the settings. When the opener starts the game the lobby is frozen and the room key dies.

The lobby
Each seat picks a host nation. A nation one seat holds cannot be taken by another: the nation list asks the server again when it opens and names the player who holds each taken nation. The opener may pick a nation for a seat that has not picked yet, never change another player's pick. The opener starts when the seats are ready; the opener's PC makes the world and sends it as the first sealed turn.

One world turn, seat by seat
Inside one world turn the living human seats play in seat order. A seat the AI plays and a seat whose nation is gone are skipped. Ending your turn seals the world and sends it; the next seat takes it. Only the last living human seat moves the world on (AI nations, events, the new turn) before it seals. When the server takes the seal and names the same seat again (the last person left), the world on that PC simply plays on: no waiting screen, no trip to the menu. From the moment a seat starts sealing, its PC asks nothing more until then: a choice the new turn brings waits in the sent world for the player of that nation, and a choice waiting for a nation the AI now plays is answered by the AI.

Orders written down
Every human order that can be played again is written to an order log as it is done (set tax, found a village, dig a tunnel so far). A replay loads the previous world, plays the logged orders and compares the result with the save the seat sent, leaving out the event log and the random seed. A wrong order list or an edited save does not match. A seat uploads its orders before its save. When the server has the check turned on (a game build on the same box, run without a screen) it plays them on the previous save and refuses a save they do not give, as a broken save. A seat with an order the game cannot write down yet, or one that also moved the world on, is taken without the check. A check that cannot run never locks a seat out.

What the server refuses
A seal from the wrong seat, a seal with an old turn number, a seal from an older build than the game has seen, a world that is too large, a store that is full, and more than 6 rooms opened in one hour from one address. A newer build is taken and raises the game's build for everyone; it never goes back. A PC on an older build is told so in its list of games and cannot take the world, so no turn is played that the server would refuse. A sealed turn is written to this PC before it is sent and stays there until the server takes it, so a refused seal, a lost connection or a closed game never loses the turn: ending the turn again, or opening the game from the list, sends the same sealed bytes and never plays the turn twice. A menu save inside a cloud game is kept apart from the handed turns: it opens on top of the turn it was made in and is dropped when a newer turn arrives.

Told on screen
While this PC sends a turn, takes the world or asks whose turn it is, one short line at the top of the screen says so. If the server stays silent the line says it is asking again. A failure line stays until the player clicks it away or the same work succeeds. A PC with no connection and a server that does not answer get different lines. No line shows a count, a percent or seconds.

Taking the world
A downloaded world is checked against its hash before it is opened. A world that does not match is not loaded. Measured (seed 2, one run, m3): a sealed world weighs 1.2 MB at turn 400 (91 nations) and 1.9 MB at turn 800 (153 nations); sealing or opening it takes about 0.2 s. A full world per turn is kept: no turn sends only the changes.

Leaving, and who is awake
A player may leave a seat; the opener may not. A left seat reads "Departed" and its nation is played by the AI from the next turn. The opener may give a left seat to a new player, who gets a new seat key. A seat reads as awake when its PC spoke to the server in the last 10 minutes. A left seat never reads as awake; the list of games says how many seats are open and played by the AI.

What does NOT happen
- No two seats play at the same time.
- The server never plays a turn and never reads the world.
- A cloud game does not talk to a plain http address outside a debug build.
- A key is never written to a log.
- No player sets anything about the server: no address field, no host key.
- The diagnostic event record does not travel with the turn: each PC keeps its own, and a turn from another PC marks this PC's record incomplete (see History & Replay).

How it connects

See also

Tags

Home