Instances

Related documentation : Instances

This tutorial will explain what is an instance, an other tutorial about instance will come later (Step by step part 2 : Instances).

ArchiveID and ElementID can be dynamics, you can use one (or more) index of the array creating it as variable (ToElementID(Array<String>,Array<String>))for select where to save an object and make more than one save of the same element, but that is not something user friendly.

An instance represent a whole savegame.
If you want to handle more than one player in a game, you’ll want to use instances because it’s a way to swap from one save to an other. Changing instance mean unloading all archives and reload new ones from an other path (other player for exemple).

When an archive is created (you never create archives yourself), it is part of the current dynamic instance.
If you change the current dynamic instance (within ArchivesMaster/InstanceSettings/Pre-made instances, or with a changeInstance node), all these archives are unloaded and are now part of this other instance.
Instances are represented by an InstanceID witch is a DtAIdentifier, like archiveID or ElementID.

Let’s try instance’s manipulation :
– Go in Instance Settings (master).
– Serialize all.
– add a new pre-made instance.
– change his identifier (or don’t) to what you want and accept.
– Set his “Is Current” property to true.
– move and open doors, light on.
– Serialize All.
– Switch back to “default_a5”, set “Is Current” to true.
– Deserialize all.
Now you know how to swap from “default_a5” to “YourInstance”, you can swap from one to another, save, load…etc.Basic use of instances.

Statics instances are special instances that don’t change when you change the current dynamic instance.
You cannot create static instance and when using a GetAllInstances node, these won’t be in the array.
An archive can override instance in his setting, that will make this archive part of a static instance (making this archive static).
– Open Master/ArchiveSettings
– Go in the setting of the archive named staticdoor (which is currently not static)
– Open OverrideInstance and give it an identifier.
Currently that don’t move files.

Now this archive will only exist in one instance, the one you set in OverrideInstance. This can be used for store things like language or app settings or what you want that is not changing when current instance is changed.
If you need to get a static instance, you can use GetInstanceOfArchive.