My SugarCube story has custom sounds and art for every passage. The only problem with this... is that Leon's sound macros try to load every single sound at the start of the game. :P
This could prove unpleasant - I don't want people to sit there for 5 minutes before they can play. So is there a way to change the macros to preload, but staggered? Like on game start, 10% of the assets get loaded, then at certain checkpoints it loads more in?
Beyond that, (if I recall correctly!) Leon's sound macros do not actually request that the audio sources be loaded. They simply create a cache of
HTMLAudioElementobjects, one for each unique piece of audio. For each of those audio objects, they neither set the
preloadattribute (so its default value is browser-defined, though
metadatais recommend), nor call the
load()method (which requests that the browser load the audio source now, in the background). So, essentially, the macros leave the decision of when to load the audio sources completely up to the browser.
If so, would it be a good idea (and even possible?) to specify certain audio elements to be loaded first so that they're ready for the very first passage?
I have no idea how browsers work but I'm just trying to think through how to handle an audio-heavy game.
No. It means that the browser will decide when to load the audio. How the browser decides when to do so varies to some extent from browser to browser. Though, obviously, when you try to play an audio clip, it will be loaded if it hasn't already been.
The programmatic nature of the Twine story formats actually hurts here, since the browser can't prefetch link contents to see what resources the next "pages" might require.
Having another macro in the set whose purpose was to tell the browser to queue one or more clips for loading ASAP could be useful, yes. And yes, it would be possible (it should even be easy).
That might work. Still, I'd suggest simply using the updated version above.