When the game saves
A lifecycle save is an autosave (slot kind Autosave, started by Lifecycle) that Rolly Save writes by itself at these moments, with no node to call:
| Moment | Sent by | Setting (default) |
|---|---|---|
| Background | Android and iOS, as the game leaves the screen. The system may end it later without a further warning. | Save When Backgrounded (on) |
| Quit | The Quit Game node, the quit command, a closed window, Alt+F4, in packaged and standalone games. Play In Editor never quits. |
Save When Quitting (on) |
| Session End | Windows, as the player shuts down or logs off with the game running. | Save When Quitting (on) |
| Window Loses Focus | Desktops, as the player switches to another window. | Save When Window Loses Focus (off) |
Windows, Mac, Linux and the Steam Deck send no background moment: a killed game (Task Manager, a crash, the Steam Deck’s sleep followed by a power-off) writes nothing, and its last save loads. Keep the autosave timer on as the cover for those cases (Autosave and save checkpoints).
All settings are in Project Settings > Plugins > Rolly Save > Lifecycle Saves.
Only while a game is in play
With Lifecycle Saves In at Game in Play, the default, a lifecycle save writes only in a map where a game is in play, so a quit from your title screen does not write the title map into the autosave slots, the run’s slot, the current slot or resume.
List your title, menu and loading maps in Maps Without Autosave (Project Settings > Plugins > Rolly Save > Autosave). While it lists a map, the maps it lists are never in play and every other map is, a level your game opens with its own Open Level included, from its start. Set Rolly Game in Play with In Play unticked still turns play off in a level until your game opens another map.
Without a list, a game is in play:
- after a whole-game load in the map, Rolly Save’s own map change included, or a whole-game save of it, such as the player’s save, an autosave or a checkpoint;
- in the map your game opens after Clear Loaded Game or Start Rolly Run in your title screen;
- after seamless travel, or after your game opens the same map again;
- after Set Rolly Game in Play with In Play ticked.
Without a list, your game’s own Open Level of another map ends play, since Rolly Save cannot tell a next level from a return to the title screen, and the first lifecycle save dropped for no game in play adds a note to the Message Log, once per session (NoGameInPlay). Is Rolly Game in Play tells where you stand. Check your flow:
- A new game: call Clear Loaded Game as the player starts it, before you open its first map, never on the way back to the title screen. Without a list, the new game is in play only in the next map your game opens, so a loading map before the first level needs the list.
- A game that moves between its levels with its own Open Level: list your title and loading maps in Maps Without Autosave. Without a list, call Set Rolly Game in Play in each level’s Begin Play to save a quit before that level’s first save.
- A title screen shown over a level without a map change: call Set Rolly Game in Play with In Play unticked as it opens, and ticked as play starts.
- A game without a title or menu map, which opens straight into play: set Lifecycle Saves In to Any Map, which saves in every map Maps Without Autosave leaves out.
In a map Maps Without Autosave lists, and where no game is in play, the profiles still save at the moment while Save Profiles with Game is on, past Minimum Gap, so a value changed in a menu, such as an unlock bought in a menu shop, is kept.
Where it writes
Lifecycle Saves Write To:
| Value | Writes |
|---|---|
| Autosave (default) | Where autosaves write: the next autosave slot, or the current slot when Autosaves Write To says so. Never over a manual save. |
| Current Slot | The slot last saved or loaded (Set Current Rolly Slot), else as Autosave. Games on phones that resume where the player left often pick it. |
| Resume Slot | The reserved slot resume, which no other save uses; your title screen offers Continue from it. |
During a single-slot run, a lifecycle save writes the run’s slot, as every save of the run does (Play single-slot runs). Profiles save with it when Save Profiles with Game is on.
What drops or refuses it
A lifecycle save is dropped, with a log line and no On Save Finished, when:
- no game is in play in the map, or the map is in Maps Without Autosave (above); the profiles save anyway while Save Profiles with Game is on;
- autosave is stopped (Stop Autosave);
- the last lifecycle save was less than Minimum Gap ago (5 s, 0 to 600), as when split-screen focus changes on Android pause the game again and again. Other saves do not count, and the gap spans moments: with Save When Window Loses Focus on, a quit within 5 s of a focus-loss save is dropped, and the focus-loss save, written by the quit’s wait, holds the game;
- saving slots is paused after the saving user signed out or changed (Keep saves with each player’s account).
It is refused, and On Save Finished reports it, when:
- a load runs until its values are set, or the map changes by seamless travel:
Busy, since a half-loaded world is never written; - a save block is on and Respect Save Blocks is on:
Blocked. Off by default, so a player who quits during a blocked fight cannot undo what happened in it. Turn it on when your game blocks saves to keep its state consistent, such as during a cutscene that moves actors, rather than against quitting.
On a client only the client’s profiles save; the server saves the world. A dedicated server makes no lifecycle saves in this version.
Before the save
On Before Lifecycle Save (with the moment) fires in the same frame, before the capture: copy state into saved properties or pause the game there. The saving indicator does not show, since no frame renders while the game leaves.
A save that captures over several frames finishes in that frame and is written first. A save waiting for its picture is written without one. A background, quit or session-end save takes the picture the game holds in this map, the one held for the next save or the newest Capture Rolly Thumbnail Hold, such as the one your pause menu takes as it opens, and otherwise none, since no frame draws as the game leaves; a window’s focus loss takes the next frame’s, as any autosave.
How long the game waits
The save, and every save asked for before it, is written inside the moment, before Rolly Save lets the game go on:
| Setting | Default | Bound | Why |
|---|---|---|---|
| Background Time Limit | 3 s | 0.5 to 4 | Android waits 4 s for the game before it suspends it; iOS stops the game’s frames as the moment ends. |
| Quit Time Limit | 10 s | 1 to 30 | How long a quit or the end of the session waits. |
A value outside its bound is used as the nearest bound (a value that is not a number as the default), with a setup warning, BadTimeLimit. A save the limit cuts off goes on writing until the system stops the game; the log names what was still open, the setup message LifecycleTimedOut says so once per session, and the slot’s previous copy stays loadable.
Steam Deck and desktops
- Steam Deck sleep sends the game nothing. Steam’s Dynamic Cloud Sync uploads the files at suspend, so a save interrupted by sleep can upload a damaged copy; the other copy loads (Sync saves with Steam Auto-Cloud).
- Save When Window Loses Focus saves as any autosave does and nothing waits for it, since the game goes on. Turn it on for games played in windows next to other programs.
Try it in the editor
rolly.save.lifecycle background | foreground | quit | sessionend | signout <user index> | signin <user index> makes Rolly Save act as if the platform reported that moment; the engine and other plugins are not told, and quit saves without quitting. Not in Shipping builds. In Play In Editor with several players, background makes every server and standalone game save its world and every client its profiles.
It saves only where a game is in play, as the real moment does. In a Play In Editor session started in a level with no save and no Maps Without Autosave list, load or save first, list your menu maps, or call Set Rolly Game in Play; otherwise the save is dropped and the Message Log says why (NoGameInPlay).
C++
URollySaveSubsystem::OnBeforeLifecycleSave (ERollySaveLifecycleMoment) is the event, and IsGameInPlay and SetGameInPlay read and set whether a game is in play. Lifecycle saves report through On Save Started and On Save Finished like every save, with ERollySaveStartedBy::Lifecycle.