Loading after the database changed
What this page is for
Section titled “What this page is for”A save is made against your database as it stood that day. As you build, the database changes: you delete a node, add a policy, reorder the outputs of a scheme. An old save then loads into a new database. This page says what Intrigues does, and which four settings steer it.
Intrigues does not block the load. It checks the save first, reports what it found, and your settings decide each case.
The check before a load
Section titled “The check before a load”IntrigueSave.State.Stage compares the save with the database and changes nothing. Its report lists, per kind of definition (clans, families, roles, cultures, policies, schemes, variables, decisions), the IDs only the save holds and the IDs only the database holds. When the header is given, it also says which kinds changed and which scheme graphs changed since the save was written. A changed graph that saved runs wait in is a warning; the rest is information. See Save and load results for the report and its codes.
The four settings
Section titled “The four settings”They sit on the Save System component. The Inspector shows each field name as words.
| Setting | Choices | Default |
|---|---|---|
| Restore Order | Per Actor, After All Actors | Per Actor |
| On Missing Node | Drop, End Run, Keep Parked (with Keep Parked Days) | Drop |
| Resume By | Index, Port Then Index | Index |
| New Definitions | Ignore, Add Missing | Ignore |
sources: field defaults in Runtime/Save/IntrigueSaveSystem.cs; enum bodies in Runtime/Save/State/OrderedRestore.cs, Runtime/Save/OnMissingNode.cs, Runtime/Save/NewDefinitions.cs.
Restore Order
Section titled “Restore Order”When the schemes that were running come back.
- Per Actor: each actor’s schemes come back while that actor loads. An On Game Loaded flow of one actor can see other actors whose schemes are not back yet.
- After All Actors: the schemes come back once every actor of the load has loaded, in the order of the save. First every run, then every On Game Loaded node, so each flow sees every restored scheme.
With After All Actors, an actor’s OnStart runs before its own schemes exist again, and the dice numbers of new runs started on load follow the save’s order. This setting applies to loads in place and across scenes.
See On Game Loaded.
On Missing Node
Section titled “On Missing Node”A running scheme waits on a node, and you deleted that node.
- Drop: the visit is dropped and the rest of the run goes on. The check reports it as
VisitDropped. - End Run: the visit is dropped and the run ends through its End flow with the result Failed (
RunEndedForMissingNode). The End flow runs while the load is still restoring, so it may see actors that have not loaded yet. - Keep Parked: the visit is kept as saved, and every later save writes it back. It comes back when the node does. Meanwhile the run counts as running: it does not end by itself and cannot be started again.
Keep Parked Days applies to Keep Parked only. After that many days of play, counted from the day the visit was first kept, the kept part is let go, and the run goes on or ends when nothing else runs. 0, the default, keeps it until the node is back or the run ends.
Only a node that is gone counts. A node that kept its ID but changed its kind is handled by Resume By.
Resume By
Section titled “Resume By”How a running scheme finds its place in a graph you edited.
- Index: by the saved numbers, the output’s number and the Sequencer step’s number.
- Port Then Index: by the saved output key and step node first, then by the number. Reordered outputs and steps still match. A waiting node that was replaced by a node of another kind is dropped and reported (
VisitTypeChanged).
With Index, a node of another kind with the same ID is restored as before and the visit runs on, but a warning (VisitTypeChanged) says so. Every save carries both the numbers and the keys; a save made without the keys resumes by number.
New Definitions
Section titled “New Definitions”What a load does with cultures, policies and roles the database has and the save does not.
- Ignore: they are not part of the loaded game. The check reports them (
OnlyInDatabase). - Add Missing: they are added as a new game makes them (
DefinitionAddedToGame). No saved clan adopts an added policy, and an added role has no holder.
Clans and families are never added; they come with their actors, so the check only reports them.
Putting the game back when a load fails
Section titled “Putting the game back when a load fails”A load in place can put the game back if it fails. It is off unless you ask. Set OnFailure to FailurePolicy.RevertSameScene in the RestoreOptions of the load.
Example, not compiled. It uses members named in the code’s docs:
var options = IntrigueSaveSystem.Instance.DefaultRestoreOptions();options.OnFailure = FailurePolicy.RevertSameScene;var result = await IntrigueSaveSystem.Instance.LoadAsync("slot1", new LoadRequest { Scene = SceneMode.Current, Options = options });Before the load, the game is captured as a save captures it, between two days, so a day’s thinking is finished first. If an actor, a scheme, the mind or a save part then throws, the load stops at the first failure and that capture is put back in the same scene. The result is Reverted, and LoadResult.NotReverted lists what was not undone.
What a revert cannot undo: dialogues the load closed, sounds it stopped, listeners that heard the load, what your own save parts read, and anything outside Intrigues.
A load across scenes is refused with RevertUnavailable, before anything starts. A revert is also refused (RevertUnavailable) with Actor Home World, and when the load is asked while a scheme’s node runs. When the capture before the load fails, the load does not start.
How it connects
Section titled “How it connects”- The results, and every problem code named here: Save and load results.
- The settings of the component: Saving and loading.
- A custom node can keep its own small state in a save by implementing
ISavableNode(a text of up to 4096 characters and a version). Of the shipped nodes, only Play Sound is marked as running again after a load: its clip starts from the beginning. See Play Sound. - Limits that still apply: Limits of saving in 2.0.