Choose which saves take a picture and how large
Project Settings > Plugins > Rolly Save > Thumbnails:
| Setting | Default | What it does |
|---|---|---|
| Save Thumbnails | on | Turns pictures on for the kinds below. |
| Width | 384 | Picture width in pixels, 64 to 1,024; the height follows Aspect. |
| Aspect | 16:9 | The shape, cut from the centre of the view: 16:9, 16:10, 4:3, 1:1 or 9:16. |
| Format | JPEG | JPEG is small; PNG is exact and about 5 to 10 times larger. |
| Quality | 85 | JPEG quality, 1 to 100. |
| Max Size (KiB) | 64 | 4 to 512. A larger picture is saved at a lower quality, then smaller; one that still does not fit is left out, with a ThumbnailTooLarge line in the save’s Issues. |
| Kinds | Manual, Quick, Autosave, Checkpoint | The kinds of saves that take a picture. Part saves keep the slot’s picture; memory slots and rewind points take none. |
| View | Player View | See Pictures in split screen. |
| Max Wait | 0.25 s | How long a save waits for its picture, 0 to 2 seconds. At 0 no frame is read; saves take only a picture you give or capture. |
| Cache Size | 32 | Pictures Load Rolly Slot Thumbnail keeps in memory, 4 to 256; about 330 KB each at the default size. |
A save asks for its picture as it is called, and the picture comes from the next frame the viewport draws. The save’s records are captured at the call; the save then waits in its slot until the picture is encoded, at most Max Wait, and is written. A later save, load or delete of that slot waits behind it. The game thread never waits for a frame: it reads the frame once as it draws, the one wait for the GPU, and a worker converts, cuts and encodes it. Saves that want one frame share that read. When no frame comes within Max Wait, such as while the window is minimized, the save is written without a picture and its Issues say ThumbnailSkipped; a frame that comes later is not read.
Flush on the game’s store (GetStore() in C++), Flush All, and the flush Rolly Save runs as the game exits or goes to the background write waiting saves at once: one whose frame has not come is written without a picture, with ThumbnailSkipped: the saves were flushed before the picture's frame came; one whose frame was read waits for its encoding inside the flush. The game instance’s end does the same. A flush of another store, such as a console command’s or another Play In Editor instance’s, leaves the saves to their frames.
Take the picture before your menu opens
A save button in a pause menu would show the menu’s blur or camera. Call Capture Rolly Save Thumbnail right before you open your save menu, with Player set to the player’s own controller: it takes a picture of that player’s view in the next frame, and the next Manual or Quick save holds it without asking for another. An autosave or checkpoint in between takes a frame of its own and leaves the held picture for the player’s save. The picture is held until that save, Clear Rolly Save Thumbnail or a map change. It returns false when no picture can be taken: Save Thumbnails off, a client or a dedicated server, no game viewport, or a controller that is not a local player’s of this game.
Use a picture of your own
Blueprint
Set Next Rolly Save Thumbnail gives the next Manual or Quick save your picture, such as a Scene Capture 2D of the party; it returns false on a client or a dedicated server. Its render target must be RGBA8 or RGBA16f; another format is refused, with the setup message RenderTargetFormat once per render target. It reads the render target once, and the game thread waits for that read, so call it when a short wait does not show, such as when the save menu opens. Like a captured picture, it is held until that save, Clear Rolly Save Thumbnail or a map change.
C++
SetNextThumbnail also takes pixels, copied at the call as they are, without a wait; a worker converts them:
#include "Game/RollySaveSubsystem.h"
#include "ImageCore.h"
TArray<FColor> Pixels = MakeMyPicture(Width, Height); // Width times Height pixels
Save->SetNextThumbnail(FImageView(Pixels.GetData(), Width, Height));
Save->Save(TEXT("Slot 1"));Show a slot’s picture in your own menu
- List Rolly Slots gives each slot’s Has Thumbnail.
- Load Rolly Slot Thumbnail with the slot’s Slot Name gives its picture as a Texture on Success. Use Set Brush from Texture on an Image widget.
- Failure comes with Not Found when the slot holds no save, or a save without a picture this version shows.
Load Rolly Slot Thumbnail reads the slot’s newest copy alone, not its backup, and takes the picture from its header: the storage reads the whole copy, so a large save costs its full size for each picture read. It decodes the picture on a worker and keeps the texture; asking again gives the kept texture without reading the save, until the slot is saved again. A slot that holds no save any more, or whose newest save has no picture, loses its kept texture. It works on clients: each machine shows its own saves.
Save->LoadSlotThumbnail(TEXT("Slot 1"), [](const FRollySaveResult& Result, UTexture2D* Texture)
{
// Texture is set when Result succeeded; Rolly Save keeps it while it is in the cache.
});Pictures in split screen
With View at Player View, a picture shows the region of the player who saved: Capture Rolly Save Thumbnail takes the region of the player whose controller it gets, and a save no player asked for, such as an autosave or a checkpoint, takes player 1’s. Whole Viewport takes every player’s region, for co-op games that show both views.
Capture Rolly Save Thumbnail keeps one picture for the next save, which two players’ menus open at once would share. For a save menu of your own in split screen, each menu keeps its own:
- As the menu opens, Capture Rolly Thumbnail Hold with Player set to that menu’s player. Keep the returned Rolly Save Thumbnail Hold in the menu, such as in a variable of its widget.
- Right before the menu’s save, Use Rolly Thumbnail Hold with that hold: the next Manual or Quick save holds its picture. It returns false for an empty hold, on a client and on a dedicated server.
- When the menu closes without saving, or its save failed, Release Rolly Thumbnail Hold, so the next save does not take the picture.
A hold is empty where Capture Rolly Save Thumbnail would be false; Is Rolly Thumbnail Hold Set tells. A hold taken before a map change is never used by a save after it, which takes a picture of its own. The slot screen does this for each player’s screen. In C++ the subsystem’s CaptureThumbnailHold, UseThumbnailHold, ReleaseThumbnailHold and LoadThumbnailHold do the same, the last giving the held picture as a texture for the menu’s detail.
What a picture leaves out
- Menus and widgets: the frame is read once the world and the HUD have drawn, before Slate draws widgets over it. What a HUD draws on its Canvas is in it; the engine’s on-screen debug messages, stats and console draw later and are not.
- Pictures on a dedicated server, which saves without them, and on a client, whose saves the server makes.
- Pictures without a game viewport, such as in a commandlet; the log says so once (NoViewport).
- A picture from another machine that is not PNG or JPEG, or whose width or height is outside 1 to 2,048 pixels or differs from what the save records: it shows nothing, and the save still loads.