Saving in multiplayer
What this page is for
Section titled “What this page is for”A multiplayer game saves like a single-player game, with a few additions. This page covers what is different: who may save, what the save holds for the players, how a load treats the people connected, and what happens to a player who is away when you load.
Read Saving and loading first for the slots and the calls. Nothing there changes in multiplayer, except who may call them.
Only the host saves and loads
Section titled “Only the host saves and loads”A player’s machine holds a copy of what its player may know, not the world. So saving is the host’s job.
On a client these calls are refused: SaveAsync and LoadAsync return the status RefusedOffHost (see results of each call), IntrigueSaveSystem.Capture returns null with one warning, Apply returns false with one warning, and NewGame does nothing. Players cannot send a save to the host.
sources: R:Save/IntrigueSaveSystem.cs lines 378, 616 and 799; saves/results; the XML comment of Apply.
What the save holds for the players
Section titled “What the save holds for the players”The save holds the world, as in single player. Besides that it holds a seat table in a part of its own: for each seat that has a character, the seat number, the character’s ID, the player’s key and the list of scheme runs withheld from that seat, plus the session ID. A seat that waits without a character is not saved.
The part is stored under the key intrigues.multiplayer.seats. It is a save extension the add-on writes while it hosts, not one of the save parts you register yourself. The published limits of saving list this under “not yet save parts”. The keys are written as plain hex, so protect the host’s disk. The part never leaves the host’s machine. The core save also carries a plain seat-to-character list, SaveData.seats (IntrigueSaveSystem.cs line 1275), separate from the add-on’s part. When the host starts hosting a loaded game, AdoptLoadedSeats reads both.
sources: MP:Runtime/Seats/SeatTable.cs lines 125 and 640 to 664; MP:Runtime/Session/HostSession.cs line 371.
Load a game while you host
Section titled “Load a game while you host”A load takes the players through it. Their screens show a loading screen, and each player comes back in their seat. A player whose character is not in the loaded game is told so and returns to their menu.
There are two ways to load, and the code names them as follows.
| You want | Call | What the players do |
|---|---|---|
| Load from a slot, and let the Save System load the scene | IntrigueSaveSystem.LoadAsync(slotId, request) with Scene = SceneMode.FromSave |
They wait in their seats until the game scene’s characters are back. |
| Load from a slot, and load the scene yourself | LoadAsync with Scene = SceneMode.Caller, then load the game scene |
They wait in their seats until your scene loads. |
| Load in the running scene | LoadAsync with Scene = SceneMode.Current, or IntrigueSaveSystem.Apply(data) |
They stay in their seats, if the data is a save of this same game session. |
If a load leaves out the characters of the seats and the game scene is not loaded afterwards, the host logs an error and holds the load: seats are kept and no new player is served until the scene loads and the world settles again.
Data from another game or session never swaps characters. Each connected player keeps their own character if it is still in the world. A player whose character is not in it is told and returns to the menu, and the host logs one warning.
Example, not compiled. The members are the ones in the table above.
var system = IntrigueSaveSystem.Instance;var op = system.LoadAsync("slot1", new LoadRequest { Scene = SceneMode.FromSave });sources: R:Save/Slots/SlotTypes.cs lines 113 to 121; MP:Runtime/Session/HostSession.cs lines 575 to 625; R:Save/IntrigueSaveSystem.cs lines 547 and 707.
Saves you did not make
Section titled “Saves you did not make”The host reads a loaded save as its own. A save someone else made can hand characters around, and its seat list can make the runs of any character it names wait for a player who never comes. Load only saves you trust.
A multiplayer save in single player, and the other way
Section titled “A multiplayer save in single player, and the other way”A multiplayer save loads in single player: the seat part is read only while a host session runs, so the seats are ignored and the host’s own character is the player. A single-player save can be hosted. It carries no seat part, so no seat comes back from it.
sources: R:Save/IntrigueSaveSystem.cs lines 216 to 256 (the add-on’s hook, null without a session); MP:Runtime/Session/HostSession.cs lines 371 and 677 to 686.
When a player is away at the load
Section titled “When a player is away at the load”Say a player has a seat in the save but is not connected when you load. A dialogue the load brings back for that player, or an On Key Press that waits for their key, waits for them. It opens when they rejoin. Only that scheme run waits. The days keep running, and the waiting dialogue does not hold them. Its time limit starts when the player sees it.
What happens is set by two fields of PresentationSettings (Settings reference):
| Field | Default | Effect |
|---|---|---|
AbsentAtLoad |
WaitForPlayer |
AnswerAsNpc answers at once, as the character’s NPC would, as before. |
AwaitAbsentSeconds |
0 |
Seconds the host waits, counted while the player is away. 0: no limit. |
The wait ends when you kick or ban the away seat, a later load drops the seat, the seat moves to another character, AwaitAbsentSeconds runs out (when you set it above 0), hosting stops, or you call the release method. With the default 0 there is no time limit. Then the character’s AI answers as the load answered before, and a key wait goes through Not Player.
Ending the wait ends the waits of that load only. What a later load brings back waits again, and the limit counts again from each load. A new dialogue for the away player, or one for a player who drops while the game runs, is answered at once, and the AI plays the character meanwhile.
| Call | What it does |
|---|---|
MultiplayerSession.WaitsFor(int seat) |
True while something waits for that away player. |
MultiplayerSession.ReleaseAway(int seat) |
Stops the wait for that seat. False when nothing waits. The seat stays and the player may still rejoin. |
MultiplayerSession.AwayDialogues |
How many dialogues wait for away players. |
MultiplayerSession.Kick(int seat, string reason = null) |
Removes the seat. The player may join again as a new player. |
MultiplayerSession.FreeAwaySeat(int seat, string reason = null) |
Frees an away seat only while its player is still away. |
MultiplayerSession.HandAwaySeat(int awaySeat, int toSeat) |
Gives the away seat’s character to a connected player who plays none yet. Returns a ClaimResult. All or nothing. |
Give the host a way to end the wait. The Session window of the add-on has Kick and Ban buttons for a seat and no button for the release.
sources: MP:Runtime/Session/MultiplayerSession.cs lines 245 to 265 and 349; MP:Runtime/Presentation/PresentationHost.cs lines 26 to 65 and 278 to 335.
Disagreements between the README and the code
Section titled “Disagreements between the README and the code”- The README names
IntrigueSaveSystem.Load. No such method exists inIntrigueSaveSystem. The calls that exist areLoadAsync(returns aLoadOperation) andApply(SaveData). This page uses those. - The README says to “load the game scene again (as single mode)” after loading from a file. The code’s own message says a load across scenes needs the game scene loaded afterwards: the Save System does it with
SceneMode.FromSave, and your code does it withSceneMode.Caller.
Not tested: a load while a player is away, and a load over Relay.
How it connects
Section titled “How it connects”- Saving and loading: the slots, the calls and their results.
- Seats, joining and waiting: how a seat is taken and kept.
- Security notes: why the seat keys in the save matter.
- Limits and what is not verified.