Hello I am too lazy to make a real thread right now and I also dont want to deal with creating a real github repo until docs are ready. Anyways download my very safe files!
This is Strontium, my optimization mod. In short it can give you some pretty insane (2-3x) performance uplifts on meagre hardware. It does this through two things: Batched rendering (basically converting a TON of draw() calls into just one big one) and shader swaps (reducing the amount of time shaders are swapped during rendering). There is a lot more too.
Some of the new stuff:
-
Render intents: To batch we need to take away your ability to direct draw - sorry, but they're too dangerous for you to handle. Instead you'll be using "render intents" (well, abstracted a little bit but who cares). These are relatively lightweight pieces of data that describe what should be drawn. Like, "a sprite on this layer with these effects in this order". The backing renderer collects these intents, sorts them into "lanes": batch (extremely fast, minimal draw calls), overlay (unbatched, meant for complex multi-pass effects), and immediate (love:draw fallback mode). This binning makes it so the renderer can be smart about how intents are drawn.
-
Pipelines: Strontium needs to know how cards are to be rendered. The "Pipeline" is a series of filter stages that run every frame, with each having specific tasks. For example, the vanilla pipeline has stages like "Cull" (remove cards that dont need to be rendered), "body" (emit render intents for card faces), "sticker" (emit render intents for stickers), and "CardUI" (card-attached buttons, other UI interactables). Stages iterate through the provided cards, checks their metadata, and then outputs a cooresponding render intent for that card. For example, a stage may check if a card is Holographic and, if so, it will emit a render intent for a sprite with those effects. You can add your own custom stages if you want to draw extra stuff (or otherwise add custom logic to the pipeline). Check out
src\strontium\renderer\base\stages.luafor more examples. -
Ubershaders: Batching requires a single atlas (technically not) and a single shader. Without this you cannot batch, hard stop. Strontium codegens a "Ubershader", which is a shader that contains a bunch of smaller frag shader "modules" derived from registered effects. We pass information to the Ubershader via a vertex texture. See
src\strontium\renderer\base\effects.luafor vanilla examples. -
Occlusion culling: Love2d and Balatro user a "painter" rendering strategy to handle z-depth (sprite overlap). Batched renderers fundamentally cannot do this since they render everything on a layer at once, so I've had to implement two things to mitigate this - a custom occlusion shader that simulates (imperfectly unfortunately enough, still working on it) z-layer overlaps, and a much more flexible layer system.
Modding API is not done yet, gotta solve some remaining problems regarding texture registration. Then documentation, then a proper release that people can start developing for. In the meantime just have fun with it in vanilla.
F8 opens the Strontium menu. F5 opens the profiler. There are a handful of dials that you can play with, some will do things, some probably will not.
I am running out of typing space. This mod is cool, I've put a lot of time into it. Test it with a fuckton of jokers and let me know how broken it is.
