r/gamemaker • u/merrigel • 9h ago
Help! Pre-loading sequences?
I'm working on my first game, and I've managed to tackle 99% of the problems I've encountered, but this one is a royal pain no matter what I try.
I have a sequence with a sprite animation for transitioning from one room to the next. If I run it in macOS, it's perfectly fine. BUT my target is HTML5, and when I run it there, the first time the sequence runs its framerate is heavily reduced. After that, it runs perfectly fine.
I've tried prefetching a sprite from the texture page with all its component sprites in it, and I've even tried to run the sequence on the game's opening room on a 9999-depth layer beneath everything else, so it's invisible but it would technically already have run by the time I call it up.
Y'all have any ideas? I'm really new at this, so it's very possible I've missed something obvious. It's only annoying and not game-breaking, so I can live with it if I have to, but it feels so fixable that it's killing me.
Thanks a ton!
2
u/BrittleLizard pretending to know what she's doing 9h ago
Do you have WebGL enabled when you're prefetching the texture?
https://manual.gamemaker.io/monthly/en/GameMaker_Language/GML_Reference/Drawing/Textures/texture_prefetch.htm
https://manual.gamemaker.io/beta/en/GameMaker_Language/GML_Reference/Drawing/Textures/texturegroup_load.htm
The alternative is to switch to a WASM build, which is much faster and more reliable. You can do this by building to the gx.games target, but exporting as a ZIP instead of directly uploading to gx.games.
2
u/flame_saint 8h ago edited 8h ago
I’ve found that prefetching sprites doesn’t work in html5, but drawing one sprite from each texture page for one frame does the same thing (I draw them “under” stuff so they’re not visible).