mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
## About The Pull Request Offloads GAGS generation to rust-g IconForge. **Key Notes** - The builtin GAGS editor still uses the 'legacy' generation to allow for debugging. - Does not support `color_matrix` layer type, which is currently not used by any GAGS configs. Will do nothing if used. - Does not support `or` blending mode, which is currently not used by any GAGS configs. Will error if used. - Has some 'quirks' compared to BYOND when it comes to mixing icon states with different dir/frame amounts. BYOND will just silently handle these and it's basically undefined behavior because what should you expect BYOND to do? IconForge will spit errors out instead. So this PR also fixes a few of those cases. Functions by writing output to `tmp/gags/gags-[...].dmi`, copying that output into the RSC and assigning the file object to `icon`. Saves ~1.7s init by reducing worst-case GAGS icon generation from 250ms to 1ms. Also optimizes `icon_exists` by using `rustg_dmi_icon_states` for file icons, saving ~60ms. Would have more savings if not for json_decode as well as DMI parsing in rust being somewhat slow. Perhaps having `rustg_dmi_icon_states` share a cache with IconForge could reduce this cost, however I'd still recommend limiting these tests to unit tests (https://github.com/tgstation/dev-cycles-initiative/issues/34), especially for GAGS configs. I'm not sure they're worth 700ms. Saves another ~400ms by replacing `md5asfile` with `rustg_hash_file` in `/datum/greyscale_config/proc/Refresh` Savings are likely even higher when combined with #89478, due to spritesheets sharing a parsed DMI cache with GAGS. This means GAGS will spend less time parsing icons synchronously and can generate output faster. Tracy tests with this combo seem to yield ~2sec savings instead of ~1.7sec Total savings: ~2.16sec to ~2.46sec - Ports https://github.com/BeeStation/BeeStation-Hornet/pull/10455 - Resolves https://github.com/tgstation/dev-cycles-initiative/issues/9 ## Why It's Good For The Game GAGS go zoooom <details> <summary>GAGS Working Ingame</summary>   </details> <details> <summary>GetColoredIconByType</summary>  </details> <details> <summary>icon_exists</summary>  </details> <details> <summary>Refresh</summary>  </details> ## Changelog 🆑 tweak: Optimized GAGS using rust-g IconForge, reducing worst-case generation time to 1ms /🆑