【RISC-V Gaming Ecosystem】Building and Running an Optimized Version of the Godot Engine on the SpacemiT K3 Pico-ITX
Introduction
This article explains how to quickly get a native RISC-V Godot editor and export templates running on the SpacemiT K3 (SpacemiT X100) Pico-ITX development board, from installing precompiled versions to building from source with a single command, and then run a game project.
The K3 is powerful enough for 2D game development. For a detailed performance assessment, check out my review video below:
【The World’s First Mass-Produced RVA23 RISC-V AI Chip! The Most Detailed SpacemiT K3 Review Is Here!】 https://www.bilibili.com/video/BV1RBReBdEzp/?share_source=copy_web&vd_source=c011e600289db00bf69b28358596e7fb
System Environment
On the preinstalled Bianbu 4.0 or openKylin 2.0 sp2 system, install build tools such as Clang 17, GCC 14, mold, and scons, then use the rvgdbuild tool I wrote directly.
Building from Source (Performance Tuning)
Use the unified rvgdbuild build tool to build a version of Godot optimized for the K3 from source.
1. Get the Tool
git clone https://gitee.com/openkylin/godot-riscv.git
cd godot-riscv
pip install scons
sudo apt install -y mold clang build-essential git python3 pkg-config \
libx11-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev \
libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev libwayland-dev
2. Build the Editor and Export Templates (Standard Version)
# Optimize for the K3's X100 architecture; LLVM, mold, and the SpacemiT toolchain are recommended
rvgdbuild build \
--version 4.5.1-stable \
--targets editor,template_debug,template_release \
--cpu generic \
--use-llvm yes \
--scons-arg "CXX=clang++" \
--scons-arg "CC=clang" \
--scons-arg "linker=mold" \
--package \
--jobs $(nproc)
You can pass K3-specific flags such as -mcpu=spacemit-x100 through --scons-arg to enable vectorization and optimize game size.
-mcpu=spacemit-x100: Use X100 scheduling and Fusion information.-mcpu=spacemit-a100: Use A100 scheduling and Fusion information.-fuse-ld=lld: Use thelldlinker.-march=rv64gc_zba_zbb_zbc_zbs: Enable the gc and bitmanip instruction extensions.
For a detailed explanation of the parameters, see the official documentation:
You can also watch my video tutorial below:
【【Developer Guide】Cross-Compiling on openKylin with the SpacemiT RISC-V Clang Toolchain】 https://www.bilibili.com/video/BV1WbEnzfESY/?share_source=copy_web&vd_source=c011e600289db00bf69b28358596e7fb
4. Verify and Run
The build artifacts are output to godot-output/, and a build-manifest.json manifest is generated.
# Launch the editor (the K3 supports Vulkan hardware acceleration)
./godot.linuxbsd.editor.rv64.llvm --display-driver wayland vulkan
Enjoy game development on RISC-V, starting with the K3!