# Lutris the Open Gaming Platform
by Seth Kenlon

If you use Linux and enjoy playing video games, then you probably
agree that life has been pretty good lately. Valve, Unity, Unreal
Engine, and other big-name forces have pulled the video game industry
into Linux compatibility so thoroughly that if you use Steam, you
likely own more Linux-compatible games than you have time to play (and
with [Proton and Steam Play](https://github.com/ValveSoftware/Proton),
that number's about to increase). If you're a fan of indie games,
[Itch.io](Itch.io) and a wide variety of game sprints, such as the
[Open Game Jam](https://itch.io/jam/open-jam-2018), are making it
trivial to find truly excellent games for Linux. Vendors like
[GOG.com](http://gog.com) and [Humble Bundle](http://humblebundle.com)
offer lots of games both new and old. And finally, there are plenty of
games in your distribution's repositories, and game emulators for old
consoles, and online games.

For the first time in a long time, Linux users have an embarrassment
of game wealth, and that poses a question: how do you manage it all?
The open source answer is [Lutris](http://lutris.net).

![The Lutris desktop client](lutris.png)


## Lutris desktop client

Lutris is an open source desktop client to help you manage your
diverse game library. No matter what form a game takes, if it's on
your computer, it can be added to Lutris. And that means when you want
to play a game, you don't have to remember whether the game's
installed to **~/GOG Games** or **~/Games** or to your application
menu or to **/usr/games** or if it only exists in a browser, or if
it's in Steam, or needs to be launched in an emulator. All your games
are in one place: your Lutris app.


## Installing Lutris

Lutris is probably available from your software repository, but if it
isn't, you can download it directly from
[lutris.net/downloads](https://lutris.net/downloads) as a tarball. For
more information on installing applications on Linux, see [How to
install software applications on
Linux](https://opensource.com/article/18/1/how-install-apps-linux).


## Adding games from lutris.net

Technically, you don't *install* games with Lutris, you only add
them to Lutris, although Lutris can assist you in the install in some
cases.

You have several different ways to add games to your Lutris library.


### Adding a game from Lutris.net

The easiest way to add a game to your library is to leverage the game
library on [lutris.net/games](https://lutris.net/games/). Search for a
game you own, and look at its available installers. Many games have
several means of installation, depending on how you purchased them in
the first place. For instance, if your purchased a game in a [Humble
Bundle](http://humblebundle.com), use the **Humble
Bundle** installer, but if you purchased it from
[GOG.com](http://gog.com), use the **GOG** installer.

When clicked, the lutris.net installer file is opened in Lutris, and depending on
the installation method, you may be asked to point the installer to
the install file you purchased. Lutris takes care of the rest,
installing the game to **~/Games** by default (the location of your
game installs can be modified in Lutris's preferences).

If the game you're installing is available without login or purchase,
then Lutris downloads the game and installs it without intervention.

If the game you're installing cannot be obtained over the network,
then Lutris prompts you to locate the game's installer file, and then
proceeds with installation based on the local file you pointed it to.

Once installed, the game's banner is added to your Lutris client,
ready for you to launch and play.


### Importing games

If you already have games on your system before installing Lutris, or
you just find it easier to manually install a game, you can always add
the game manually to Lutris.

![Manually adding a game](add.png)

First, click the plus (+) icon at the top of the Lutris window. In the **Add a new game** window that appears, enter the name of the game you're installing. This is for reference only; it's the label that will appear in your Lutris client under the game's banner.

Lutris, like the Linux system running it, has the capability of running games written for several different platforms, not just Linux. "Runners" is what Lutris calls the subsystems used to run games; if you're installing a game native to Linux, then select the Linux runner.

Next, select the **Game options** tab at the top of the **Add a new game** window. Here, you must show Lutris where the launchable game (the game's executable file) is located. In many cases, the file you're meant to launch is a shell script, often called **start** or **launch** or similar, that sets important environment variables and library paths so the game runs as expected. Other times, the game is meant to be launched directly. If you're not sure, test it before entering it into Lutris (although you can always edit the entry later if you do make a mistake).

![Configuring launch options](add1.png)

All other fields are optional and largely depend on what the game provides. For instance, some games can be launched with a **--fullscreen** or **--windowed** argument to control whether it launches fullscreen or in a window, so you could enter your choice in the **Arguments** field to control how Lutris starts the game.

Once a game has been added, it appears in your library with a generic game banner. To customize a game banner, right-click and select **Configure**. In the **Configure** window that appears, you can add your own banner, icon, and edit launch properties. If you don't have a game banner, you can find community collectios on http://www.steamgriddb.com/ and other similar sites.


## Runners

One of the killer features of Lutris is its seamless integration of different gaming systems into one client. You Lutris library can contain native Linux games peacefully coexisting alongside of old NES games and Windows games running in WINE or games you've purchased on Steam.

To see what emulators and subsystems Lutris provides, go to the File menu and select Manage Runners. This window lists every emulator available for Lutris, and even installs it for you. Once you install a runner, it's available as a launch option when you add a game.

![Selecting a runner](runners.png)

Note that most emulators cover a whole host of different systems, and most require separate configuration for keyboard controls. And of course Lutris doesn't provide any games that run in the emulators, so if you want to play Super Mario Bros. or Sonic or any other classic title, you must own the ROM file (extracted from a cartridge or disk) yourself, but there are some very good open source homebrew games for emulated platforms that you can and should check out, including [POWDER](http://www.zincland.com/powder/index.php?pagename=about), [Warcraft Tower Defense](https://ndswtd.wordpress.com/), and [XRick](https://pdroms.de/nintendods/xrick-v2-0-nds-game-port).


## Writing your own installer

There are a lot of game install scripts on lutris.net, but there are also a lot of games out there in the world. If you find that a game isn't listed on lutris.net yet, you can write and share an installer of your own.

Since it's all open source, you can learn from existing installers. Go to the lutris.net website and pick a game, then click the drop-down arrow on the right of the game's install button and select **View install script**.

Installer files are written in YAML, a simple configuration file format. The scripts tend to be pretty simple, since all they normally have to do is invoke built-in Lutris functions. Here is a simple install script for an imaginary game called myGreatGame:

   exe: myGreatGame
   files:
   - file1: 'N/A: Select the ".run.bin" install file downloaded from http://humblebundle.com'
   installer:
   - chmodx: $file1
   - execute:
       args: --destination=$GAMEDIR
       file: $file1

The `exe` designation sets the name of the executable file. It's the equivalent of setting the executable field when manually adding a game in the Lutris client.

The `file` attribute is unknown, because the installer file is located somewhere on the user's computer. If the file could be downloaded from the Internet directly, then a URL would be provided here, but as it is, Lutris will prompt the user to find the installer file. The variable $file1 stores a reference to the file.

Finally, the file from the previous step is granted executable permission so that the launcher itself can be started by Lutris. An argument is added to ensure that the game is installed in the appropriate destination (the `$GAMEDIR` variable represents the default game directory as defined by the user), and the installer to launch is set to the file that was downloaded.

From Lutris's perspective, an install process is, and should be, limited. Ideally, an install script only has to point Lutris to a file, grant the file permission to run, and then run the file. Lutris takes care of everything else.

Installer scripts can be a little more complex, if necessary. For instance, sometimes a game ships with both a 32-bit and 64-bit version, and so your installer script should know which version the user intends to launch. There's nothing built into Lutris to take care of that, so here's a version of an installer than creates a special start.sh file to detect the system architecture and then launch the appropriate version of the game accordingly:

   files:
   - file1: N/A:Please select the Humble archive
   game:
     exe: $GAMEDIR/start.sh
   installer:
   - chmodx: $file1
   - extract:
       dst: $GAMEDIR
       file: $file1
   - write_file:
       content: '#!/bin/sh if (uname -m | grep "64"); then ARCH="x86_64"; else ARCH="x86";
         fi; ./myGreatGame_$ARCH.bin'
       file: $GAMEDIR/start.sh
   - chmodx: $GAMEDIR/start.sh

Once you've written an installer, you can submit it to lutris.net so other players can benefit from your hard work.

## Gaming on open source

Lutris isn't exactly a must-have application, but it sure is nice to
have. It gives you the freedom to manage your own library the way you
want it managed, and it helps you rediscover games you have squirreled
away in some forgotten niche gaming folder. It's open source and a lot of fun to use, so give
it a try!