Lutris: Gaming on the ODROID-H2

For about twenty years, the Linux community kept trying to make the current year "the year of the Linux desktop" - a mythical time when Linux desktop popularity would surpass Windows. Unfortunately, it has not happened yet, but at least in one aspect Linux is gaining popularity: gaming support. With the advent of Wine, Steam and Vulkan, more and more games are becoming playable on Linux systems, releasing gamers from the dreaded Windows Update cycle of death. Please note that Linux gaming is not something for the novice Linux user (yet), but hardened users might enjoy setting up the environment more than playing games.

This article will take a look to see what is needed to set up a basic gaming system on an ODROID-H2, which are available in the Hardkernel store at https://www.hardkernel.com/shop/odroid-h2/. As you know, the ODROID-H2 is based on Intel architecture and can play many more games than the ODROID-XU4. We will see just how far we can go. Note that since the ODROID-H2 is not a true "gaming PC", do not expect miracles, but it can run some 5-10 year-old games with decent performance. Unfortunately, Linux will suffer some performance degradation when running Windows games since the various adaptation layers add some system overhead.

Introducing Lutris

Lutris is an open source gaming platform for Linux that can install and launch games reducing the setup hassle. It can get games from online platforms like GoG, Steam or Battle.net, but can also manage games for various platforms (from Amiga to DOS, Windows, native Linux or Browser games). The platform has various scripts that take care of downloading your desired game and applying the needed patches/changes to make it run as best as possible. You can browse a list of supported games on their website https://lutris.net/games/, or search for a game title in the application.

Installation instructions are available at https://lutris.net/downloads/. The steps depicted are run on a stock Ubuntu 19.04 image running on ODROID-H2. Video instructions are available at https://youtu.be/oHDkeQ9eDrc.

$ sudo add-apt-repository ppa:lutris-team/lutris
$ sudo apt-get install lutris
While you are in the shell, you should also install Wine if you plan on running Windows games (I used the standard Ubuntu version):
$ sudo apt-get install wine
Some games may require different Wine versions (or proton-enhanced Wine), but you can install those from within the Wine Runners section inside Lutris. Each Wine can have its own environment (called Bottle) so that multiple versions can coexist.

For Windows games, you can install an extra translation layer called DXVK which does the translation from DirectX 11 to Vulkan. First of all, you need to install the Vulkan drivers:

$ sudo apt install mesa-vulkan-drivers mesa-vulkan-drivers:i386
You can also install vkmark which is a benchmark for Vulkan similar to glmark. Running it should prove to you that vulkan support works as expected in your Ubuntu system. The tool needs to be compiled, so you can follow these steps:
$ sudo apt install meson libvulkan-dev libglm-dev libassimp-dev libxcb1-dev libxcb-icccm4-dev libwayland-dev libdrm-dev libgbm-dev git
$ git clone https://github.com/vkmark/vkmark.git
$ cd vkmark
$ meson build
$ ninja -C build
$ sudo ninja -C build install
You can now run vkmark and see the demo rendered with the Vulkan API.

Figure 1 - Vkmark in action
Figure 1 - Vkmark in action

The Vulkan API can now be used by Linux applications that know how to use it. Now we can add the DXVK translation layer (https://github.com/lutris/lutris/wiki/How-to:-DXVK), which is as easy as typing the following command:

$ sudo apt-get install dxvk

Lutris management

Now that we have everything set up, we need to add games to Lutris. You can start Lutris, or browse their Web site, find a game you want to install, and click Install. You should also manage your runners, which are enable external programs that are needed to run emulated games. You can click on the Lutris icon (top left) and select "Manage Runners". From the list, you can enable the platforms that you want to use (for example DosBox, ScummVM, Wine, etc). From here, you can also configure various options specific for that runner.

Figure 2 - Manage runners
Figure 2 - Manage runners

We can now download and install some games. Let us start with something simple: a native linux game like Super Tux Kart. You can search for the title in the Lutris search bar, highlight it and click Install. The installer will prompt you for some questions, so answer as best you can.

Figure 3 - Super Tux Kart
Figure 3 - Super Tux Kart

Once the installer finishes, you can launch the game from the menu.

Figure 4 - Super Tux Kart - playthrough
Figure 4 - Super Tux Kart - playthrough

Note that, even if the game runs smoothly, on the ODROID-H2 some textures are glitchy, which are probably due to the Intel drivers implementation. At least installation was smooth.

To install something from GoG for example, you need to log into GoG via Lutris. First search for the desired GoG game (e.g. Tyrian2000). You will be prompted for your GoG credentials and then the game will be downloaded and installed seamlessly.

Figure 5 - GoG installation
Figure 5 - GoG installation

Let us now try something more taxing that your average ODROID-XU4 cannot do. In order to install Steam games (either Linux or Windows), you first need to install the Steam client:

$ sudo apt-get install steam

You can install Steam games in two ways - either through Steam, or through Lutris. For the first method, you should start Steam and log in with your account and you can go to your game library and install a game locally. Once it is installed, you can return to Lutris and add it to the launcher by selecting "+" -> Import Games -> Steam. Tick the game/games you want to import and select Import Games.

I installed Team Fortress 2 (which is free on Steam) directly from Lutris, by searching for it in the Lutris search tab, clicking install and waiting for it to finish. The game ran fine (as expected) under Linux.

There may be cases where you have a local copy of a game (from a backup or an original install media) that you want to install, or maybe you want to install an unsupported game (or legally challenged one). You can do that too. In my case I wanted to install the Windows version of Lucas Chess (https://lucaschess.pythonanywhere.com/). The steps are as follows:

Download the installer

Inside Lutris, select "+" -> Add game. Give it a name and select the correct runner for that game. In my case, it was wine.

Figure 6 - Add manual game
Figure 6 - Add manual game

Under the Game Options tab select your installer executable inside the Executable field. You probably do not need to add any arguments. Wine prefix is usually set inside ~/Games/GameName and will hold the wine environment and game data. Ideally it should not overlap with other games.

Figure 7 - Game options
Figure 7 - Game options

Under the Runner Options tab you can select the wine version that you want to use (you can install several wine versions from Manage Runners -> Wine). You can also activate DXVK support if you need it.

Figure 8 - Runner Options
Figure 8 - Runner Options

Click save and you can now use the new entry to run the installer. The installer should go on as if it were running in Windows, and when it finishes, you'll need to edit the game launcher (press the Configure cogwheel symbol next to Play), go back to Game Options and change the executable to point to the installed game instead of the installer (you can browse for the game executable).

If you are experiencing font problems with your program, you can install missing Windows fonts by right-clicking on the game title (or left clicking and selecting from the right panel) and selecting Winetricks -> Select the default wineprefix -> Install a font -> allfonts. It will take a while, but make sure to try the game again afterwards. There are also Windows settings you can change from winetricks, like fontsmooth=rgb for example.

Figure 9 - Running a manually installed game
Figure 9 - Running a manually installed game

I did a test with GTA V to see how high-end games performed on the ODROID-H2. Under Windows, it runs at about 20-30 fps with everything on minimum at an 800x600 resolution. Under Linux, it runs at about 15-25 fps at the same settings, but sometimes stutters. So, there was a bit of reduction in performance, but it still played decently. For a casual gamer and Linux enthusiast it might be worth it. Imagine how well games would run with a high-end GPU!

Getting controllers to work

The Gamesir G3w controller sold by Hardkernel should work out of the box on Windows. However, we are not on Windows, so we need to tinker a bit. Note that the controller has two operating modes - Xiaoji Gamesir-G3w (two LEDs “on” underneath the controller) and an Xbox 360 mode (one red LED). You can switch between modes by holding the "GameSir" central button for about 10 seconds. The Xbox 360 mode is good for Android (look for Octopus on the play store), but for Linux you need to be in the Xiaoji Gamesir-G3w mode. You can check your current mode by checking for this USB ID (note that my Ubuntu reports it as Apple, but it is not):

$ lsusb | grep 05ac:055b
Bus 001 Device 007: ID 05ac:055b Apple, Inc.
You can now install jstest-gtk to test the buttons:
$ sudo apt-get install jstest-gtk
If you do not get events, most likely your user is not part of the "input" group - so make sure to add yourself to that group and re-login.

Figure 10 - Joystick test
Figure 10 - Joystick test

Actually using the controller depends on the game/emulator being used. Some games (like Need for Speed 2 SE https://github.com/zaps166/NFSIISE) support the gamepad as a joystick out of the box. You just need to map your joystick buttons to the actions in the game.

Figure 11 - Native joystick support
Figure 11 - Native joystick support

For other games, you may need to map joystick events to keys. You can do so with the qjoypad application:

$ sudo apt-get install qjoypad
I am trying to add controller support to an old DOS game called Prehistorik 2. It just needs Left/Right/Up/Down and Space - which is the fire button. For this, we create a new profile called "Pre2" ( after starting the application, you can select the main window from its Status bar icon). The easiest way is to select "Quick set" and you will be prompted to push a button on the controller, followed by a key to be emulated.

Figure 12 - Joypad mapping
Figure 12 - Joypad mapping

To wrap things up, it would be best to set the correct profile when starting the game. You can do so by editing the game settings -> System options -> "Show advanced options". You can set the path to a script (sadly it does not take parameters yet) that will launch qjoypad with the correct profile before starting the game. Create the following script, save it and mark it as executable:

$ cat Games/pre2/qjoypad.sh
#!/bin/bash
/usr/bin/qjoypad Pre2
$ chmod a+x Games/pre2/qjoypad.sh
From the list locate "Pre-launch command" and add "/home/odroid/Games/pre2/qjoypad.sh". Save and enjoy! (Big thanks to @meveric for assistance to getting the gamepad working)

Android via anbox (Android in a Box)

What if you have some Android games that you want to play? Fortunately there is no need to dual-boot to Android - you can run Android apps in a Linux container with anbox!

Note that the project is still young and only provides an early beta you can play with, so expect occasional crashes, but through the magic of Linux namespaces and with the addition of two Android kernel modules, you can run a core x86 Android 7.1.1 image on top of which you can install your apps, although not all apps may work. You can find installation instructions at https://github.com/anbox/anbox/blob/master/docs/install.md.

$ sudo add-apt-repository ppa:morphis/anbox-support
$ sudo apt install anbox-modules-dkms
$ sudo modprobe ashmem_linux
$ sudo modprobe binder_linux
$ sudo snap install --devmode --beta anbox
You will get a launcher icon in your linux GUI (I had mine under Others) called Android Application Manager that can be used to start the app launcher.

Figure 13 - Android Application Manager
Figure 13 - Android Application Manager

Now that Android is up and running, how do you install apps (I presume you got tired of playing with the Calculator)? Let us install Play Store (and ARM application support via libhoudini) by following the simple guide at https://www.linuxuprising.com/2018/07/anbox-how-to-install-google-play-store.html.

$ sudo apt-get install git
$ git clone https://github.com/geeks-r-us/anbox-playstore-installer.git
$ cd anbox-playstore-installer/
$ sudo ./install-playstore.sh
$ sudo apt-get install lzip
$ sudo ./install-playstore.sh
Make sure to give all the permissions required by Google Play and Google Services in Android Settings -> Apps -> … -> Permissions, otherwise you will run into weird errors.

Figure 14 - All the permissions
Figure 14 - All the permissions

When you start Play store it asks you to login with your account, which should work in your case. In my case, I was logging in with my kid's account which is tied into Google Family (for parental supervision) and login failed because the emulated device lacked some security features required by Google. There is another way of installing apps though: you can use adb to sideload any apk:

$ sudo apt-get install adb-tools
$ adb devices
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
emulator-5558 device
$ adb install F-Droid.apk

Success

I went with F-Droid - the open-source alternative app store (https://f-droid.org/en/), and from there I could install a simple game called Reckoning Skills (https://f-droid.org/en/packages/org.secuso.privacyfriendlyrecknoningskills/) meant to challenge my child's math skills.

Figure 15 - F-Droid
Figure 15 - F-Droid

If you get into trouble you can restart your emulated Android device with:

$ sudo snap restart anbox
You can get (lots and lots!) of logs with adb logcat if you want to troubleshoot something, and if you need access to the "userdata" partition, you can find its files in /var/snap/anbox/common/data/data

Add Android app to Lutris

Having playable content from Android is nice and all, but maybe you would like to have it integrated under a single launcher. To do this, you'll need to find the desired app's package name (program identifier) and entry activity (the startup window). You will need to connect through adb while the desired app is running in foreground and run:

$ adb shell
x86_64:/ $ dumpsys window windows | grep -E 'mCurrentFocus'
mCurrentFocus=Window{67dc1f0 u0 org.secuso.privacyfriendlyrecknoningskills/org.secuso.privacyfriendlyreckoningskills.activities.MainActivity}
The string highlighted in orange is the package name of the current application, while the blue string is the activity name. With this information, you can now start this Android app from a shell (you'd better stick to copy/pasting them instead of typing):
$ anbox launch --package=org.secuso.privacyfriendlyrecknoningskills --component=org.secuso.privacyfriendlyreckoningskills.activities.MainActivity
You can now add a manual entry for your game under Lutris. Select the Linux Native runner and add /snap/bin/anbox as the executable. You will need to add launch --package=org.secuso.privacyfriendlyrecknoningskills --component=org.secuso.privacyfriendlyreckoningskills.activities.MainActivity under the parameters entry (without quotes). Save and enjoy your new launcher.

Figure 16 - Launching an Android game from Lutris
Figure 16 - Launching an Android game from Lutris

Note that even if it is currently buggy or tedious to setup, anbox is getting better with every release and I expect it will be better integrated with Lutris in the future. I hope this guide into the world of games on Linux has helped you get started. If you get stuck, you can ask for help in the support thread at https://forum.odroid.com/viewtopic.php?f=172&t=35311&p=258763#p258763.

Be the first to comment

Leave a Reply