Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal. You can also buy games using our partner links for GOG and Humble Store.
We do often include affiliate links to earn us some pennies. See more here.

The sad case of Trine on Mesa and Linux in 2019

By -

A year or so back I was planning on writing a congratulatory article to show my appreciation to Dave Airlie for fixing a long standing bug in Mesa that prevented users of older AMD Radeon HD cards from enjoying Trine Enchanted Edition on the free graphics stack. Bug 91808 resulted in a variety of graphical artifacts which, while not interfering with the gameplay, still put me off using that version of Trine.

After several years and a great deal of evident frustration on his part, Airlie was able to track down the root of the problem and at long last was able to push a fix to master in May 2018. Airlie and developers like him are often the unsung heroes of FOSS development, and I wanted to give him a well deserved public pat on the back for his effort in fixing a bug which would only have affected such a small number of people.

Unfortunately my research into this led me down an entirely different rabbit hole when I discovered the report for Bug 66067. A much more subtle misrendering of the game's colours and lighting, this bug is present in both Trine 2 and Trine Enchanted Edition. Unlike the previous instance where it was an issue in the drivers that was the culprit, this issue is present in the game binaries themselves.

Trine Enchanted Edition when affected by Mesa bugs 91808 and 66067.

Unlike the proprietary vendor drivers provided by Nvidia and AMD, the free Mesa stack as a rule does not implement application specific fixes and instead adheres more strictly to the standards outlined by Khronos Group and other similar bodies. There are a number of reasons for this, mostly relating to adhering to a higher standard of code quality, and thus limiting the maintenance overhead for the FOSS developers.

In developing their games Frozenbyte made certain mistakes related to texture sampling and shadow sampling which were not technically in line with specifications, but are still accommodated for by most vendor drivers. The result is that the game will only render correctly for AMD users on Mesa when provided with specific patches that allow it to mimic the same incorrect behaviour found in the proprietary blob.

Applying these patches is nontrivial for the uninitiated, but through the use of Arch Build System I was able to spin my own Mesa packages to play through my copies of both Trine Enchanted Edition and Trine 2: Complete Story as the developer originally intended. The proper solution would be for Frozenbyte to patch their games to adhere to the correct Cg standard, but that now seems very unlikely.

Trine Enchanted Edition rendering correctly with a patched Mesa.

Frozenbyte was an early adopter of Linux, first through the porting house Alternative Games and then later through their own in-house development starting with Trine 2. The Humble Frozenbyte Bundle in April 2011 was the first Humble Bundle I ever purchased, and I got a lot of enjoyment from their games through the first half of our soon to close decade. As recently as 2016 their game Shadwen was released with full Linux support.

Since then a lot has changed over at Frozenbyte. The studio no longer has the same depth of Linux savvy programmers it once had, and following the release of Shadwen has been teaming up with publishers more intent on the console market. Its last three titles have all lacked Linux support, and with the release of Trine 4: The Nightmare Prince last month, the series is no longer fully represented on our platform.

Lacklustre Linux sales and internal restructuring following the lukewarm reception on all fronts to the third release in the franchise Trine 3: The Artifacts of Power appear to have taken Frozenbyte out of the Linux market for good. With even their old games struggling to run well on the Mesa graphics stack, it marks a sad end to a series that once provided so much colour to our platform.

UPDATE: Daniel Scharrer got in touch in the comments to provide some technical clarifications and share his LD_PRELOAD hack that solves the problem at the application rather than the driver level.

Those wanting to try the series can find Trine: Ultimate Collection on either GOG.com or Steam. Note that as stated before Trine 4: The Nightmare Prince does not currently have Linux support.

Article taken from GamingOnLinux.com.
33 Likes
About the author -
author picture
Hamish Paul Wilson is a free software developer, game critic, amateur writer, cattle rancher, shepherd, and beekeeper living in rural Alberta, Canada. He is an advocate of both DRM free native Linux gaming and the free software movement alongside his other causes, and further information can be found at his icculus.org homepage where he lists everything he is currently involved in: http://icculus.org/~hamish
See more from me
The comments on this article are closed.
All posts need to follow our rules. For users logged in: please hit the Report Flag icon on any post that breaks the rules or contains illegal / harmful content. Guest readers can email us for any issues.
46 comments
Page: 1/3»
  Go to:

vskye Nov 19, 2019
That's sad. I have Trine and Trine 2 in my library and have enjoyed them, and was looking forward to trying out the rest of the series.
Hamish Nov 19, 2019
That's sad. I have Trine and Trine 2 in my library and have enjoyed them, and was looking forward to trying out the rest of the series.
Just to be clear, Trine 3 does have Linux support at least. I have not played it though due to still having an older graphics card without OpenGL 4 support.


Last edited by Hamish on 20 November 2019 at 1:34 am UTC
Shmerl Nov 19, 2019
May be there is a way to release an LD_PRELOAD hook just for the needed functions, to avoid building full blown custom Mesa?

As for Frozenbyte, basically they have no Linux developers left in the studio, according to their own words.
eldaking Nov 19, 2019
I would say this story is a good example of the benefits we could have from games being FOSS. The game has a longstanding bug that should be fixed on the game code (rather than worked around in drivers), but the developer has no Linux developers left to fix it and not really any interest in the Linux copy. However, technical savvy users have found the bug and identified what fix would be needed, and are even willing to do onerous stuff like recompiling the entire graphics driver to solve it. But they have no access to the game source code and no way to distribute the fix if they had (yes, it would be necessary; we couldn't rely on the developers maintaining the game, after all).


Last edited by eldaking on 19 November 2019 at 11:43 pm UTC
Purple Library Guy Nov 20, 2019
I would say this story is a good example of the benefits we could have from games being FOSS.
Even open source game engines would presumably help a lot. Hopefully Godot for instance will gradually become more and more competitive and see wider and wider use.
seven Nov 20, 2019
does trine 4 run on proton?
Hamish Nov 20, 2019
does trine 4 run on proton?
ProtonDB and/or the Wine AppDB are your friend:
https://www.protondb.com/app/690640

I am slightly curious if buying the Ultimate Collection counts as a Linux sale, even with Trine 4 included. A way to vote with your wallet perhaps.
Hamish Nov 20, 2019
I would say this story is a good example of the benefits we could have from games being FOSS.
I had thought of mentioning this, but I could really turn this topic into an article in and of itself.

The original Unreal Tournament is stuck with a similar issue on Mesa that makes the old native build unable to launch. Enemy Territory: Quake Wars is plagued with the wchar bug when using modern versions of glibc.

Playing both of these games through WINE is now often easier than doing so natively, due to it being a stable environment. Both modern Windows and Linux are moving targets.

Frozenbyte released some of its source code in the past as part of the Humble Frozenbyte Bundle, although I doubt they are likely to do so again any time soon.


Last edited by Hamish on 20 November 2019 at 1:50 am UTC
Hamish Nov 20, 2019
Also, the more I look at the second screenshot in the article, the odder the shield appears to me. You can see both of the knight's arms, so unless the wizard is using his levitation powers, it must be standing on its own.


Last edited by Hamish on 20 November 2019 at 1:54 am UTC
x_wing Nov 20, 2019
Just to be clear, Trine 3 does have Linux support at least. I have not played it though due to still having an older graphics card without OpenGL 4 support.

But your GPU has supports up to OpenGL 4.5 (at least with core profiles).

I believe that the only real workaround for this games is D9VK or gallium-nine. Although what a pity.
Linas Nov 20, 2019
View PC info
  • Supporter Plus
Somehow the game studios keep losing their Linux people. It's not the first time we hear that the Linux guy (usually the only one) leaves and that marks the end of Linux support. I wonder why is this the case?

I am a software developer, and I see more developers getting into Linux all the time. Even the ones that do not use it are somewhat familiar with it because of servers or the WSL environment on Windows.
dscharrer Nov 20, 2019
In developing their games Frozenbyte made certain assumptions related to shadow sampling which were not technically in line with specifications, but are still accommodated for by most vendor drivers.

The source of this problem is not an assumption on Frozenbyte's part but Nvidia Cg language where texture sampling and shadow sampling use the same function name but take a 3 an 4 component vector respectively so it's really easy to use the shadow version by mistake. This is not a problem on Nvidia hardware where the shadow test is not enabled by the shader code but by the texture (sampler) state.

This also affects many games than just Trine, but the sourced is not always the Cg compile:
- Portal 2 and Portal 2 based games (at least Portal Stories: Mel is affected, probably others).
- Never Alone (Kisima Ingitchuna)
- The Book of Unwritten Tales: The Critter Chronicles (other installments in the series are fine IIRC)

The Critter Chronicles is interesting because it ships the Cg sources for its shaders. I reported all shaders that were (likely) affected to KING Art.

Btw I made some hackish LD_PRELOAD libraries that either replace all shadow sampling instructions with non-shadow ones or replace shaders outright:
https://github.com/dscharrer/void/blob/master/hacks/trinefix.c
https://github.com/dscharrer/void/blob/master/hacks/neveralonefix.c
However this really should be worked around in Mesa since this problem is so widespread, but I never got around to creating a proper fix.
Eike Nov 20, 2019
View PC info
  • Supporter Plus
Frozenbyte was an early adopter of Linux, first through the porting house Alternative Games and then later through their own in-house development starting with Trine 2.

After 14 years of using Linux, and at least a decade of starting Windows only for gaming (and work), Trine 2 was the first professional game I bought and played on Linux, in late 2012. When I started it, it took quite some seconds to come out of a black screen, so I thought it wouldn't work. I wasn't vastly disappointed at that moment, because I had that feeling, trained in a long time, that Linux just isn't a gaming system. So it was a pleasant surprise when it left the black screen and I could play it. So, still thanks, Frozenbyte!
lucinos Nov 20, 2019
My personal opinion is: Why is OGL4 a thing? Developers should either support OGL3 for light games, which is good because it supports a lot of hardware, or just support Vulkan.
Hamish Nov 20, 2019
The source of this problem is not an assumption on Frozenbyte's part but Nvidia Cg language where texture sampling and shadow sampling use the same function name but take a 3 an 4 component vector respectively so it's really easy to use the shadow version by mistake. This is not a problem on Nvidia hardware where the shadow test is not enabled by the shader code but by the texture (sampler) state.

Cheers for the clarifications. I have updated the article to better reflect this.
gojul Nov 20, 2019
Sad to see those news even though I expected it... :-(
beko Nov 20, 2019
Great writedown. Trine 3 gave me the creeps. I really tried to play this but I simply could not wrap my head around this 2,5D mess they made out of it. The preview for Trine 4 looked great again. Sad to read that I [probably] won't be able to play this with my kids when they grow a little older :(
mylka Nov 20, 2019
That's sad. I have Trine and Trine 2 in my library and have enjoyed them, and was looking forward to trying out the rest of the series.
Just to be clear, Trine 3 does have Linux support at least. I have not played it though due to still having an older graphics card without OpenGL 4 support.

i played 1-3 and 3 does not have workshop support on linux, so it is better to play it with proton anyways
Pangaea Nov 20, 2019
Trine 3 worked fine on my pc, but I never finished it. Tried to play it with a friend, like we did the others, but it was such a clusterfuck we gave up. They really messed up on that one.

First two games were fantastic, but it is sad that they have dropped linux now.
Maath Nov 20, 2019
I think program-specific driver modifications are not the best use of effort. If the driver authors AMD and Nvidia are encouraged to have games work with their hardware, I wish they would assist in debugging efforts in the game's code, or work on enhancing the API standards to avoid confusion.


Last edited by Maath on 20 November 2019 at 4:56 pm UTC
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.