deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Space game SEEDS ships a full RISC-V emulator running real Alpine Linux in-game

Against All Odds has detailed PasRISCV, the open-source Object Pascal RISC-V emulator inside its space game SEEDS, which boots a real Alpine Linux system to power the player's in-game computer.

Space game SEEDS ships a full RISC-V emulator running real Alpine Linux in-game

A Linux machine inside a space game

The studio behind the space game SEEDS, Against All Odds, has revealed that every player's in-game computer is a fully emulated machine running real Linux. In a developer post on the studio's blog that reached the Hacker News front page, the team explains that in-game tools such as the planetary overview and statistics are native Linux ELF binaries. Even on a Windows machine, those binaries execute on an emulated 64-bit RISC-V system running Alpine Linux.

The emulator behind this, PasRISCV, was written in-house in Object Pascal and released as free open-source software under the permissive zlib license, together with a frontend named pasriscvemu. The studio invites others to inspect and reuse the code.

A whole machine, not just userspace

The developers describe two possible approaches — emulating only userspace, or emulating a complete virtual machine — and say they chose the latter. PasRISCV models a full machine, including display and storage devices and interrupts, so the guest kernel behaves as if it were running on physical hardware.

The target architecture is 64-bit RISC-V, which the post notes is an open standard free of the royalties attached to proprietary architectures like x86 and ARM. On the feature side the emulator covers SMP and multi-hart operation, RV64GC and RVA23, the Hypervisor and Vector extensions, and additional scalar and vector cryptography extensions, with the full list kept in the project repository.

Interpreter plus tracing JIT

CPU emulation combines an interpreter with a tracing JIT compiler. The JIT currently targets x86-64 hosts only, but the developers estimate it handles about 99 percent of the instructions they encounter. Floating-point operations can pass straight through to the host FPU, while a stricter optional mode pairs software floating point with the interpreter, because IEEE 754-2008 specifies behaviour that x86 hardware cannot reproduce exactly.

Boot chain and disk layout

The emulator boots in the background whenever a player starts or loads a game. A direct OpenSBI-to-kernel boot would force the disk images into the initramfs, so the game instead chains OpenSBI through U-Boot, which loads and runs the kernel from an ordinary disk image.

Disks attach either as VirtIO block devices or as emulated NVMe hardware over PCIe, and can be mounted read-write or read-only. SEEDS keeps a read-only root partition that game updates can replace wholesale, plus a separate user partition for player data such as mini-game high score tables, until that state moves into the game state itself. Host directories can also be shared into the guest via VirtIO-9P or VirtIO-FS, which the team finds convenient during development because tools compiled on the host are immediately visible inside the VM. The shipped system is a slightly modified Alpine Linux 3.23.6 with a custom kernel build, though the post says a recent stock Alpine image also runs without problems.

Retro graphics and Yamaha sound chips

The in-game screens read their pixels from a SimpleFB framebuffer backed by a custom MMIO display buffer. That is fast enough for the game to post-process the output with shaders, adding scanlines, phosphor glow and other deliberately degraded 80s and 90s visuals. PasRISCV also offers VirtIO GPU with EDID and 2D support plus experimental VirGL 3D, and PCI devices served by Bochs VBE and Cirrus Logic drivers; the team even ran an X server with the Motif window manager, though too slowly to be usable on most machines.

Audio emulation is similarly retro, covering CMI8738 and FM801 cards with PCM, OPL2 and OPL3, alongside Intel HDA and VirtIO sound. OPL belongs to the Yamaha FM synthesis families that shaped late-80s and early-90s computer and console audio. Fitting the theme, the bundled proof-of-concept game Space Prowler has a chiptune title theme combining OPL3 synthesis with PCM drum samples. Its composer wrote a small console tracker called chOPLin, which even runs on the in-game machine's 640×400 framebuffer console, and which the developer plans to release as open source after polishing.

Why it matters

Shipped games almost never include a complete hardware emulation stack. SEEDS demonstrates one working in production: players interact with a genuine Linux system running real binaries, not a scripted imitation of a computer. Because the in-game applications are ordinary Linux programs, they can be developed, debugged and updated like any other software rather than as bespoke game UI. And because PasRISCV is free and open source under the zlib license, the wider community inherits a reusable RISC-V machine emulator as a byproduct of one game's development — a concrete example of RISC-V's royalty-free openness paying off in pure software.

  • #risc-v
  • #emulation
  • #linux
  • #open-source
  • #gaming
  • #object-pascal

Related posts