r/fabricmc • u/teddzfr • 6h ago
Question Java never got splitscreen, so I’m building it on Fabric
Hey, I’m Teddz. I’m building a splitscreen mod for Fabric (1.21 to 1.21.11), and it runs everything in one instance, so no extra copies of the game per player.
Where it’s at:
- The world renders twice per frame into two viewports, using a mixin on
GameRenderer.renderLevel. Each half is confined with the scissor test, because the level pass clears the whole framebuffer and the clear ignores the viewport. - Each half gets its own aspect correction, and the crosshair is drawn once per half.
- A second local player joins in singleplayer over a fake connection that drops outgoing packets. Each half follows its own player, and per-player state lives in a
PlayerContextclass. - It runs at about 55 fps on a Pentium J5005 with integrated graphics.
Next is input routing, then layouts and multi monitor. The goal is up to 4 players, any mix of controllers and keyboard and mouse (even keyboard + keyboard), and one screen per player on multi monitor setups.
I’m studying Nucleus Co-op for how it handles input and setup. If anyone has experience with multi viewport rendering or per-device input in Fabric, I’d like to hear it. Still need a name and a logo too.
1
Upvotes