Join us on our own very special Reddit: /r/Linuxers

The sad case of Trine on Mesa and Linux in 2019

By - | Views: 25,342

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, Who?
We do often include affiliate links to earn us some pennies. We are currently affiliated with GOG, Humble Store and Paradox Interactive. See more here.
About the author -
author picture
Hamish Paul Wilson is a free software developer, game critic, amateur writer, and farm labourer living in Alberta, Canada. He is an advocate of both DRM free Linux gaming and the free software movement alongside his other causes, and more information on him 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
48 comments
Page: «5/5
  Go to:

s8as8a 5 Jan
Quoting: HamishTry launching the game outside of Steam by changing into the directory and launching the game from a terminal like so:

cd "~/.steam/debian-installation/steamapps/common/Trine/_enchanted_edition_/"
sh trinefix.c ./trine1.sh


That works for me with the Humble Store versions I was using.
Thanks again for the response.

I didn't occur to me to run it from outside of Steam, but it's good that you said that because now I have an error message.:
user@debian:~/.steam/debian-installation/steamapps/common/Trine/_enchanted_edition_$ cd ~/.steam/debian-installation/steamapps/common/Trine/_enchanted_edition_/
user@debian:~/.steam/debian-installation/steamapps/common/Trine/_enchanted_edition_$ sh trinefix.c ./trine1.sh 
[trinefix] attached to sh: 0x7f6a4c55a3b0 (nil) (nil) (nil)
[trinefix] attached to mkdir: 0x7fb91f2a53b0 0x7fb91f2a5490 (nil) (nil)
[trinefix] attached to readlink: 0x7f64dce143b0 (nil) (nil) (nil)
[trinefix] attached to dirname: 0x7f9297e023b0 (nil) (nil) (nil)
[trinefix] attached to chmod: 0x7faf3ee403b0 (nil) (nil) (nil)
./bin/trine1_linux_launcher_32bit: error while loading shared libraries: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
user@debian:~/.steam/debian-installation/steamapps/common/Trine/_enchanted_edition_$


Do you know how to deal with that, by any chance?
Hamish 6 Jan
Do you have the libgtk2.0-0 package installed? It provides the libgtk-x11-2.0.so.0 library.
https://packages.debian.org/buster/libgtk2.0-0

EDIT: And make sure you have the i386 package since it is a 32-bit application.


Last edited by Hamish on 6 January 2020 at 3:55 am UTC
s8as8a 8 Jan
Quoting: HamishDo you have the libgtk2.0-0 package installed? It provides the libgtk-x11-2.0.so.0 library.
https://packages.debian.org/buster/libgtk2.0-0

EDIT: And make sure you have the i386 package since it is a 32-bit application.
I didn't have it, so I installed it, but then, after re-running the command, I recall it saying that I needed some other so.0 file which is available only from the libpng12-0 package (sorry, I'm not at that computer at the moment to give the exact error message), but as can be seen here ( https://packages.debian.org/search?keywords=libpng12-0 ), libpng12-0 is not available in Debian testing / bullseye. (I don't think that libpng16-16 ( https://packages.debian.org/search?keywords=libpng16-16 ) would work and I tried getting jessie / oldoldstable's version of libpng12-0, but I think there were dependency problems that couldn't be resolved with apt-get install -f because the dependencies sought are too old. (I was thinking about getting the deb file for libpng12-0 from unstable / sid's repository, but as shown on the link I gave, there is only a deb file in unstable / sid's respository for the arm64 architecture.))

I guess I can just wait for when I get my next GPU (in the not-so-near future) (because my current GPU doesn't support Vulkan) and then play it with Proton? I'm in no rush to play them; I was just thinking of playing them with friends of mine a few days ago, but that time has passed. ;)
Eike 8 Jan
Do a "locate" on the missing library. AFAIR, it is contained the Steam runtime. (If you don't have locate installed, install it and run updatedb before doing the locate. It's a useful tool.)
dpanter 8 Jan
Quoting: EikeDo a "locate" on the missing library.
This is the way. ^_^
s8as8a 10 Jan
Quoting: EikeDo a "locate" on the missing library. AFAIR, it is contained the Steam runtime. (If you don't have locate installed, install it and run updatedb before doing the locate. It's a useful tool.)
I already use locate, but I didn't know that the Steam runtime had the library, so thanks!

In case anyone else is having this issue, what I did was go to the directory of the game, run ln -s /home/user/.steam/debian-installation/ubuntu12_32/steam-runtime.old/lib/i386-linux-gnu/libpng12.so.0 and then run sh trinefix.c ./trine1.sh, and it works now! I even got it working throuh the Steam client by putting sh trinefix.c ./trine1.sh as the command (instead of sh trinefix.c %command%)! :D

Edit:
I also got Trine 2 working by doing the same thing, except in the Trine 2 directory and replacing trine1.sh with trine2.sh in the command.

Also, thanks again, Hamish. :)


Last edited by s8as8a on 10 January 2020 at 12:50 am UTC
s8as8a 10 Jan
Quoting: dpanter
Quoting: EikeDo a "locate" on the missing library.
This is the way. ^_^
Is that a reference to "The Mandalorian", by any chance? ;P
Hamish 10 Jan
Yeah, I figured it would work fine from within Steam once I saw it was a library issue rather than anything to do with the LD_PRELOAD hack. All's well that ends well. ^_^


Last edited by Hamish on 10 January 2020 at 7:08 am UTC
While you're here, please consider supporting GamingOnLinux on:

Patreon, Liberapay or PayPal Donation.

We have no adverts, no paywalls, no timed exclusive articles. Just 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!
Login / Register

Or login with...
Sign in with Steam Sign in with Twitter Sign in with Google
Social logins require cookies to stay logged in.

Livestreams & Videos
Community Livestreams
Latest Forum Posts