Uru on Linux/OpenGL: 2023 update

Posted on

It's been a while since I wrote my last update, and things have definitely come a long way since then. We gave a presentation at Mysterium 2022, and Colin has written a bit about his experience porting Uru to macOS with metal-cpp.

Almost all of the blockers for a full cross-platform port have been resolved:

This work is in large part thanks to Adam (Hoikas), Zrax, Colin, and numerous other contributors. There was a big spike in activity in the 2020/2021 timeframe that led to a lot of long-await work being completed.

All the remaining work is around the actual rendering and integration with the platform for stuff like window management and input. There are two separate (but very very related) projects that I'm working on: the OpenGL rendering pipeline (which will support Linux, macOS, and Windows) and the Linux client application.

Video clip showing Uru, running on Linux with OpenGL rendering, as of March 2023.
The game footage in the video is a bit stuttery due to the recording process, but is much smoother (although far from perfect) in actual gameplay.

OpenGL Rendering Pipeline

There have been some small fixes to the rendering pipeline over the years, but no significant changes. The initial approach that I took as a proof-of-concept involved generating a new shader on the fly for every Plasma material, and that ends up causing all sorts of performance issues in areas with lots of stuff on the screen. The solution is to make fewer shaders with more conditionals within the shader to handle the different layer blending modes, but that's a significant change that I've been putting off for a few years now.

Realistically, I don't have a background in OpenGL or 3D graphics, so it's a bit daunting to look at the implementation details for some of these changes, particularly when the OpenGL docs are not the most helpful.

My initial plan is to target OpenGL 3.3 and newer, which should cover most reasonably up-to-date Linux, macOS, and Windows versions. It would be really cool to have a fallback to OpenGL 2.x for older systems, but I think I might be the only person who gets excited about the prospect of running Uru on Mac OS X Leopard PowerPC. 😅

Linux Client Application

Currently I have a branch with a barebones X11 client, but only handling the game window. Login is handled with text-based prompts in the terminal (although I did mock up a pure X11 login window for fun a while back). Mouse and keyboard input is also handled using X11 events.

The X11 client is definitely going to keep progressing, but it's probably also necessary to do Wayland-based client too. Ideally those would live in the same executable and determined at runtime by inspecting the XDG_SESSION_TYPE environment variable, but that involves dynamically loading all the functions we need for both X11 and Wayland.

The login window is another thing that needs a bit of thinking. A pure X11 window is nice as a fallback, but would feel incredibly out of place in a Wayland desktop environment. I could, in theory, do dynamic loading of GTK libraries but that it feels out of place on KDE, and I really don't want to do build-time linking to all these different UI toolkit libraries…
This might be something best left until after the game client is fully working, when it's easier for other people to contribute.

Screenshot from the All Guilds' Meeting in Kirel running on Linux with the OpenGL renderer.

Next Steps

Speaking of opportunities for contributions, this is where things get messy. Right now this work is spread across 5 different branches in git, which are continuously being rebased on top of other merges to the main branch, and it's a bit of a nightmare for anyone to follow or test out the code.

There are a few dependencies in term of order of operations here, because we don't want to merge anything that isn't able to be tested:

I can't give a timeline for any of these things because they depend on limited free time from both myself and other reviewers, but I would love to get this to a point where I'm not juggling rebases on 5 branches and where people can build it themselves in the near future.

The long term plan remains uncertain. Currently none of the cross-platform work from the H'uru repository has been accepted by OpenUru, and despite promises to prioritize this effort at the last Mysterium, there has been no visible progress. It remains a source of much frustration and disappointment that improvements to the MOULa game client are essentially held hostage by a single person. It's incredibly demotivating to pour a over a decade worth of time and energy into this work with no expectation of it ever being available on MOULa.