Skip to content

Running on Raspberry Pi and Odroid Go Advance

Nikolai Wuttke edited this page Nov 14, 2022 · 23 revisions

Raspberry Pi

Building via RetroPie

If you're using RetroPie, you can use this build script made by @Exarkuniv to build the project easily. Tested successfully on Pi 4 and 3.

Note: You might need to adjust the git revision set in the script to make it use the latest release.

Building manually

For fast compilation, using a cross compiler would be best. I'm planning to create Docker images to make this easy, but I haven't taken the time do to that yet, so right now, building on device is the easiest option (unless you already have a cross-compiler based on GCC 8 or newer ready to go - in which case you should use it, by all means!).

Building on device is perfectly doable, but on a Pi 3, a full rebuild from scratch takes around 40 to 60 minutes. After the first build, incremental changes take much less time to compile depending on which files are touched. On a Pi 4, a full rebuild takes only about 6 minutes.

Make sure you're building the OpenGL ES version of RigelEngine by passing -DUSE_GL_ES=ON to CMake. Otherwise, it will compile fine, but you will get an error when trying to launch the game - or it might use software emulation, which is awfully slow.

⚠️ On Pi 3, make sure to run make single-threaded (without the -j option). Even though the Pi 3 has multiple CPU cores, it doesn't have enough RAM for more than one GCC to run at the same time (at least for this particular project, which uses a lot of modern C++ features. You can probably get away with it for a C project). This causes a multi-job build to take longer than a single-job one, because the system will start swapping memory to SD card and that slows it down tremendously.

On Pi 4, you can build multi-threaded withouts issues, since it has enough RAM.

Full build instructions:

mkdir build
cd build
cmake .. -DUSE_GL_ES=ON -DCMAKE_BUILD_TYPE=Release

# On Pi 3:
make RigelEngine

# On Pi 4:
make RigelEngine -j$(nproc)

How to get best performance (Pi 3/Zero)

For Pi 4, you can ignore this section. Just running the game normally should give you a solid 60 FPS at 1080p without issues. For older Pis, read on.

I have tested the project on a Pi 3 model B, Pi 1 model B, and Pi Zero, all of them running Raspbian Buster (aka Raspberry Pi OS).

For best performance, you want to run with the proprietary Broadcom OpenGL driver. It will automatically be used if you launch the game from a real terminal, i.e. not a terminal window in the Desktop environment. You can either boot to terminal (select in the Raspberry Pi configuration menu or using raspi-conf), or you can switch to one by pressing Ctrl+Alt+F1.

⚠️ If you launch RigelEngine from the Desktop environment, it will use OpenGL software emulation by default, which is extremely slow.

To force the use of the Broadcom driver, you can set an environment variable for SDL:

SDL_VIDEODRIVER=RPI ./src/RigelEngine

This way, you can launch the game from the Desktop environment and still get good performance.

⚠️ Note that if you change the OpenGL driver in raspi-config to any option aside from "Legacy", the Broadcom driver will not work. You can play the game with the X11 backend when using the KMS/FKMS drivers, but performance will be suboptimal - around 40 FPS for me instead of 60.

When using the Broadcom driver with the RPI backend instead, the game runs at a steady 60 FPS for me at 1080p on the Pi 3 and Pi Zero.

Unfortunately, the version of SDL shipping with Raspberry Pi OS does not include the KMS/DRM backend. It's possible that you could achieve full performance on the KMS drivers when using that backend, but I haven't tested that yet. It would require building SDL from source.

Performance on Pi 1 (and 2)

Game startup takes more than 10 seconds on a Pi 1 - so you'll need a bit of patience. Once RigelEngine has started, loading a save or starting a new game is still instantaneous, even on the Pi 1.

At 1080p resolution, my Pi 1 model B doesn't quite manage holding 60 FPS when in-game. It seems the stock clock speeds of the Pi 1 are not quite high enough to run the game at 60 FPS at that resolution. To get a smoother experience on the Pi 1, you have several options:

  • Reduce the resolution. At 720p (1280x720), I had no trouble reaching a stable 60 FPS.
  • Cap the frame rate at 30 FPS by disabling V-Sync and using the FPS limiter (both settings can be found in RigelEngine's options menu).
  • Overclock your Pi to the same clock speeds used by the Pi Zero (1 CPU @ 1 GHz, GPU @ 400 MHz). Given that the hardware is the same on both systems, and the Pi Zero runs at these clock speeds out of the box, this should be pretty safe.

Here's the config.txt settings I used to test overclocking my Pi 1:

arm_freq=1000
core_freq=400
over_voltage=2

I don't have a Pi 2 to test, but I suspect that performance will be very similar to the Pi 1, since the GPU is clocked at the same speed.

I'm planning to look into more optimization at some point, and maybe I can get a stock Pi 1 (or 2) to run at full speed at 1080p as well. But I don't want to promise anything yet - since the game runs perfectly fine on an overclocked Pi 1, or on a Pi Zero (which is much cheaper than a Pi 1), I'm not sure if it's worth the effort.

Odroid Go Advance/Odroid Go Super

Using EmuELEC

EmuELEC is a retro-gaming focused Linux distro running on Odroid Go Advance/Super and Amlogic-based devices. Starting with EmuELEC 4.0, RigelEngine (v. 0.7.1) comes bundled with the system. It can be found in the "PC Ports" category. To provide the game data for RigelEngine, copy the files into the roms/ports/rigelengine directory.

Building from source

If you'd prefer to use a different distro, you currently need to build from source. Building for the Odroid is quite similar to building for Raspberry Pi: Using a cross-compiler would be ideal, but building on device is perfectly doable. A full rebuild takes roughly an hour.

⚠️ As with the Raspberry Pi, make sure to build single-threaded.

One important difference is that you need to use a custom version of SDL in order for the game to properly display on the Odroid's screen (it will be incorrectly rotated otherwise). Some Odroid distros already ship with this patched version. In case yours doesn't, you can build it yourself, this forum post has detailed instructions.

Depending on your distro, you might also need an updated game controller database file for SDL to recognize the Odroid's buttons. Download the file onto your Odroid, and then set the SDL_GAMECONTROLLERCONFIG_FILE environment variable to point to the downloaded file when running RigelEngine. If the downloaded file doesn't work on your particular distro (there are some differences depending on which Linux Kernel version is used) or you'd like to customize the button mappings, there are various tools you can use to create your own mappings and add to the file.

⚠️ If you want to use RigelEngine's quick saving feature, make sure one of the buttons is mapped to back. The mappings from the community sourced DB linked above currently don't have this for the Odroid Go Advance, so you might want to adjust the mapping and replace guide with back.