Jump to content

Linux Beginner guide - mesa_glthread. Boost your performance today!


BigBadBeef

Recommended Posts

Hello everyone,

I know that there is a considerable population of Linux users among you. In collaboration with this forum's staff and and querying of many Linux enthusiasts across the spectrum on the world's largest Linux forum, I bring to you this detailed Linux guide for enabling mesa_glthread in Vintage Story.

 

What is mesa_glthread?

In layman's terms, mesa_glthread is a custom argument under which you can run Vintage Story that will fully enable your computer's multi threading capabilities to be exploited by the game. It will make the game run faster, more stable, and let your computer be more quiet.

 

Should I enable it? Why?

Absolutely! We are talking about 5-15% increase of performance in general, with up to 15% reduced frame drops in more demanding areas, 50% (FIFTY PERCENT) reduction in stutters and jerkiness (though in my own personal case its even more), reduced load on your computer and I have been led to believe it even reduces the impact that you, as Linux player makes on the server you are connected to, though I cannot confirm or deny that.

 

Why am I doing this?

If you direct your attention to the current (soon to be old) Linux guide (https://wiki.vintagestory.at/index.php/Framerate_and_Performance#For_Linux_users ) , you will notice that it is very weigh and it asks simply to put one command into the terminal. The problem is that it does not work for many people, I'm even being told that it isn't working for almost anyone at all, the terminal will return to you a message something in the lines of what you can see here:

229866201_RejectedCommand.thumb.png.9a76bca0a380ccfb615e3ff8bf2fff77.png

The error message

The reason I'm doing this is because I like the game and want to support the developers through the knowledge I possess. They are doing a tremendous job with very limited resources so in accordance with the holiday spirit, I would make my knowledge available to all who have need of it.

 

Is it hard?

Not at all. It is simply contingent on the fact that you follow the instructions posted below. It is a set of instructions tailored to a beginner, helpful to a wide variety of Distros, and if you managed to acquire all the prerequisites and got the game to run, you should have no trouble getting this to run as well. I will post a guide to this in 2 parts. One is the visual method, and another is the terminal method. Both are a reliable way to get what you want. While the former will have some variation that will require you to "find your way" a bit, the latter in universal and should be able to work regardless of what version of Linux you have.

 

Before we begin, a few disclaimers:

  • Your experience may vary.
    The performance figures posted above are AVERAGES. If you meet the game's minimum requirements, your improvement may be minimal. Its not a miracle solution, but it has been known to help many people a lot.
  • Meant for beginners, but not absolute beginners.
    This guide is contingent on the fact that you have sufficient knowledge to have installed all Vintage Story's prerequisites for Linux and have actually gotten it to play successfully. If you don't know how to that, you may need to take a step back. There are many guides available online on how to get Vintage Story's prerequisites installed, and those will really help you get a feel to just how Linux works.
  • Visual method may require some critical thinking.
    Linux, at its core, is the same for all distributions, however from distro to distro (that is the version of Linux you're using) it will look different. When asked to do a specific thing, you may need to look for an equivalent that may or may not be on the same place or not quite look the same. It will be helpful to you if you were to exercise some resourcefulness in regards to being asked what to do.
  • On certain rare occasion, there may be issues.
    Running Vintage Story under mesa_glthread may see your Linux Distro running it as a different user. What this is means is that you may be asked to log in to your account again (hope you haven't forgotten your password), your settings have been reset to default and you may no longer see your savegames. Do not panic. If this happens, you can simply run Vintage Story in the way you did previously, open your save folder, copy it, and then paste it when running Vintage Story under mesa_glthread. Other bugs may also appear, some different bugs that are unique to your computer may actually vanish! There are also some of for whom the game may not run at all. These reports are being investigated and we will if a solution can be implemented.

 

 

THE VISUAL METHOD

STEP 1: SEARCH FOR VINTAGE STORY ON YOUR HARD DRIVE

You will need to find where exactly has your Linux put the folder to where Vintage Story is located. The issue lies here that there are multiple methods of installing Vintage Story on Linux, and each one puts it in a slightly different location. Simply open your file browser and search for "Vintagestory.exe".

197042847_TheVisualSearch.thumb.png.5f0caefe61f62a3ae8a83f4b74a03583.png

In my case it is a simple magnifying glass, and in most beginner Linux Distributions, it will be a similar experience. Some of you may have it identical, some of you might have the magnifying glass somewhere else. Some of you may have it similar to windows. Feel free to exercise some independence when looking for the file. Note that uppercase and lowercase letters should be matched precisely when searching.

Once your search is completed, and it is done correctly, the search should a single file as seen on the image above, along with the path to where it is. If you are unable to locate the search function, then I recommend you go for the Terminal method, which is posted below.

 

STEP 2: GO TO THE FOLDER WHERE THE FILE IS LOCATED

Right-click on the file in question. Open the item location. In your case it may say something else, something similar. Once again what the actual option given may vary a bit from person to person, but if you have done it correctly, this is what you should see:

2002853773_Vintagestoryfolder.thumb.png.1debbfb53ed675fb128389ea640bb0d7.png

Vintagestory.exe has to be among the files. In my case its the fourth from the right in the third row.

If you do not have the option of going directly to the path of the file you've searched for, then open another file browser and manually go to the path listed listed in the search results and you will find your way there. At this step, it would be helpful for you to mark this folder. Add it to your favorites, pin it to the file explorer, make it however you can so you can easily find it the next time, because these steps have to be repeated each time you want to play the game. There is an advanced way you may be able to instantly perform all these steps, but as a beginner, its a temporary inconvenience.

STEP 3: NOW WE RUN IT!

Now comes the awesome part. Don't be afraid, just please be a bit careful and be precise: Right click on an EMPTY SPACE INSIDE THE FOLDER. You will have one of the three following as an option: "Open in Terminal", "Open Terminal Here" or "Open as Root". Whichever option you have, click on it! This is what you should see:

698863963_VisualTerminal.thumb.png.eff559383593eb9a8f0c4ea545dbfdca.png

A terminal windows will pop out, pointing the path to where Vintage Story is located, which is EXACTLY what we wanted.

Now is the time to execute the command from the old guide:

Quote

mesa_glthread=true mono Vintagestory.exe

Press enter. After an intense burst of technical data in the terminal, Vintage story will run and mesa_glthread will be enabled!

1993165609_VisualResult.thumb.png.c60a872e011a552936677f86c3adcd74.png

This is what you will see just before the game will launch. do not be alarmed, there will be no explosions in your pc. Well, if you have the latest nVidia graphics cards, there may be some explosions at your energy provider's power plant. You know what these cards are like, just now, we've unshackled it for this game as well. Enjoy!😉

 

 

THE TERMINAL METHOD

STEP 1: FIND THE FILE

We will be doing the exact same as with the visual method, except we will be typing everything out instead. While the visual method may vary from Distro to Distro, the terminal method is universal. You will have no trouble finding the file, but you must be more precise in following the instructions. It all begins by you opening the terminal.

Type in the following command in the terminal:

Quote

find . -name Vintagestory.exe

Feel free to just copy - paste the code into your terminal. If this command doesn't work, try substituting it with:

Quote

find /home/[USERNAME] -name Vintagestory.exe

Where you substitute [USERNAME] with however you named your Linux account to be. I am displaying the results of both commands sequentially, so that you can see that in both cases it will show you the path to where Vintagestory.exe is located:

621905769_TerminalSearch.thumb.png.90d3b1fe5856cbc78cf7235d356c87e6.png

As you can see, both commands show you the same result. Whichever you choose, you will see only one.

 

STEP 2: MOVING THE TERMINAL POINTER TO THE FOLDER

Before I tell you how to do that, let me share with you something cool - You can use the information obtained from the terminal and find the folder yourself using the visual method and continue from there! Perform STEP 2 from the VISUAL METHOD and continue there if you wish, but if you wish to remain in the terminal, then this is what you do:

If able, select the path that has been output by the terminal, everything except Vintagestory.exe. Just pull the mouse over it until it is colored. Then Right Click and Copy the text. Type the following in the terminal, but DO NOT press enter:

Quote

cd

also add a spacebar, then right click and paste the code. Now you can press enter. This is what you should see so far:

1146979944_TerminalCD.thumb.png.d7f6ef5af39d3a1685fa4a7d34a92fa5.png

If done right, it will simply "go" there, there will be no error message, and no objections. We are now, as we were in step 2 of the visual method, once again located within the folder where Vintage Story is installed.


If there is any problem whatsoever, please double check everything before asking for help regarding this. Have you typed a spacebar after the cd command? Have you selected the entire path before copying? Linux will do EXACTLY what you tell it, it is both a virtue and a fault. The terminal requires accuracy and attention to detail.

 

STEP 3: LETS RUN IT!

All that is left to do is to execute the command

Quote

mesa_glthread=true mono Vintagestory.exe

and just like in the visual method, there will once again be a burst of data just before the game will launch. As to how it looks, defer to STEP 3 of the visual method if you're curious.

 

 

A FEW IMPORTANT NOTES AND HELPFUL TIPS

As I said before, you will have to repeat these steps each time you want to play vintage story. I know, its tedious, but in the visual method, most Linux Distros will have the option for you to pin the folder for you to easily open it the next time. And for the terminal method, once you have copied the code, you can also paste it in a text file. In both cases you can begin any successive play session with step 2 outright. Once your knowledge of Linux advances, you will have the ability to create a script that will instantly perform these actions.

In order to maximize performance, be sure to disable vsync and set your maximum framerate to be no more than 50% higher than your minimum framerate to ensure a smooth, steady gameplay. If you want to know what your framerate is, press Alt+F3 in the game itself and it will display the whole graph for you.

 

I have nothing to say to you except congratulations! You have unleashed the full power of your pc at Vintage Story.

507931778_Unlimitedpower!.jpg.54c26afe9d6f0344e0f1942670138ce4.jpg

 

If there are any questions or problems, please, don't hesitate to submit them below!

Edited by BigBadBeef
  • Like 3
Link to comment
Share on other sites

Hi,

nice description. Can you send you system specification (e.g. inxi -F)?

I testes it earlier and you have to be careful with it.

14 hours ago, BigBadBeef said:

Should I enable it? Why?

Absolutely!

Be careful with it, it can work, but not always. It worked for me before, but I have had some freezes in menu.

My graphics system:

Spoiler

 OpenGL: renderer: AMD Radeon RX 580 Series (polaris10 LLVM 13.0.1 DRM 3.42 5.15.0-56-generic)
   v: 4.6 Mesa 22.0.5

Right now, game is not starting, it let me stuck in loading screen.

 

15 hours ago, BigBadBeef said:

Why am I doing this?

If you direct your attention to the current (soon to be old) Linux guide (https://wiki.vintagestory.at/index.php/Framerate_and_Performance#For_Linux_users ) , you will not notice that it is very weigh and it asks simply to put one command into the terminal. The problem is that it does not work for many people, I'm even being told that it isn't working for almost anyone at all, the terminal will return to you a message something in the lines of what you can see here:

This description should contain, that it is about adapting the vintagestory.desktop
E.g.

image.png.24f4dfc78682e76d7f41f5d94506fa74.png

  • Sad 1
Link to comment
Share on other sites

To those that are a bit more versed in Linux, can also try the following code, supplied by the user JasKinasis from the Linux.org forums:

Quote
cd $(dirname $(find ./ -type f -iname "Vintagestory.exe") )

It will let you merge steps 1 & 2 from the terminal method. However this is a more advanced way of doing it, not fit for a beginner. As any responsible Linux advocate, I always state that you should not blindly copy code into your terminal unless you know exactly what its doing. My way contains very short commands that are easy to understand and simple to get a grasp on.

Link to comment
Share on other sites

  • 2 weeks later...

I like my install to be somewhat "portable" so I have easy access to the folders. So I just...

image.png.d40bd102fe7c3036a408d4d9e8526ca3.png
I mean, it should work, right?

edit: Even if I just run it through the command line, the game freezes after a few seconds even before I open any map. Be it the mod screen, the worlds screen... Sad.

Edited by Azuli_Yanazake
Link to comment
Share on other sites

  • 3 months later...
mesa_glthread=true mono Vintagestory.exe 

This starts the game and loads the main menu but it appears to be frozen. I'm on MX Linux with an AMD Ryzen 5 CPU and Ryzen 570X graphics card and 16gb RAM. The only issue I've experienced is a little stuttering when lots of vegetation is being drawn which is why I thought this might be worth a try.

Edited by Bastez
Link to comment
Share on other sites

I can't resize or move the game window when it's launched with mesa_glthread=true. The game window turns black and hangs, process requires SIGKILL. Window size must be set manually in config file. The game itself seems playable though.

Running SteamOS 3.4.6 on Steam Deck.

Link to comment
Share on other sites

It might be helpful if everyone experiencing the crashes run an trace on it or post some crash/error logs, if possible. Any lockups or even crashes could be caused by simple issues that become hidden by other means, such as corrupted driver installs or missing dependencies, which usually end up being something like lib32-mesa. For example, a bad/corrupted install or outdated Mesa package could cause the hangups/crashes. 

Link to comment
Share on other sites

  • 2 months later...
On 8/3/2023 at 7:12 PM, dotyerts said:

As part of the linux server.sh file on a hosted service, adding this in to the invocation works

image.png.6abbbb3a41daa8a45052c0c356bb07b2.png

But the server doesn't even render the game with OpenGL. This will have absolutely no effect.

  • Sad 1
Link to comment
Share on other sites

  • 3 months later...

As of the few most recent patches, my method of deploying glthreading doesn't seem to work. I am currently investigating alternatives, suitable for the linux terminal, in the meantime, I would request all those that are knowledgeable to share the method they use for their distro if they are so willing.

I seem to have also noticed improved performance without it. There is the possibility that it may be obsolete to use it at all.

Edited by BigBadBeef
Link to comment
Share on other sites

  • 2 weeks later...
  • 5 weeks later...
On 11/21/2023 at 8:38 PM, l33tmaan said:

I'm actually going to be building a new computer and installing Linux on it, since I cannot stand the thought of moving to Windows 10 or 11 if I can avoid it. Do I have to worry about a good distro that works with Vintage Story and Steam, or am I probably fine?

Hey there! Its been a while since I was here. Just saw your post. Vintage story is natively supported on Linux. Hell, its even present in my Distro's app repository and its a one-click download. As long as you install all the necessary prerequisites for Vintage story on Linux, you're good to go. Steam, as the app in and of itself, is also natively supported on most Linux Distros. As for the games you run on Linux - its a bit more complicated. If you really need to know, then you can PM me, and I'll explain it to you.

The problem you may or may not encounter is whether your pc would be TOO new. For linux, new stuff doesn't work out of the box in many cases as there is no close collaboration between open source Linux devs and home pc hardware manufacturers to secure compatibility for the newest hardware in advance. Linux needs some time to catch up for complete support of the new hardware, and that costs varying amounts of time, depending on the distro of your choice.

Edited by BigBadBeef
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.