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

GifHx.gml 41 kB
Version 2024-06-07 Jun 07, 2024
sprite_add_gif.html 28 kB
Version 2024-06-07 Jun 07, 2024
sprite_add_gif_demo.zip 2.5 MB
Version 2024-06-07 Jun 07, 2024
sprite_add_gif_demo.yyz 48 kB
Version 2024-06-07 Jun 07, 2024
sprite_add_gif_gms1.gmz 39 kB
Version 2024-06-07 Jun 07, 2024

Get sprite_add_gif for GameMaker

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.