Today, at the Google for Games Developer Summit, the Stadia team confirmed what many folks who are familiar with gaming on Linux suspected, Google and developer partners have been using various known techniques to get Windows games running on Stadia.
A windows game typically relies on (1) Windows system calls for various purposes (e.g. accessing storage, UI etc. ), (2) DirectX calls for GPU acceleration and (3) some platform SDK/API for things like friends lists, achievements etc.
I suppose (3) is optional if you don’t care about any gaming platform features (*cough* Luna). But, I consider it pretty essential.
So, to get a Windows game to run well in Linux, you need to provide these three things.
There are a few ways to move forward that a Linux gaming enthusiast would know, and it looks like the Stadia team is on top of all of them!
Path 1: Translate the Source (Available in Production in Stadia Porting Toolkit)
Ever since the “DXVK” project was listed in the Metro Exodus credits, the community has known that DXVK or DXVK-native has been in use for bringing DirectX games to Stadia. If you look at that last github page, it actually also lists Ys VIII and Ys IX as using DXVK-native on Stadia as well.
There are a few ways you could use DXVK(-native). Stadia appears to be using it as part of its existing “Porting Toolkit” to translate DirectX calls to Vulkan calls in the source code itself – i.e. before the code is built. From comments today, it appears the Porting Toolkit also contains some other translation tools – presumably for Windows system calls and perhaps for the platform SDK.
My guess, is that these source to source translating tools probably get you about 90% of the way to a working game on Linux/Stadia. Leaving it up to the developers to debug and patch any issues that pop up.
Upsides:
- Most of the process can be automated with tools
- Delivers a “native” Linux / Vulkan app
Downsides:
- Not 100% automated
- Everything is done in source; so, may need to re-run translation and apply any manual patches for each update to the game.
Path 2: Execute with Wine/Proton + DXVK/VKD3D (Under Consideration)
Wine has been under development in the Linux community for a couple decades now – it allows users to install and run unmodified Windows applications and games on Linux. Codeweavers and Valve are two major contributors. On the order of 10,000 Windows games are known to run well on Linux via Wine and Proton (Valve’s fork of Wine) with the help of DXVK (for DirectX <= 11) and VKD3D (for DirectX 12).
This is what the Steam Deck uses to allow folks to play the majority of their Steam Library on a Linux based device.
It is important to note that Wine Is Not an Emulator (that is actually what the acronym means!) – i.e. it doesn’t “emulate” hardware instructions in software. What it does is simply re-implement Windows functions (loaded at runtime not compile time) on top of Linux. So, the overhead can be very low!
Have any games released on Stadia this way so far? It’s hard to say. The Stadia Linux environment is stripped down, but, in principle, it seems like a game developer could build Wine and its dependencies and package their game and Wine together. Whether anyone has done this is hard to say.
It also seems like a simple policy decision to include Wine dependencies in the Stadia environment. While today’s presentation was largely about Path 3, the Stadia team did say using Wine/Proton was under consideration.
Upsides:
- In many cases, absolutely nothing would have to be changed in the code.
Downsides:
- Wine is a pretty bulky package to install. It tries to implement everything ANY windows app would ever need.
- If want 32 bit support, would need to install even more dependencies in the form of compatibility libraries.
Path 3: Develop your own “Wine-Light” (Stadia Testing w/ Several Games)
This path was the focus of today’s presentation. Instead of just using Wine/Proton as is, Google engineers have been developing their own re-implementation of Windows system functions. This is similar in spirit to using Wine, but contains only the features needed without everything that is not.
By, working through a handful of games, the team has built up a list of the Windows functionality commonly needed. Which should make moving future games over easier.
Upsides:
- Like Wine, but less bloated. Once fully developed, can run unmodified Windows games.
Downsides:
- For every new game you try to run, there may be new functions you need to add to “Wine-light”
- Doesn’t have decades of development and an army of developers working on hardening it like Wine.
So there you have it. There are many options the Stadia team is not just looking at but is actively using to bring Windows games to Stadia/Linux. Exciting times!