LCA: Linux gaming at last
At the beginning of his talk on Linux game development at linux.conf.au 2013, Eric Anholt noted that his original motivation for getting into graphics driver development was that he wanted to be able to play games on alternative operating systems. At that time, there were a few games available, but the graphics drivers were in such a poor state that he ended up working on drivers instead of playing games. Thus, he has now been working in Intel's graphics driver team for seven years; currently, he works mainly on Mesa's OpenGL graphics drivers.
Eric's talk took the form of a short review of some recent history in Linux game development followed by a description of his experiences in the Intel open source graphics driver team working with Valve Software to port the Steam game platform to Linux.
Recent history of game development on Linux
Eric started with a summary of significant changes that have taken
place in the graphics stack over the last seven years. These changes
include kernel mode
setting and improvements to memory management so that multiple
processes can reliably employ memory on the graphics card. On the OpenGL
side, things have improved considerably. "Back when I started, we
were about ten years behind
". The then-current OpenGL version on
Linux was
2.1, no modern games ran on Linux, and there was no OpenGLES on Linux.
However, by now, Linux supports OpenGL 3.1 and has reached Khronos-certified
OpenGLES 2.0 conformance, and Open GLES 3.0 certification seems to be quite close.
Development of open source games seems to have lagged. Eric suggested a number of reasons for this. One of these is that creating a game requires building a multi-talented team composed of artists, developers, and designers. It's difficult to put a team like that together. And then, even if one does manage to assemble such a team, it's hard to agree on a direction: when it comes to game design, the design space is so large that it can be difficult to agree on what you are creating. Finally, the move into open source game development means that you spend less time doing the thing you want to do: playing games.
Nevertheless, there have been a few open source games, such as etracer (Extreme Tux Racer), Neverball, Xonotic, Foobillard, and Wesnoth. In addition, there were closed source games such as Quake (later open sourced), Unreal Tournament 2004, Loki, Minecraft, and whatever users could force to run with Wine.
In May 2010, the Humble Indie
Bundle appeared. The concept was a package of games made available
DRM-free, with the user choosing the price that they would pay.
"They've actually released some surprisingly good games for
Linux.
" One of those games was Braid, and Eric noted that the developers
who participated in Humble
Bundle learned an important lesson from an earlier attempt to
port that game to Linux.
The developer of Braid, Jonathan Blow, made a blog post asking for help on how to port Braid to Linux, asking questions such as "how do I deal with mouse grabs, so that mouse clicks only go to the game window?" and "how do I output sound?" The community did try to help: in all, the blog post got 251 responses, many of them containing directly conflicting advice. In response, the developer gave up: he couldn't justify spending the time to determine the correct way to do the port for what was a small target market.
The lesson that the Humble Bundle developers learned from the Braid experience was that game developers should not be burdened with the task of porting games. So instead, they employed Ryan C. Gordon, a developer who had already ported a number of games to Linux, to port all of their games. This approach has been surprisingly successful at quickly getting games to run on Linux.
Working with Valve on the Linux port of Steam
There have been petitions for Valve Software to port Steam to Linux for as long as Steam has been around, Eric said. The Intel graphics driver team started working with Valve Software in July 2012. During the porting project, the Intel team had access to the Steam source code and worked with Valve on both tuning Steam to work better with the Mesa graphics library and tuning Mesa to work better with Steam. The closed beta test for the port was started in November 2012, and the open beta started in December. The port included the Steam's Source engine and the game Left For Dead 2.
The cooperative work between the graphics developers and Valve proved
to be quite productive, but in the process, the graphics developers learned
about a number of things that Valve found really disappointing.
The first of these disappointments concerned ARB_debug_output.
This is an extension in the Windows development environment for OpenGL that
provides a general event logging infrastructure between the graphics layer on
one side and middleware and applications on the other side. This is an
important debugging tool in the Windows environment, "where you don't really
have the console so much
". There is an implementation of
ARB_debug_output in Mesa, but it is rudimentary, supporting only two event types.
Another major disappointment concerned bad debugging and performance-measurement tools. The Valve developers described the tools they used for debugging on Windows, and wanted to know what equivalents existed on Linux. In response, the graphics developers were excited to show Valve an API-tracing tool that they had developed. API tracing is a technique that is extremely useful for driver developers because it allows them to obtain a reproducible trace of the graphics operations requested by the application. This means driver developers can get the application out of the way while they replay the trace in order to debug problems in the driver or improve the driver's performance. However, this sort of low-level tool provides little assistance for analyzing performance at the application level.
By contrast, Windows has some good tools in this area that allow the application programmer to insert tracepoints to track application steps such "starting to draw the world", "starting to draw a figure", and "starting to draw a helmet". This enables the application developer to obtain a hierarchical view of performance and determine if (say) drawing helmets takes a long time. Linux has to do a lot to catch up in this area.
The Valve developers also complained that Mesa was simply too slow. Many of the code paths in Mesa are not well optimized, with enormous switch statements containing nested conditionals. One possible solution is to offload some of the graphics work onto a separate thread running on a different core. Some work has been done in this area, but, so far, performance is no better than for the existing single-threaded approach. More work is required.
Notwithstanding the disappointments, there were other aspects of working on Linux that the Valve developers loved. For example, they greatly appreciated the short development cycles that were made possible when using open source drivers. Although the support for ARB_debug_output was poor on Linux, the Valve developers were impressed when Eric was able to quickly implement some instrumentation of driver hotspots, so that the driver would log messages when the application asked it to carry out operations that were known to perform poorly. The Valve developers were also surprised that the logging could be controlled by environment variables, so that the same driver would be used in both quiet and "logging" mode.
A final pleasant surprise for the Valve developers was that drivers could be debugged using breakpoints. That possibility is unavailable with closed source Windows drivers. More generally, the Valve developers don't have much insight into the closed source drivers that they use on Windows (or, for that matter, closed source drivers on Linux). Thus, they have to resort to experimentation to form mental models about performance problems and how to get around them.
Concluding remarks
For gaming enthusiasts, the announcement by Valve—one of the largest
producers of game software—that Steam would be ported to
Linux was something of
a watershed moment. The Linux gaming landscape is poised to grow much
bigger, and even those of us who are not gamers can reflect that a much-improved games ecosystem will at the very least widen interest in Linux as
a platform for desktop computer systems.
| Index entries for this article | |
|---|---|
| Conference | linux.conf.au/2013 |
Posted Feb 7, 2013 5:10 UTC (Thu)
by dirtyepic (guest, #30178)
[Link] (1 responses)
Posted Feb 7, 2013 7:36 UTC (Thu)
by bo (guest, #56215)
[Link]
Posted Feb 7, 2013 10:10 UTC (Thu)
by ortalo (guest, #4654)
[Link] (6 responses)
BTW, it incorporates a performance measurement approach that offers the hierarchical view suggested in the article. But that was built-in by the original developpers (press F6 IIRC).
FWIW, they are looking after SpiderMonkey Javascript optimization gurus... Yes, the game logic itself is in Javascript: nice performance testcase isn't it?
Posted Feb 11, 2013 21:58 UTC (Mon)
by anholt (guest, #52292)
[Link] (5 responses)
One of the things I forgot to mention that's really cool about working with Valve is that, thanks to it being an online service, they collect a lot of metrics. With approval for access, you can get at information like what distribution of chips is in use by valve users, or what share Linux is among their users overall. It's reminded me to give more love to the older chips than I had been, as painful as they are to work on. Things like debian's popcon package are close to this, except it doesn't get active usage information like they do (I've got neverball installed, but I sure don't play it), and each individual distro's popcon equivalent wouldn't be much information on its own.
Posted Feb 13, 2013 8:54 UTC (Wed)
by mgedmin (subscriber, #34497)
[Link] (4 responses)
This won't work if you've got the filesystem mounted with noatime, but it will work if you use relatime.
Posted Feb 13, 2013 19:54 UTC (Wed)
by anholt (guest, #52292)
[Link] (3 responses)
2231 gnuchess 44230 1890 35622 6677 41 (Oliver Korff)
If I try to filter for things I know of as being "GL games":
2857 yakuake 2305 1145 1047 113 0 (Ana Beatriz Guerrero Lopez)
It's interesting to see the long tail of games being run. I'd be interested in some of the time-spent information you get out of steam, and whether this is just 68 people having run all these games for testing or if many people are playing different stuff, but it's at least more information than I thought we had. It'll help me balance priorities of bugs among these games.
None of this GL stuff is as popular as solitaire, though.
Posted Feb 13, 2013 20:03 UTC (Wed)
by andrel (guest, #5166)
[Link]
Posted Feb 14, 2013 11:15 UTC (Thu)
by micka (subscriber, #38720)
[Link] (1 responses)
Posted Feb 14, 2013 16:22 UTC (Thu)
by anholt (guest, #52292)
[Link]
Posted Feb 7, 2013 10:19 UTC (Thu)
by ortalo (guest, #4654)
[Link]
Yep, that's real money so it can be put on the table. But kids are extremely strict on delivery in case you don't know... ;-)
Posted Feb 7, 2013 16:31 UTC (Thu)
by dashesy (guest, #74652)
[Link]
Posted Feb 9, 2013 2:20 UTC (Sat)
by el_presidente (guest, #87621)
[Link]
Posted Feb 9, 2013 2:42 UTC (Sat)
by hamish (guest, #6282)
[Link] (1 responses)
Yes, I know about multi-arch and chroot installs - I'm sure I could get it working, but that was not the source of my annoyance.
I had a look around and found a vague comment from last August where valve says "...will run on 64-bit Linux later", so perhaps all is not lost for those of us running 64bit systems (which I assume is almost everyone - certainly anyone with a recent gaming-capable computer should be running 64bit, otherwise they would probably be experiencing issues with physical memory address space)
Since this was not mentioned in the article (nor in the talk, so this is not an omission), this quick note might inform people - before they run off to install Steam...
Posted Feb 12, 2013 12:55 UTC (Tue)
by ssam (guest, #46587)
[Link]
Posted Feb 11, 2013 6:33 UTC (Mon)
by Lumag (subscriber, #22579)
[Link] (1 responses)
Posted Feb 14, 2013 19:35 UTC (Thu)
by obrakmann (subscriber, #38108)
[Link]
Posted Feb 14, 2013 9:25 UTC (Thu)
by kragil (guest, #34373)
[Link]
Funding games via Kickstarter is all the rage now, that is really good for Linux gaming.
Sure Steam, Humble Bundle and middleware like Unity (the game engine) and Moai also helped a lot.
2013 will surely be the year of Linux gaming ;-)
LCA: Linux gaming at last
LCA: Linux gaming at last
http://mirror.linux.org.au/linux.conf.au/2013/ogv/ (ogv)
http://mirror.linux.org.au/linux.conf.au/2013/mp4/ (mp4)
LCA: Linux gaming at last
LCA: Linux gaming at last
LCA: Linux gaming at last
http://popcon.debian.org/FAQ
LCA: Linux gaming at last
2810 aisleriot 15285 1187 10572 3525 1 (Josselin Mouette)
2857 yakuake 2305 1145 1047 113 0 (Ana Beatriz Guerrero Lopez)
3390 mahjongg 15024 755 10618 3466 185 (Josselin Mouette)
3424 kpat 7550 738 6137 669 6 (Debian Qt/kde Maintainers)
3604 gnome-sudoku 15110 658 10807 3644 1 (Josselin Mouette)
3628 chromium-bsu 1638 647 835 156 0 (Debian Games Team)
3669 gnomine 15078 633 10814 3629 2 (Josselin Mouette)
3771 glchess 14897 590 10799 3506 2 (Josselin Mouette)
3789 blinken 6667 581 5651 432 3 (Debian Qt/kde Maintainers)
3810 gnibbles 14731 574 10652 3503 2 (Josselin Mouette)
3825 lightsoff 14069 569 10014 3485 1 (Josselin Mouette)
3859 glines 14795 557 10723 3513 2 (Josselin Mouette)
3896 khangman 6644 548 5644 450 2 (Debian Qt/kde Maintainers)
3922 quadrapassel 14768 540 10696 3530 2 (Josselin Mouette)
3941 kanagram 6633 534 5648 448 3 (Debian Qt/kde Maintainers)
3955 gnect 14814 531 10752 3529 2 (Josselin Mouette)
3628 chromium-bsu 1638 647 835 156 0 (Debian Games Team)
3771 glchess 14897 590 10799 3506 2 (Josselin Mouette)
4574 supertuxkart 1847 377 1331 139 0 (Debian Games Team)
5285 openarena-data 1354 273 925 141 15 (Debian Games Team)
5466 extremetuxracer 2231 251 1859 120 1 (Debian Games Team)
5554 wesnoth-1.10-core 1200 246 831 122 1 (Debian Games Team)
7056 torcs 1142 142 934 66 0 (Rudy Godoy)
7157 nexuiz 842 137 647 56 2 (Debian Games Team)
7208 0ad 759 134 535 90 0 (Debian Games Team)
7446 warzone2100 859 125 685 47 2 (Debian Games Team)
29 sauerbraten 546 103 419 23 1 (Debian Games Team)
8830 bzflag-client 720 83 592 45 0 (Tim Riker)
9497 gl-117 500 71 396 32 1 (Cédric Delfosse)
9077 billard-gl 648 78 529 40 1 (Debian Games Team)
9562 foobillard 619 70 513 35 1 (Debian Games Team)
31 assaultcube 261 68 169 24 0 (Debian Games Team)
...
There is also Ubuntu Popcon which seemingly has a larger pool of contributors.
LCA: Linux gaming at last
LCA: Linux gaming at last
LCA: Linux gaming at last
Economical remark LCA: Linux gaming at last
And I may save a *lot* more in the forthcoming years if the kids agree...
LCA: Linux gaming at last
Another major disappointment concerned bad debugging and performance-measurement tools.
I am wondering what performance measuring tools they use on Windows, and if paying is an option then why "Intel VTune" or "AMD Catalyst" could not fit the bill. It would be really educating if they can try different ones (including open source KernelShark). Since gaming is very demanding an overview on performance measuring techniques on Linux will be helpful for all of us.
LCA: Linux gaming at last
Installing Steam for Linux
Installing Steam for Linux
LCA: Linux gaming at last
LCA: Linux gaming at last
Really disappointing.
LCA: Linux gaming at last, thanks to Kickstarter
