Gaming with Lutris on Odroid H2

Post Reply
User avatar
mad_ady
Posts: 6779
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 215 times
Been thanked: 163 times
Contact:

Gaming with Lutris on Odroid H2

Unread post by mad_ady » Fri Jun 07, 2019 5:29 pm

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. Sadly, it hasn't 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 (yay, they're coming back in the store!). As you know, the H2 is based on Intel architecture and can play many more games than the XU4. We'll see just how far we can go. Note that since the H2 isn't a "gaming PC", don't expect miracles, but it can run some 5-10 year-old games with decent performance. Unfortunately Linux will have some performance cost when running Windows games because various adaptation layers add some 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 here: https://youtu.be/oHDkeQ9eDrc.

Code: Select all

$ sudo add-apt-repository ppa:lutris-team/lutris
$ sudo apt-get install lutris
While you're in the shell you should also install wine if you plan on running Windows games (I used the standard Ubuntu version):

Code: Select all

$ 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:

Code: Select all

$ sudo apt install mesa-vulkan-drivers mesa-vulkan-drivers:i386
You can 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. Unfortunately the tool needs compiling, so you can follow these steps:

Code: Select all

$ 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.

Image
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:

Code: Select all

$ sudo apt-get install dxvk
Lutris management
Now that we have everything setup, 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 - 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.

Image
Figure 2. Manage runners

We can now download and install some games. Let's 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 - answer as best you can.

Image
Figure 3. Super Tux Kart

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

Image
Figure 4. Super Tux Kart - playthrough

Note that, even if the game runs smoothly, on the H2 some textures are glitching - probably due to the intel drivers implementation. But 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.

Image
Figure 5. GoG installation

Let's now try something more taxing, that your average XU4 can't do. In order to install steam games (either Linux or Windows), you first need to install the steam client.

Code: Select all

$ 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's 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:

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

Image
Figure 6 - Add manual game

3. Under the Game Options tab select your installer executable inside the Executable field. You probably don't 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.

Image
Figure 7 - Game options

4. 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.

Image
Figure 8 - Runner Options

5. 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're experiencing font problems with your program, you can install missing Windows fonts by right-clicking on the game tile (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.

Image
Figure 9 - Running manually installed game

Regarding what high-end games I tried to run on the H2 - I did a test with GTA V. Under Windows it runs at about 20-30 fps with everything on minimum at a 800x600 resolution. Under Linux it runs at about 15-25 fps at the same settings but sometimes it may stutter. So - a bit of reduction in performance, but still decent. 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. But we're not on Windows, so we need to tinker a bit with it. 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's not):

Code: Select all

$ lsusb | grep 05ac:055b
Bus 001 Device 007: ID 05ac:055b Apple, Inc.
You can now install jstest-gtk to test the buttons:

Code: Select all

$ sudo apt-get install jstest-gtk
If you don't get events, most likely your user is not part of the "input" group - so make sure to add yourself to that group and relogin.

Image
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 actions in the game.

Image
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:

Code: Select all

$ sudo apt-get install qjoypad
I'm trying to add controller support to an old DOS game called Prehistorik 2. It just needs Left/Right/Up/Down and Space - which is fire. For this we create a new profile called "Pre2" (after starting the application, you can select the main window from its Status bar icon). 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.

Image
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 doesn't 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:

Code: Select all

$ 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's 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 (read: expect 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 (not all will work though).

You can find installation instructions here:
https://github.com/anbox/anbox/blob/mas ... install.md

Code: Select all

$ 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'll 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.

Image
Figure 13. Android Application Manager

Now that Android is up and running, how do you install apps (presuming you got tired of playing with the Calculator)? Let's install Play Store (and arm application support via libhoudini) by following this simple guide:
https://www.linuxuprising.com/2018/07/a ... store.html

Code: Select all

$ 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'll run into weird errors.

Image
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's another way of installing apps though - you can use adb to sideload any apk.

Code: Select all

$ 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.sec ... ingskills/) meant to challenge my child's math skills.

Image
Figure 15. F-Droid

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

Code: Select all

$ 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'd 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'll 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):

Code: Select all

$ 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.

Image
Figure 16. Launching an Android game from Lutris

Note that even if it's 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.


Hope this guide into the world of games on Linux hasn't put you off!
These users thanked the author mad_ady for the post:
meveric (Sat Jun 08, 2019 7:18 am)

User avatar
meveric
Posts: 10523
Joined: Mon Feb 25, 2013 2:41 pm
languages_spoken: german, english
ODROIDs: X2, U2, U3, XU-Lite, XU3, XU3-Lite, C1, XU4, C2, C1+, XU4Q, HC1, N1, Go, H2 (N4100), N2, H2 (J4105)
Has thanked: 17 times
Been thanked: 148 times
Contact:

Re: Gaming with Lutris on Odroid H2

Unread post by meveric » Sat Jun 08, 2019 7:27 am

I still use PlayOnLinux in many cases especially if you want to install games that are not listed on Lutris, as Lutris doesn't make it easy for you to install new applications "on the fly".
If there's no installer written for it, you have a hard time installing an application under Lutris, while this is quite easy under PlayOnLinux and the games can later be imported into Lutris as well.

Also as an alternative to qjoypad, I suggest antimicro which has similar (but sometimes even better features).
I use antimicro for years now on my OGST images and it's very helpful.
In the past I had entire mouse and keyboard inputs mapped via antimicro (yes it can also act as a mouse input).
These users thanked the author meveric for the post:
mad_ady (Sat Jun 08, 2019 2:03 pm)
Donate to support my work on the ODROID GameStation Turbo Image for U2/U3 XU3/XU4 X2 X C1 as well as many other releases.
Check out the Games and Emulators section to find some of my work or check the files in my repository to find the software i build for ODROIDs.
If you want to add my repository to your image read my HOWTO integrate my repo into your image.

User avatar
mad_ady
Posts: 6779
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 215 times
Been thanked: 163 times
Contact:

Re: Gaming with Lutris on Odroid H2

Unread post by mad_ady » Sat Jun 08, 2019 2:05 pm

Thanks for the suggestions! Mouse support sounds good with antimicro.

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 0 guests