0 votes
by (1.4k points)
edited by
Hello all!

SugarCube 2.28.2!

So I have a passage tagged for autosave, and in that passage I have an <<audio play goto>> to another passage, which has <<timed>> within <<timed>> within <<timed>> with a <<goto>> to yet another passage which is not tagged for autosave. Testing on Twine it loads where it was saved like it is supposed to, but on itch.io it loads in the passage after the <<goto>>s, completely skipping the passage with the autoload and the intervening passage, which messes up things.

What is itch.io doing, or at least how do I stop it or trick it or something?

Thank you all!

[Update: I thought of a simple workaround: putting everything in one passage, using <<replace>> (and a @keyframe animation to force a fade in, since the <<replace>> transition didn't work (it only seems to work on bare text or images)).

I would still be interested to know why itch.io is doing what it's doing, and how to control it instead of using a workaround, for curiosity if not for future reference in other situations.]

1 Answer

0 votes
by (44.7k points)

What's probably happening is that when the autosaved passage is loaded, the user hasn't interacted with the game yet, so (due to security protocols which are a part of some browsers) loading the audio fails, which immediately triggers the "goto" part of the <<audio>> macro.  Basically, the user has to interact with the page in some way before any audio is allowed to play.

The solution would be to not autoload the save, but instead, when the game first loads up, see if there is an autosave (use the Save.autosave.has() method), and if there is, take the user to a passage where they can choose to resume their game or start from the beginning.  If they choose to resume, then you can load the autosave (using the Save.autosave.load() method), and the audio should work properly now due to the user having interacted with the page earlier.  If they choose to start from the beginning, you could delete the autosave (so it doesn't ask again) and then go to the original starting page.

Hope that helps!  :-)

by (1.4k points)
Well, I actually added the <<audio play goto>> to try and fix the problem. It plays audio, but only that on the passage the <<goto>>s point to.

In other games I have used "Config.saves.autoload = "prompt";" to ask the user if they want to go to the autosave, but for a small game where they already have the option of starting over in the game, it seemed less streamlined, and would break the artistic immersiveness of the game.
...