mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-23 23:24:55 +01:00
3729ee3ef3
## About The Pull Request I want to do stuff with parallax (like placing stuff in the backdrop and moving it around), but I'm in my not doing 100 things in one pr arc so we're doing this piecemeal. To start, I wanted to try adding oldspace back as a parallax layer. This is something I was considering when it was first removed but never got around to, so here we are. I started by [writing a rust program](https://github.com/LemonInTheDark/old_space_gen) to fabricate the required icon state, then realized that all the different parts of space have their own animation delays. There's no way I could make one icon state with all them looping, so instead I split them up into multiple components and then overlayed them together. This works, but is infeasible (my gpu died) at the scale required for parallax (17 480x480 sets, 15 unique delays per 1 set) so I used render targets to render one copy, then mirror it to the rest of the overlays. This works wonderfully, and gets us down to (on my machine) a gpu cost comprable with about medium parallax intensity. I'm open to making these tile bound but I thought making them look "far away" feels better. In the process of all this I got very mad at the existing parallax code, soooooooo Parallax layers are no longer stored on the client, they are stored on and managed by the parallax home atom that holds them for display. Said atom also tracks all the information about how they are selected. Parallax layers no longer take a hud as input, instead expecting a client. (we were just swapping them back and forth and I thought it was dumb). Parallax no longer tries to support passing in a mob that does not actually own the hud it is displayed on. This feature wasn't even being used anymore because it was fully broken, so all it was doing was making the code worse. Parallax no longer has to do a full refresh anytime something about WHAT layers are displayed might have changed. We cache based off the variables we care about, and use the change in state to determine what should happen (this is improved by moving "rendering the layers" fully to the control of the home datum). Parallax no longer directly modifies the hud's plane masters, instead relying on trait based signals to manipulate them (this avoids wasted time in the common event of a needless parallax prefs check). Parallax no longer has 2 procs that are only called together to "remove/readd/update" the layers, instead doing both in a new check() proc. Cleans up some plane master cruft to do with tracking/managing huds (might break, tested, think it's fine). ## Why It's Good For The Game https://github.com/user-attachments/assets/79138a0f-9f6d-447d-843e-0d237db13276 ## Changelog 🆑 add: Added an option for rendering space parallax with old space sprites (the ones from before we invented parallax), they're animated and I feel quite pretty. fix: Space parallax should hopefully behave a little more consistently now refactor: Rewrote a lot of how space parallax handled itself, please yell at me if any bugs make themselves known /🆑