Forum rules - please read before posting.

Best practices for autosave

edited June 2023 in Technical Q&A

What I'm trying to achieve: the game will autosave every time the player switches scenes, i.e. scene 1 fades out, the game is saved, scene 2 fades in. Loading the autosave means scene 2 will fade in without loading scene 1 first.

I thought I could get away this by:

(1) At the start of the OnStart cutscene, branch off with a "Actionlist: Run in parallel" action, checking whether the "last save time" variable linked to Options data is the same as the current in-game time. If yes, do nothing. If no, call this actionlist asset:

This mostly works if the OnStart cutscene just quickly sets up the scene. The issue I'm having is that if the player has achieved something that means a longer gameplay-blocking cutscene will run when they enter scene 2 (say, an NPC will come over to congratulate them), then the actionlist asset above will only autosave when that cutscene is over, or worse: if the cutscene is more complex (broken up into several AC cutscenes, linearly and in parallel), then the autosave actionlist asset above will find a 'gap' and autosave in the middle of the cutscene.

What is the recommended way to run an autosave? Would it be possible perhaps to modify the 'switch scene' action to add an option to autosave in-between scenes, as it were (i.e. before scene 2 is loaded, but directing the autosave to load scene 2 instead of scene 1?)

Comments

  • I think I managed to do work out a solution. Would still appreciate advice if there's an easier way to do this!

    (1) Create a new OnStart cutscene and set it to "Run in background" (I think this is important so that the autosave is allowed to run).

    (2) Run the autosave actionlist asset from here with "Wait until finish?" checked.

    (3) Then run your original gameplay-blocking OnStart cutscene.

    The original OnStart cutscene can also be assigned as the OnLoad cutscene.

  • AC requires that the game be in "gameplay" mode for saving to be possible - so saving from a background ActionList is necessary.

    The above should work just fine - though the "proper" opening cutscene will also run when you load any other save made in that scene.

    If that's something you want to avoid, you can move the save-logic to an interim scene that's sandwiched between scenes 1 and 2. That way, if you load the autosave, it loads up this interim scene and then runs Scene 2's OnStart cutscene. If you load a manual save made inside Scene 2, it'll run OnLoad instead.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.