flathub / com.mojang.Minecraft

https://flathub.org/apps/details/com.mojang.Minecraft
34 stars 13 forks source link

Gamescope integration #98

Open vchernin opened 3 years ago

vchernin commented 3 years ago

Gamescope integration could be a nice optional feature for this package.

Gamescope is a Wayland microcompositor, which is very useful for playing games. Whether the game itself is run in native Wayland isn't relevant (#96), Xwayland is supported. You can run Gamescope from within another Wayland compositor like Mutter (GNOME) or KWin (KDE).

This has the noticeable benefit of easier game resolution scaling on Wayland (among other things). Currently the only way to change the game resolution on Wayland is to change the resolution of your display. X11 allows apps to change the display resolution, but Wayland does not. So currently on Wayland if you have a high resolution display and not-powerful hardware, you have no easy way of running the game at a lower resolution for better performance. To solve this Gamescope allows you to scale output as desired.

How this could be done in Flatpak I'm not sure, but it seems possible. There is already a Steam Flatpak repo for it.

vchernin commented 2 years ago

@AsciiWolf I have a mostly functional local build of this. The extension setup does work. Gamescope + Minecraft seems to work reasonably well on my Intel gpu.

Would you be interested in having a Minecraft Flatpak extension for this? It requires changes here, but gamescope wouldn't be used by default. Only if a user opts in, say creates a use_gamescope file or something.

I may try to turn https://github.com/flathub/com.valvesoftware.Steam.Utility.gamescope into a generic extension like mangohud, to avoid multiple gamescope extensions.

Edit: I see there was discussion about Minecraft-specific extensions in the past, but I still think Gamescope is best generic.

AsciiWolf commented 2 years ago

Gamescope as a Minecraft Flatpak extension sounds interesting. Feel free to send a PR. :-)

vchernin commented 2 years ago

Opened a PR: https://github.com/flathub/com.mojang.Minecraft/pull/112

The biggest question is probably whether you think the wrapper script is a passable appraoch. I'm not the biggest fan of it, but I couldn't get anything else to work. Luckily this approach is still fairly simple regardless in my opinion.