This is a simple retro-inspired platformer game (implemented in C11) targetting a retro-inspired FPGA game console by the same author (implemented in Verilog). It is a bare metal program using sprites and tilemaps to displays graphics similar to other games of the period and works with modest CPU speed and RAM.
2 complete levels are playable.
This video was captured from a ULX3S using a HDMI capture stick, an SPDIF DAC for audio and a Bluetooth gamepad for controls. Click the thumbnail to watch the video on Youtube.
FPGA bitstreams and game binaries for the program can be downloaded from the Releases page. The game should start after flashing the bitstream.
iceprog -o 2M prog.bin
iceprog ics32-icebreaker.bit
fujprog -j flash -f 0x200000 prog.bin
fujprog -j flash ics32-ulx3s.bit
- Only the 85F boards are supported as the 12F doesn't have enough block RAM.
- Note that
fujprog
will be slow to flash if you are using a game binary with music included. - Binaries with music included require a board with 16MByte of flash.
- GNU RISC-V toolchain for cross compilation
- GNU Make (any version >= 3.81 should work)
If running in the simulator using the make sim
target for example, the prerequisites here are also needed.
If running on an iCEBreaker, ULX3S or other supported board, the prerequsites here are also needed.
Sound effects are included by default but music is not. Running any of the Makefile targets with MUSIC=1
will:
- Download and extract audio from preconfigured Youtube videos using youtube-dl with (default is included but can be changed in Makefile)
- Convert them using ffmpeg to the required system format (IMA-ADPCM)
- Include them in the output binary
Including music adds two prerequisities:
The CROSS
variable in the Makefile should match the prefix of the RISC-V toolchain. By default it is set to riscv-none-embed-
which may not match the one installed on the machine.
This project depends on the system repo which is included as a submodule:
git submodule update --init --recursive
To build and run in the simulator:
make sim
The bitstream for the system itself must be flashed first using these instructions.
To build and run on a given FPGA board:
make ulx3s_prog
make MUSIC=1 ulx3s_prog
The default ULX3S programmer used is fujprog which can be a bit slow for large files. If the built with MUSIC=1
then it might take a minute or two.
make icebreaker_prog
make MUSIC=1 icebreaker_prog
The game can be controlled with (limited) buttons on the FPGA board or with certain USB gamepads. Top level verilog modules for each board show which options are available if any. The simulator uses SDL keyboard input for control.
- Left/Right: Move
- Up: Climb
- Down: Duck
- B: Jump
- Y: Run
- L: Exit vehicle*
- R: Perform vehicele action (like firing a projectile)*
- Select: Reset game state (debug)*
- Start: Pause*
*: USB gamepad is needed for these.
Open game art was used for the graphics and audio with some minor alterations. A full list of attributions to the artists is in the ATTRIBUTIONS.md file.