Read what a slot list shows
List Rolly Slots gives each slot as a Rolly Save Slot Info, newest first. It reads the slot index, never the saves, and reads each entry’s metadata once, so showing the list again costs nothing.
| Member | Holds |
|---|---|
| Slot Name, Save Time, Game Data Version, Size | What every save records (see Save and load your game) |
| Has Metadata | False for a save of an earlier version of Rolly Save, or one whose metadata cannot be read; the members below then hold their defaults, and the slot still loads |
| Title | The save’s title, as Set Rolly Slot Title or Save Game to New Rolly Slot gave it; empty without one, such as for an autosave |
| Has Thumbnail | True when the save holds a picture (see Show save thumbnails) |
| Map | The map the save was made in, such as /Game/Maps/Tavern |
| Play Time | Play time when it was saved. Show it with As Timespan |
| Location | The place Set Slot Location named, such as Tavern Cellar |
| Kind | Manual for Save Game to Rolly Slot and part saves, Quick for quick saves, Autosave, Checkpoint, Memory and Rewind for memory slots, Imported for an imported save |
| Checkpoint Name | The name Save Rolly Checkpoint was given, for a checkpoint |
| Run State | None, Active or Ended for a single-slot run’s save (see Play single-slot runs) |
| New Game Plus Cycle | 0 in a first game, then the cycle of New Game+ it was saved in |
| Profile Key | The first local player’s profile key, to show each profile its own saves |
| Game Fields | Your Slot Fields Struct as Set Slot Game Fields filled it |
Every node’s Result names the Kind of the save it saved or loaded. Get Save Status Text gives a sentence for players for each Status, such as “This save is damaged.”, for games without texts of their own.
Give saves titles
- Set Rolly Slot Title changes the title of a slot’s save, keeping its save time, picture and everything else its metadata holds, at most 128 characters; titles may repeat. A save made by a newer version, whose metadata holds values this build does not know, keeps its title: the call fails with Invalid Data rather than drop them. A slot without a save takes the title at its first save in this session; a copy or an import into it drops that title. A later save of the slot keeps its title.
- Set Rolly Title for Next Save gives the slot’s next save in this session a title, while the save it holds now keeps its own until then, such as for a new game started in a filled slot. It writes nothing; a copy or an import into the slot drops the title, as above.
- Save Game to New Rolly Slot saves the whole game into a new slot with your Title:
slot_1,slot_2and so on, the lowest number no slot holds. Result’s Slot Name is the new slot, which becomes the current slot. It is refused during a run. Beside it, do not name slotsSlot 1,Slot 2and so on:Slot 3andslot_3make one file name, and the second to save is refused with NameCollision.
A title above 128 characters is refused with Invalid Input and a setup message, and a saved title above 128, which no game writes, lists as empty.
Name the place
Call Set Slot Location whenever the player enters an area, such as in a trigger volume’s overlap event. Every later save names that place until it is set again. A text longer than 1,024 characters is refused with a setup message, and the place stays as it was.
A whole-game load sets the place from the save, a part load leaves it, and Clear Loaded Game clears it.
Add fields of your own
- Make a struct with what the list shows, such as the hero’s level and the chapter’s name: a Blueprint struct (Add > Blueprint > Structure) or a C++
USTRUCT. Keep it small: the whole of a save’s metadata holds at most 16,384 bytes. - Tick SaveGame on each of its members (in a Blueprint struct, each variable’s advanced options). Members without it are not saved, and a struct with none reports NoSavedFields in Data Validation of Project Settings and as the game starts.
- Pick the struct in Project Settings > Plugins > Rolly Save > Slots > Slot Fields Struct.
- Call Set Slot Game Fields with Make Instanced Struct of your struct whenever a value changes, or in On Pre Save of a Rolly Save component, which runs inside each save before its metadata is written.
- In the slot screen, read Game Fields with Get Instanced Struct Value of your struct.
Set Slot Game Fields refuses another struct than the one in Project Settings, and fails while Slot Fields Struct is empty, each with a setup message. Game fields that would bring the metadata past 16,384 bytes are left out of that save with a warning and a FieldsTooLarge line in its Issues; the rest of the metadata is saved. A save that holds another struct, such as one saved before you picked a new Slot Fields Struct, lists with empty Game Fields.
Count play time
Play time counts while the game world runs: paused time does not count, and slow motion counts at real speed. Get Play Time gives it now. A whole-game load sets it from the save and counts on from there; a part load leaves it; Clear Loaded Game starts it again from 0. Nothing ticks to count it.
From C++
#include "Game/RollySaveSubsystem.h"
#include "StructUtils/InstancedStruct.h"
URollySaveSubsystem* Save = URollySaveSubsystem::Get(this);
Save->SetSlotLocation(NSLOCTEXT("MyGame", "Cellar", "Tavern Cellar"));
FMySlotFields Fields; // your Slot Fields Struct, its members flagged SaveGame
Fields.HeroLevel = 12;
Save->SetSlotGameFields(FInstancedStruct::Make(Fields));
Save->SaveToNewSlot(TEXT("Before the cellar"), [](const FRollySaveResult& Result)
{
// Result.SlotName is the new slot, such as slot_3.
});
Save->SetSlotTitle(TEXT("slot_1"), TEXT("Harvest festival"));
Save->ListSlots([](const FRollySaveResult& Result, const TArray<FRollySaveSlotInfo>& Slots)
{
for (const FRollySaveSlotInfo& Slot : Slots)
{
const FMySlotFields* Shown = Slot.GameFields.GetPtr<FMySlotFields>(); // null without fields
// Slot.bHasMetadata, Slot.Title, Slot.bHasThumbnail, Slot.Map, Slot.PlayTime, Slot.LocationText, Slot.Kind
}
});rolly.save.list in the console prints each slot’s kind, map and play time too.