Performance options
This is another one of these times when something that’s supposed to be a quick change turns out to be a quite a rabbit-hole.
So I have agreed to add an option to load a GIF over course of multiple frames. That didn’t take very long.
But this made me realize something: it’s not just the pure-GML LZW decoder that’s slow.
The 1024x600, 250-frame “desktop friend” GIF from window shape page takes my laptop 2 minutes to load in VM build, but most of that isn’t LZW decoding! It’s the sprite_add_from_surface
calls. The more frames your sprite has, the longer each subsequent frame addition takes, to the point where the last frames of the sprite take 800ms per frame.
As a counter-measure, I have now added an option to load each frame as a separate sprite. This is slightly less convenient to work with, but makes the aforementioned GIF load in 10s on VM and 6s on YYC, which is much better - especially combined with gradual loading.
Now that the extension is no longer 2 functions, I also wrote a cheat sheet for it explaining the functions and the concepts.
2024-06-07a: fixed buggy partial redraw in GM2024 caused by surface_copy now clearing the region before copying the pixels (??).
Files
Get sprite_add_gif for GameMaker
sprite_add_gif for GameMaker
Dynamically load animated GIFs as sprites in your GameMaker games!
Status | Released |
Category | Assets |
Author | YellowAfterlife |
Tags | GameMaker, gif |
More posts
- GMS1 versionMay 08, 2023
Leave a comment
Log in with itch.io to leave a comment.