Single-player games
The game calls the router and uses the answer directly:Multiplayer games
In a multiplayer game the server owns the shared world, so the server talks to the character. The player’s game sends what the player typed to the server as a Command, the same way it asks for any other action (see share the game world). The server answers the Command, asks the character for that player’s session, applies what the character did, and publishes the line in shared State so every player sees it. Each call names the session of the player it is for:server.gd
On a refusal,
r.message is a plain line for the players, such as “AI limit reached for this game today”. Show it, and the game goes on.
Server calls count toward the game’s caps, not the player’s. Pace each player on the server (one line in flight per player, a short gap, a length cap on the text), so one player cannot use up the game’s daily cap.
When the character calls a tool, the server runs it and sends the result back, so the character can answer with it:
server.gd
unavailable, so keep the offline line.
When a player’s game talks to a character
A player’s game can also talk to a character itself, withSummer.client.router, and tell the server what happened, for example “the guard agreed to open the gate”. Before the server acts on it, it checks the exchange:
server.gd
verify_exchange returns the reply and the tool calls exactly as the player saw them. It answers only for an exchange of that session’s player, in this game, from the last hour. Anything else answers invalid_input with reason not_found: do not act on it.
