I've been working on a cool multiwindow system for a godot game(s?) and I finally got the viewports to work and it's so fun to mess with
it also just works on Linux(in GNOME at least. I assume it works in anything that's not a tiling window manager) which is cool thank you Godot for making your window stuff be operating system agnostic
Before, I just had each window hooked up to its own camera in the scene that it'd follow but there were two problems with this:
Their zoom factors were inconsistent as you resized the window which looked weird and also I wanted the "dpi" to remain consistent and the world to look static no matter the window size
Now, I don't know exactly how Godot's rendering pipeline works, but I have a feeling that each of those cameras were individually rendering the scene which would waste a *lot* of resources. probably not an unplayable amount but it still irked me when so much of it would be redundant.
So I swapped to a setup of having two sub viewports, one that contained what would be the game world and one that just contained a TextureRect that held the image of the first subviewport.
And then each window has its own TextureRect that samples that image with a script that drives some shader values to crop it based on window size and position. The formula for this ended up being a lot simpler than I thought haha but I'm kind of bad with math problems like this
(where mx and my are monitor size values)
There's prob some better way to do this where I don't have to send data between the CPU and GPU but I'm fine with it for now and I don't think it'll make a huge difference.
I think my next problems I want to solve are a proper id system to manipulate windows with and getting smoother movement. I talked about it with a friend but I think a lot of my jittering with the game space comes from the fact that I end up swapping between integers and floats a lot with moving the window, so I'll see about sticking to only integers or something. I'd love to only do floats but sadly window size and position is locked to integer values. Then it'll just be down to making proper smoothing for actual window movement, which I don't think will be really hard. As far as IDs go I kind of already have that covered haha I just need to make some functions on my global script that let me manipulate the windows inside its container array.
Besides that I think some other things I want to look into are general window movement solutions. I want to look into Path2D and see if that's suitable. If not, maybe I make my own splines system(thank u Freya Holmer).
There's also the question of what the fuck I want this actual video game to be and it's probably a platformer haha
I've had this idea in my head for about a year or two of a platformer that loops around the desktop or even goes through multiple monitors. Multi-monitor play is scary though because that kind of majorly hardware locks my game. On one hand that's funny as fuck but on the other it's lame as fuck. It'd be a free game anyway but I don't know.
Super funky window!! Also a St Catherine from a church I forgot the name of (can’t even remember if I found her in the same one as the funky window or in a different one)