It’s been a year since I started working on the Metal version of Uru/Myst Online!
In 2020, I received an Apple Silicon Developer Kit. One of the first things I did was make a list of games I wanted to see on Apple Silicon. I wanted to understand the performance of the DTK, and I also wanted to keep some existing titles from being lost in the transition.
On that list was Uru/Myst Online by Cyan – which holds the distinction of being the only Myst game to never get a native Mac release. Over the years there had been various WINE wrappers but never a real Mac client. If Apple ever cut off Rosetta support, the WINE wrappers might not keep working on the Mac.
After doing some digging, I found the H’uru project. H’uru took Cyan’s source code and brought it from Visual Studio into CMake as a build system. Darryl Pogue had also started working on an initial OpenGL port. I stood up a CMake environment on the DTK, and got to work building out the Cocoa frontend for the OpenGL renderer.
The OpenGL port did run on the DTK, but there were some issues:
- Xcode no longer had OpenGL debugging tools which made tracking down rendering issues and debugging shaders nearly impossible.
- I wasn’t quite sure if OpenGL could deliver the performance I really wanted. Uru is an older game – which should make it great for even low end hardware like a MacBook Air. But that might require very specific tuning for M1 that I wasn’t sure OpenGL could deliver.
I had considered writing a Metal renderer for Uru. But Metal required using either the Obj-C or Swift languages. Uru is written in C++. Mixing these languages is possible but very time consuming. And I wasn’t sure that the other H’uru contributors would have been terribly excited about a large amount of Obj-C in the repository. I’d tinkered with an Obj-C Metal renderer but given up.
Last November, I’d just started my weeklong Thanksgiving vacation from work. My wife, who is a baker, needed pie plates to fulfill her thanksgiving pie orders. We were driving around to every Walmart in the city buying every glass pie plate they had. As shes loading up on pie plates, I scrolled through Twitter on my phone, and saw this Tweet:
I instantly thought of Uru. The new Metal-cpp bindings could be used to write a Metal renderer in C++.
But I’d also never written a game renderer in Metal. I’d done some basic Metal work on video processing, but nothing in the 3D space. But I thought it might be a fun project to try Metal-cpp and get something minimal working.
The first steps were to see if I could actually load geometry from the game into the GPU. The screen was still completely black, but the Metal debugger showed me the geometry was successfully loading into the GPU.
Once that was completed – I started to work on texture loading and shading.
By the end of the week I had the test room mostly working and started checking out other parts to the game – which also had a basic level of rendering working.
Status of Mac Uru
The Mac/Metal client has come a long way in the last year.
- The Metal renderer has been tested directly against the existing Direct3D 9 renderer on Windows, and doesn’t have any currently know differences.
- Effects like water, grass and reflections are all working. The HLSL assembly behind many of these effects has been ported into the Metal Shading Language.
- It’s running natively on Apple Silicon and has gone through several optimization passes for M1 hardware. In a few cases, I’ve worked with Apple Developer Technical Support in improving performance.
- Networking is working! The game client can login to the H’uru game server and play through the entire game. Uru’s network code was originally written in NT sockets. This code has been ported over to cross platform sockets that all supported platforms should be able to use.
- There have been several other improvements specific to the Mac.
- Variable Refresh Rate/ProMotion support has been added
- The game is now Retina display aware – UI controls like the cursor scale properly.
- Uru will now render in 10 bit color on supported displays. The underlying assets are still in 8 bit color, but the improved 10 bit blending eliminates some display artifacts like banding.
I also presented Mac Uru at Mysterium 2022.
The OpenUru project – backed by Cyan themselves – also announced they will being incorporating changes from H’uru into into shipping Uru client. This means the Mac/Metal client will be upstreamed to Cyan and Uru will be natively available on the Mac. I’m really excited about this – and it would be a huge honor to have my work incorporated into one of the most important series in gaming.
What’s left to be done?
In the next year – I’ll be working with H’uru to ensure that the Metal renderer is up to their standards and ready to be upstreamed to Cyan. This includes:
- Peer review and merging of both the Metal renderer and the new cross platform network code into their mainline branch.
- Official Universal builds of the client. Packaging also needs to be finalized. Uru depends on libraries like Python which need to be included with the client.
- Final fit and finish features like proper resolution switching. (I have a blog post on resolution switching in modern Mac games that I’ve been working on!)
- Testing across a range of hardware.
- Continued optimization – with some work specific to Apple Silicon.
- Further evolution of the engine. The Metal version still inherits some legacy from the DirectX 9 based original engine like forward rendering. As the Metal engine gets more mature – I might look at working on a version that uses deferred rendering. I’d also like to look at other enhancements like controller support and MetalFX upscaling.
The production servers that Cyan hosts and the open source server that H’uru hosts have also drifted in implementations. This means that a H’uru client cannot log into a production server. There will be a lot of background work to make sure that the H’uru client (and macOS) can login and play on the official Uru servers.
After the official release – I’d love to get Uru on iPad, or even whatever Apple is doing in the VR space.
I’m still also working on a series of blog posts about porting games with Metal-cpp onto Apple Silicon. I’m hoping to have the first of those posts out sometimes this year. I still hope work on projects like Uru could convince more developers to directly support Metal.
Also – I’m writing this post to reflect on how far I’ve come in the year since starting this project. I’d never worked on an actual commercial 3D game engine before but now might have my first port released in the near future. A lot of this year was spent reviewing documentation, web articles, obscure DirectX documentation, and linear algebra books.
A Thank You!
Finally – I’d like to thank the H’uru project for letting me spend a year playing in their sandbox. Everyone has been very excited about a native Mac client, but they gave me the space to work on a Metal port and helped me through understanding the engine.