Handler for a ink snapshot.
Each snapshot contains a globals store and all associated runners/threads For convinience there exist ink::runtime::globals_interface::create_snapshot() and runner_interface::create_snapshot() . If the runner is associated to the globals the snapshot will be identical. If multiple runners are associated to the same globals all will be contained, and cann be reconsrtucted with the id parameter of ink::runtime::story::new_runner_from_snapshot() A snapshot can be applied to an identical story file or an simulare if the snapshot is can_be_migrated(). A not migrated snapshot contiouse at exactly the place you are currently at.
Migration
Migrating a snapshot will "snap back" to the start of the innermost container it can name (e.g. the body of the last chosen choice), so output since then is repeated. Therefore it is best practice to do this only directly after choosing a choice.
- Attention
- Migration assumes that the story only grows at the bottom: new choices are added after the existing choices of a choice list (and new gathers, conditionals, sequences and other content after the existing ones of their section). Changing the text of existing content and adding new knots and stitches is fine. Choices (also labelled ones, they are numbered
c-0, c-1, ...) and containers without a name (sequences, conditionals, ...) are identified by their position, like in ink paths (e.g. knot.0.c-1 for the second choice in a knot). If content is inserted before or between existing ones, or existing ones are removed or reordered, their positions shift: visit counts (e.g. of once-only choices or sequences) and the position of the runner are then restored to whatever is now at that position, or dropped. Knots, stitches and labelled gathers are identified by their name.
- Note
- Labelled choices (* (label) [Text]) can not be migrated by their label: inklecate's .ink.json format does not contain choice labels
- Global variables which (name) still exist will be transfared.
- New ones will be initelized with its default value
- Old ones will be droped
- Temp variables which (name) still exist will be tranfared
- new ones will be initelized with its default vaule (possible missing transformations)
- old ones will be kept
- attention declarations in Tunnels will be missed
- Stack/Threads/Tunnels must not be used in the moment of the snapshot for it to be migratable.
- best practice is to create hub knots which names do not change in the progress of the update and which do not have local variables. Then only store after you stepped inside this knot.
- Lists definitions are matched after best knowladge
- for each pair of old list value and new list value the best good matching is used
- the similarty is calculated based on the jaro-winkler similiarty of the value names, and the normalized difference of the values
- for each pair of old and new list (definition) the best good match is taken
- the similiraty is calculated based on the jaccard similiraty of the contained flags, and the jaro-winkler similarty of the lists names
- visit counts (e.g. used for once only choices and sequences)
- existing ones (exact path match) are kept
- !! choices and containers without a name are tracked via their position (see above), inserting before, removing or reordering them can therfore break your visit counts
- new ones are zero
- old ones are discarded
- Todo
- Currently the id is equal to the creation order, a way to name the single runner/threads is WIP