This may sound nuts, but I tried running the unstable version of the Godot engine (the 4.0 version with the Vulkan renderer) on the Raspberry Pi 4. Why on god’s green earth would I do that? For one, the Vulkan driver for the Raspberry Pi is improving. For another, the Vulkan renderer for the Godot engine is improving, too. How did I do it? What problems did I overcome? was it all worth it? The answers to those questions lies in the next few paragraphs.
To build this monster, I had to first get the Vulkan drivers for the Raspberry Pi. That was fairly easy. Then I had to get a Raspberry Pi that has enough power to actually run a gaming engine. Enter the Raspberry Pi 4 with 8GBs of RAM. This monster looks like it has just enough juice to run some of the lower capabilities of the Godot engine. I added a tiny external SSD to this thing, installed Raspberry Pi OS, and I was off to build drivers.
After downloading the Vulkan drivers for the Raspberry Pi, I used the instructions from this site to build them. In the instructions for the drivers, I had to use a more up-to-date version of meson just to build them. I used pip3 to install meson, and used the local version (local to the “pi” user, anyway). The following commands were used to build and install the drivers:
meson --prefix /home/pi/local-install --libdir lib -Dplatforms=x11,drm -Dvulkan-drivers=broadcom -Ddri-drivers= -Dgallium-drivers=v3d,kmsro,vc4 -Dbuildtype=debug _build ninja -C _build ninja -C _build install
With those built, I then built the examples written by Sascha Willems. These were used to see how well the Raspberry Pi 4 could perform. They performed surprisingly well, showing demos which could hold at least 30 FPS (though the demo with special lighting ran poorly). Next I tried my hand at building the engine on the Raspberry Pi 4.
I had a bit of a problem with
scons being out of date, too. So I had to install a newer version of that with
pip3, too. Then I git cloned the latest version of the engine, and tried building an export template. The following command was used to build it:
scons -j 4 CCFLAGS="-I/home/pi/local-install/include/" LDFLAGS="-lvorbis" tools=no platform=linuxbsd udev=yes use_llvm=yes module_webm_enabled=no target=release_debug
The part about
module_webm_enabled=no had to be used because, in the past, I tried building the engine on the Raspberry Pi only to see it fail because it was hung up on a “libvpx” error. Also, I used
clang because the installed version of GCC was too old to build the engine. When the code finished building with this command (it took over an hour). I had an export file. While that was all well and good I’m sure there are users of the Godot engine who would love to use the editor on the Raspberry Pi. From what I found (when building the editor) it doesn’t look like that’s going to happen any time soon.
The editor took a while to build. I found an error with libvorbis not wanting to link with the final executable. It turns out that the engine couldn’t find the libraries for libvorbis. So I had to specify that as a linker option when I built the editor. The following command was used to build the engine:
cpu_stuff="-mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mlittle-endian -munaligned-access" scons $delete -j 4 CCFLAGS="$cpu_stuff" LDLIBS="-lstdc++" LINKFLAGS="-lvorbis" \ tools=yes platform=linuxbsd target=release_debug udev=yes use_llvm=yes
After trying a number of times, this command results in a binary for the engine. While it’s great that the command resulted in a binary, the performance is left lacking. The editor doesn’t run, instead giving the error:
godot.linuxbsd.opt.tools.32.llvm: ../src/broadcom/vulkan/v3dv_query.c:34: v3dv_CreateQueryPool: Assertion `pCreateInfo->queryType == VK_QUERY_TYPE_OCCLUSION' failed.
It looks like the Vulkan renderer still has a long way to go. Nevertheless, it may one day be possible to build and run the Godot engine on a Raspberry Pi. That’s why I have thrown together a script which will download, build, and install both the Vulkan drivers and the Godot engine. Note that this script hasn’t been tested, let programmers beware.
Have fun trying to run gaming engines on low-end hardware!