## About The Pull Request Converts species and antagonist icon generation to the batched spritesheet system using IconForge, thanks to the new `get_flat_uni_icon` implementation. Unfortunately the cost of *building* the sprite is still expensive (GFI is always expensive, even a fancy list-based one), but the generation is SIGNIFICANTLY faster. We will see evidence of parity in the screenshot tests. but here: <img width="892" height="634" alt="image" src="https://github.com/user-attachments/assets/2a17f2e3-c024-41f6-9d1e-c2cb70642a81" /> The main advantage is that species and antag icons can now take advantage of the development-time smart cache which invalidates automatically. On the server this PR does very little except make antag icon generation a little bit more likely to find and announce errors (BYOND has a habit of silently eating weird icon proc calls). Also optimizes the greyscale preview generator from #90940 (~2x speedup) using `rustg_iconforge_generate_headless` instead of `Insert()` to build the resulting sheets. This can be further optimized in the future by implementing a smart cache, like batched spritesheets, and storing it in the repo, but for now it's not important/slow enough to be worth the effort. Also fixes a silent compilation error that would always happen outside unit tests, but for some reason doesn't appear on local? Notice how `map_icon_key` is not a defined variable anywhere. That's because `USE_RUSTG_ICONFORGE_GAGS` is *never* defined at this point, so it was always using the 'slow' generation. I also took the liberty of cleaning up the cultist and heretic icon generation randomly initializing a blade object when it could just use a static access. ## Why It's Good For The Game The subsystem timing may not be much faster, but the interactivity benefits during spritesheet realization are undeniable. Opening the preferences menu during init on local is orders of magnitude faster. **Old** Early Assets: 5.02 seconds Greyscale Previews: 1.38 seconds **Fresh (No Cache)** Early Assets: 4.21 seconds Greyscale Previews: 0.5 seconds **Cache Invalidated** Early Assets: 4.27 seconds **Cache Hit** Early Assets: 4.05~4.2 seconds **Preferences lag:** ~6 sec to open to ~2 sec to open due to caching in dev ## Changelog 🆑 code: Optimized species and antagonist icon loading in the preferences menu on local, speeding up time to open in development. fix: GAGS map preview generation no longer silently errors outside of unit tests due to a compilation error. /🆑
Asset cache system
Framework for managing browser assets (javascript,css,images,etc)
This manages getting the asset to the client without doing unneeded re-sends, as well as utilizing any configured cdns.
There are two frameworks for using this system:
Asset datum:
Make a datum in asset_list_items.dm with your browser assets for your thing.
Checkout asset_list.dm for the helper subclasses
The simple subclass will most likely be of use for most cases.
Call get_asset_datum() with the type of the datum you created to get your asset cache datum
Call .send(client|usr) on that datum to send the asset to the client. Depending on the asset transport this may or may not block.
Call .get_url_mappings() to get an associated list with the urls your assets can be found at.
Manual backend:
See the documentation for /datum/asset_transport for the backend api the asset datums utilize.
The global variable SSassets.transport contains the currently configured transport.
Notes:
Because byond browse() calls use non-blocking queues, if your code uses output() (which bypasses all of these queues) to invoke javascript functions you will need to first have the javascript announce to the server it has loaded before trying to invoke js functions.
To make your code work with any CDNs configured by the server, you must make sure assets are referenced from the url returned by get_url_mappings() or by asset_transport's get_asset_url(). (TGUI also has helpers for this.) If this can not be easily done, you can bypass the cdn using legacy assets, see the simple asset datum for details.
CSS files that use url() can be made to use the CDN without needing to rewrite all url() calls in code by using the namespaced helper datum. See the documentation for /datum/asset/simple/namespaced for details.