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 - | Views: 40,093

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.
34 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.
47 comments
Page: «2/5»
  Go to:

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
QuoteIn 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
QuoteFrozenbyte 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
Quoting: dscharrerThe 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... :-(
Pit Nov 20, 2019
I wonder whether that is the same/similar thing that affects The Bards Tale (2004). I used to be able to play it with little issues, but nowadays the shadows of the characters are just some black polygons :(
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
Quoting: Hamish
Quoting: vskyeThat'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.
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.