Save System Integration
Preface
Goals
Demonstrate how to integrate Bolt with another save system.
Guide
Overview
All of Bolt's classes that can be saved implement IBLSaveable
. They will handle saving/loading themselves; all you need to do is call these notify functions:
- PreGameplaySave
- PostGameplaySave
- PreGameplayLoad
- PostGameplayLoad
Whichever save system you're using, simply call these functions before/after saving/loading and Bolt's classes will integrate correctly. For example, it should look like this:
- Blueprint
- C++
// Saving
{
// Bolt's function
MyObject->PreGameplaySave();
// However your save system handles the serialization step
TArray<uint8> Bytes;
SerializeDataToBytes(Bytes, MyObject);
// Bolt's function
MyObject->PostGameplaySave();
}
// Loading
{
// Bolt's function
MyObject->PreGameplayLoad();
// However your save system handles the deserialization step
TArray<uint8> Bytes;
DeserializeDataFromBytes(Bytes, MyObject);
// Bolt's function
MyObject->PostGameplayLoad();
}
By 'Saving' or 'Loading', we mean serializing data to/from an archive with the flag SaveGame
(for saving during gameplay). Bolt's classes expect this serialization process to save/load data for properties marked SaveGame
.
If you're unsure whether your save system serializes data in this way, chances are it does. These save systems all work this way and will integrate easily with Bolt:
- Easy Multi Save (EMS)
- Rama Save System
- Savior Auto-Save Plugin
We are not affiliated with any of these creators. This is not an exhaustive list; we only looked at the most popular save system plugins on the marketplace.
Which Objects Should Be Saved?
Bolt's inventories handle saving/loading the items they contain1. Thus, you will only need to save/load the inventory objects:
- BLSimpleInventoryComponent
- BLGridInventoryComponent
- BLEquipmentComponent
- BLWorldItem
- BLCraftingComponent
- Saving/loading of stored items is recursive; E.g., with a
BLSimpleInventoryComponent
(A) storing aBLSocketInventoryItem
(B) that stores aBLItemStack
(C), you will only need to save/load A. A will handle saving/loading B and C.↩