This is part 2 of a long rant that should I have written in smaller, more frequent updates, over the past year or so. In part 1, I described the Linux laptop that is the subject of the rant you are about to experience. It is worth a read.
I have been using the aforementioned laptop for game development because I want to see how far I can push it. It is by no means a powerhouse; it has a modest Intel Core i7 at 2.4 GHz with 6 GB RAM and an NVIDIA Quadro NVS 4200M video chip. The main CPU can be clocked faster than 2.4 GHz, but then it runs disconcertingly hot. The graphics chip is meant for business, not games. Yet, I accept the modest specs because I am making a game with the simplest graphics possible.
But now, I am encountering problems with my graphics rendering that I hadn’t noticed before, because until now, I hadn’t been concerned with graphics performance.
In troubleshooting, I found that, as usual, there are a number of different ways to get graphics working on Arch Linux with an NVIDIA graphics chip. Those links only point to the graphics drivers themselves. They do not relate to the graphics standards that software/games might be built with. In Linux, the options are, essentially, OpenGL (which has been around forever) and now Vulkan (which is new, circa Feb 2016).
If you looked at the content behind the links (though you weren’t expected to), you probably saw instructions to install mesa-libgl or nvidia-libgl, depending on which driver is installed. Those libgl packages contain different implementations of the OpenGL standard. mesa-libgl is open-source; nvidia-libgl is NVIDIA’s proprietary package.
Apparently, the two packages behave differently…
(As an aside, I mentioned before that my game engine is based on OpenGL. Therefore, now that Vulkan is here, I am technically using outdated technology. That is ok for now, because that outdated technology is well-established and well-supported. The point is: Even though I am aware of Vulkan’s existence, I will focus on OpenGL for the purpose of this rant. One day in the future, I may write a different rant about Vulkan + Linux.)
My 2D game with runs smoothly with mesa-libgl, as it should, because the graphics are rectangles and circles. For reference, it looks like this:
However, with mesa-libgl, more fully-baked games (i.e., some Steam-powered games, and especially 3D games) run like a snail sliding on a molasses.
On the flipside, when I install nvidia-libgl, Steam games, other 3D games, and for that matter, other 2D games that aren’t mine, run perfectly. But with nvidia-libgl, my game runs like a turtle climbing a mountain.
Here is a clip of the exact same game, running with nvidia-libgl installed, instead of mesa-libgl. Nothing else has changed, and the video is not doctored in any way:
I am not exactly sure what is causing the performance discrepancy. I will investigate it, figure it out, and report back.
Problems like this highlight my computer’s status as a bad game development machine. Every now and then, I have to spend an awful lot of time troubleshooting issues that are not related to the game itself. But, because I am a
badass masochist, I wouldn’t have it any other way.
Mass KonFuzion out.
P.S. I hope this blog is detailed enough for experts, but accessible to beginners. Basically, if my wife can follow along, I’ve done a good job. But if you think I’ve done a bad job, let me know in the comments.