-
-
Notifications
You must be signed in to change notification settings - Fork 62
Running on Raspberry Pi and Odroid Go Advance
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 (assuming you have at least a Pi 3), but a full rebuild from scratch can take around 40 to 60 minutes. The rest of this document assumes you are compiling on the device itself.
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. Also, you most likely want to build a release build (-DCMAKE_BUILD_TYPE=Release
), and disable treating warnings as errors (-DWARNINGS_AS_ERRORS=OFF
).
When building, I'd recommend explicitly specifying the RigelEngine
build target (make RigelEngine
), as that saves some compilation time by skipping targets like unit tests and tools that aren't needed for running the game.
make
single-threaded (without the -j
option). Even though the Pi 3 and Odroid have multiple CPU cores, they don'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 device will start swapping memory to SD card and that slows it down tremendously.
Full build instructions:
mkdir build
cd build
cmake .. -DUSE_GL_ES=ON -DCMAKE_BUILD_TYPE=Release -DWARNINGS_AS_ERRORS=OFF
make RigelEngine
I have tested the project on a Pi 3 model B and a Pi 1 model B, both 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
.
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.
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.
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.
Game startup takes around 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.
My Pi 1 (model B) only manages 40 FPS when in-game. I suspect that this will be similar on a Pi 2, as it has the same GPU clock speed (250 MHz), wheras the Pi 3 and Zero have a higher GPU clock (400 MHz). I was able to run the game at full speed by overclocking my Pi using the following config.txt
settings:
arm_freq=1000
core_freq=400
over_voltage=2
If that's an option for you, you can still run the game at 60 FPS on a Pi 1 or 2. If not, I'd recommend locking the frame rate at 30 FPS instead, by disabling V-Sync and enabling the "FPS Limit" setting in RigelEngine's options menu. This will ensure you have no frame-pacing issues or stuttering. Since the game logic only runs at 15 FPS anyway, you don't lose much by running at 30 FPS.
I'm planning to look into more optimization at some point, to maybe get a stock Pi 1 or 2 to run at full speed as well. But I can't promise anything yet 😉
To run on Odroid, I'm using RetroRoller, a variant of Arch Linux. It already comes with a custom version of SDL, which is required in order to properly display the game on the Odroid's screen (it will be incorrectly rotated otherwise). If you're using a different distro, you might need to build the patched version of SDL yourself - more info here. Aside from that, building the project works as usual.
At the time of writing, you 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.