Detailed usage

1. Configure the system

System configuration is performed in a Data Asset.

REMINDER

As explained in the Installation section, the configuration Data Asset must be added to the assets to cook list.

Open DA_ADS_SaveSystemConfig to configure the system. The plugin loads this asset at this location, so do not move, rename, or delete it. The parameters are detailed below:

ParameterDescription
Project Save BehaviorBlueprint class derived from ADS Project Save Behavior. It is optional, but handles project-specific events and conversions.
Profile Save Game ClassClass derived from ADS Save Game Object used for profile.sav.
Slot Save Game ClassClass derived from ADS Save Game Object used for manual and automatic slots.
Current Save VersionSave format version, at least 1. Increase it when a change makes old data incompatible.
Auto Convert Without ConfirmationEnables direct conversion of older saves. When disabled, the project receives a confirmation request first.
Manual Save Slot Base NamePrefix for manual saves. For example, save produces save01; add a separator yourself when needed.
Manual Save Max Slot IndexLast allowed manual-save index, from 0 to 999.
Automatic Save Slot Base NamePrefix for automatic saves. No separator is added automatically.
Automatic Save Slot CountNumber of rotating automatic-save slots, from 1 to 5.
Save Operation TimeoutParticipant response wait time, between 2 and 20 seconds.
Default Slot ThumbnailFallback image used when a saved thumbnail is unavailable.
Thumbnail WidthCaptured-thumbnail width, from 64 to 2048 pixels.
Thumbnail HeightCaptured-thumbnail height, from 64 to 2048 pixels.
Thumbnail JPEG QualityThumbnail JPEG compression quality, from 1 to 100.
Custom Save DirectoryReserved for custom uses. Slot operations currently use Unreal Engine’s standard save directory.

2. The subsystem

Access the subsystem

ADS Save System is a Game Instance Subsystem. Retrieve a reference to the subsystem in the Blueprint that needs to use it.

Functions

The functions below are accessible from a subsystem reference.

FunctionDescription
Get Project Save BehaviorReturns the project save behavior.
Get Project Save Behavior AsReturns the project behavior with the requested class.
Check ConfigChecks the runtime configuration and returns warnings and errors.
Get Current Save VersionReturns the current save-format version.
Check Save VersionCompares a save version with the current version.
Get Save Version From SlotReads the save version stored in a slot.
Scan Saves Needing ConversionFinds saves that need conversion.
Is Convert PendingIndicates whether a conversion is pending.
Continue ConvertContinues a pending conversion.
Cancel ConvertCancels a pending conversion.
Add ParticipantRegisters a participant and defines the save types in which it takes part.
Remove ParticipantRemoves a registered participant.
Clear ParticipantsRemoves all registered participants.
Cleanup ParticipantsRemoves participant references that are no longer valid.
Get Registered ParticipantsReturns registered participants.
Get Registered Participant CountReturns the number of registered participants.
Save SlotStarts a slot save.
Load SlotStarts a slot load.
Get Slot CacheReturns the cached save object for a slot.
Get Last SaveReturns the last save known by the profile.
Get Slot ListReturns the requested slot list, existing or empty.
Delete SlotDeletes a manual or automatic slot.
Copy SlotCopies a slot to the first available slot of the same type.
Format TimeFormats a UTC date for display.
Get ThumbnailReturns a slot thumbnail or its fallback image.
Save Slot CacheWrites a slot cache to disk.
Does Slot ExistIndicates whether a slot exists.
Get Slot NameBuilds the name for a slot type and index.
Get DigitsReturns the number of digits needed for slot indices.
Is Slot Index ValidChecks whether a slot index is valid.
Set Part SavedNotifies that a participant has finished saving.
Set Part LoadedNotifies that a participant has finished loading.
Is Saved Cache CompleteIndicates whether every participant has finished saving.
Is Loaded Cache CompleteIndicates whether every participant has finished loading.
Is Operation In ProgressIndicates whether an operation is active.
Has Pending LoadIndicates whether a load still needs to be applied.
Apply Pending LoadApplies a pending load.
Get Active Operation IDReturns the active-operation identifier.
Get Pending Participant CountReturns the number of participants whose response is expected.
Cancel Active OperationCancels the active operation.
Get Last Automatic IndexReturns the last index used for automatic saves.
Get Next Automatic IndexReturns the next automatic-save index.
Set Automatic Index StateSets the rotation state of automatic saves.

Event Dispatchers

The subsystem Event Dispatchers let participants, menus, and project logic react to operations. Participants must subscribe in their BeginPlay to On Save Requested and On Load Requested to handle their own portion of the data.

Event DispatcherDescription
On Save RequestedTriggered at the start of a save. Each registered participant writes its data, then calls Set Part Saved with the received context.
On Load RequestedTriggered when loaded data must be applied. Each participant reads and applies its data, then calls Set Part Loaded with the received context.
On Save CompletedTriggered when a save succeeds, fails, or times out. Disk writing occurs only after every expected participant has responded successfully.
On Load CompletedTriggered when a load succeeds, fails, or times out, after every expected participant has applied its data.
On Convert CompletedTriggered when a save conversion succeeds, fails, or is cancelled. It is independent of load completion.
On Slot DeletedTriggered after a manual or automatic slot has been successfully deleted. Profile saves cannot be deleted with Delete Slot.
On Slot CopiedTriggered after a manual or automatic slot has been successfully copied to the first available slot of the same type.

3. Save Game Object

Create a child Blueprint of ADS Save Game Object and add the project variables to retain (with the SaveGame option). The system automatically fills in the version, UTC date, level, type, index, slot name, and, if requested, thumbnail.

For generic data per participant, you can use Set Part Data, Get Part Data, Remove Part Data, Clear Part Data, and Has Part Data. A part has a name, version, text content, and binary content. For common data, however, prefer explicit variables in your child Blueprint: they remain easier to read and maintain.

4. Register participants

A participant is the object that has data to write into a save or reapply when loading. Each participant is responsible for its own registration: do not centralize this call in another Blueprint.

In each participant’s BeginPlay event, retrieve a reference to the subsystem. From a subsystem reference, call Add Participant, specifying the participant object and whether it takes part in profile, manual, and/or automatic saves.

When a participant is no longer needed, call Remove Participant from a subsystem reference. Use Clear Participants or Cleanup Participants from the object that deliberately manages all participants. Never create a new context: always reuse the one received through the event. The Is Saved Cache Complete, Is Loaded Cache Complete, Get Pending Participant Count, and Is Operation In Progress functions help diagnose the flow.

5. Save

Trigger a save

From a subsystem reference, call Save Slot, specifying the slot type and index when the type is manual. For an automatic save, the index is resolved by rotation. The Capture Thumbnail option saves a JPEG thumbnail of the current view before writing.

Save Slot triggers the overall operation: the subsystem prepares the save object, then delegates data saving to every participant registered for that slot type. Once the operation ends, the subsystem calls the On Save Completed dispatcher with the context, success, and a failure reason. Call Cancel Active Operation to stop an operation in progress; no cancelled save is written to disk.

Participant saving

In its BeginPlay, each relevant participant subscribes to the On Save Requested dispatcher. When this dispatcher is triggered, the participant receives the context and handles its save. It writes its own portion of data into Save Game Object, then calls Set Part Saved from a subsystem reference, using the same context with Success set to true. The subsystem waits for every participant to respond before writing the slot.

6. Load

Trigger a load

From a subsystem reference, call Load Slot with the configured save class. The subsystem retrieves the slot, can automatically open the saved level, then delegates applying data to the participants after the map has loaded. Apply Pending Load is intended for a custom flow or debugging; normally it is called automatically.

Once the operation ends, the subsystem calls the On Load Completed dispatcher with the context, success, and a failure reason.

Participant loading

In its BeginPlay, each relevant participant subscribes to the On Load Requested dispatcher. When this dispatcher is triggered, the participant receives the context and handles its load. It reads its own portion of data from Save Game Object, applies it, then calls Set Part Loaded from a subsystem reference using the same context. The overall load finishes only when every expected participant has responded.

7. Project logic

Introduction

ADS Project Save Behavior is an optional object for project-specific logic. The subsystem creates it from the class configured in the runtime asset, then uses it to notify lifecycle, operations, and save conversions.

Create the logic

Create a child Blueprint of ADS Project Save Behavior, then assign this class to Project Save Behavior in DA_ADS_SaveSystemConfig. Implement only the events required by your project. The functions below are events to override in this child Blueprint. Override only those your project needs.

Functions

FunctionDescription
Initialize BehaviorCalled after project logic is created. It receives the main subsystem.
Deinitialize BehaviorCalled before project logic is released.
Handle Save Operation CompletedCalled at the end of a save, successful or not, before the public On Save Completed dispatcher.
Handle Load Operation CompletedCalled at the end of a load, successful or not, before the public On Load Completed dispatcher.
Handle Save Operation FailedCalled when a save fails; the reason identifies the cause of the failure.
Handle Load Operation FailedCalled when a load fails; the reason identifies the cause of the failure.
Handle Need ConvertCalled when an old save requires project confirmation before conversion.
Convert SaveConverts the save object between two versions. This function must be synchronous and return true only if data is compatible.
Handle Convert CompletedCalled after a conversion succeeds, fails, or is cancelled, before the public On Convert Completed dispatcher.
Get ADS Save SystemReturns the subsystem that owns this project logic.

Manage save versions

From a subsystem reference, use Check Save Version, Get Save Version From Slot, or Scan Saves Needing Conversion to identify old saves. If conversion is required and Auto Convert Without Confirmation is disabled, project logic receives Handle Need Convert. After confirmation from your interface, call Continue Convert; otherwise call Cancel Convert.

In Convert Save, adapt the save-object data to the new version. A save created with a version newer than the project version cannot be loaded.