Skip to main content
Version: FILS English

RustScape

A compact and robust 2D video game for the NUCLEO-F411RE, written in Rust.

info

Author: Mihnea Girbacica
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-Mihnea8848

Description

RustScape is a 2D platformer game that aims to deliver a classic handheld gaming experience on a minimal embedded system. It's built for the NUCLEO-F411RE development board, pushing the boundaries of what's possible with microcontroller-based game development. Graphics are rendered on a vibrant 1.8" SPI TFT display (ST7735R), reminiscent of retro handhelds, while player control is achieved through an analog joystick and D-Pad Shield combo (KY-023) for movement, being a perfect choice for achieving that "retro feel". To complete the immersion, two passive buzzers provide a very makeshift soundtrack for the game and chiptune-style audio feedback. In the spirit of the DIY ingenuity, the project tries to embrace a cost-effective approach, even aiming to house the final product within the NUCLEO-F411RE's original cardboard shipping box. In the final version of this project, the players should be immersed in the game's story, overlooking the... less than desirable appearance and cheap parts.

Motivation

As the owner of a Game Development Company, I've been fascinated by video games since childhood. The curiosity to understand their creation has always driven me. While my current work involves developing cross-platform titles for PC, Android, Linux, and VR (see https://www.roblox.com/games/3192370355/MEH-Studios-Research-Facility-Test-Server for more details), I've always held a particular fondness for retro games and the challenge of emulation. This project, with its requirement to use microprocessors, presented the perfect opportunity to combine my passion for game development with the exploration of embedded systems, allowing me to create a physical, playable tribute to classic handheld gaming. With that being said, due to the limitations (Flash Storage Space), it forces me to fix my habit of writing spaghetti code, leaving optimizations at last, or even skipping them altogether.

Architecture

To be added at a later time, the hardware is still not fully configured.

Log

Week 5 - 11 May

The main goal of the first week was to make all of the peripherals work.
Code Changelog:

  • Created the Cargo.toml, with all the required dependencies
  • Created module display_module.rs, that integrates the ST7735s display to the microcontroller
  • Created module sound_module.rs, that integrates the 2 Passive Buzzers (one for Bass and one for Melody) to the microcontroller
  • Created module controller_module.rs, that integrates all of the SHIELD buttons to the microcontroller.

Hardware Changelog:

  • Decided to use the cardboard shipping box of the NUCLEO-F411RE as the chassis of the project
  • Test fitted the following parts to the box: ST7735s, 2x Passive Buzzer, Fundruino SHIELD
  • Glued inside of the box a small 3V3 and GND bus, taken from a small breadboard
  • Tested the placement of the buzzers so that the soundtrack can be heard easily

Photos:

The interior of the box: Wiring The closed chassis: RustScape!

Week 12 - 18 May

This week is still to come, to be added.

Week 19 - 25 May

This week is still to come, to be added.

Hardware

RustScape is built using the NUCLEO-F411RE development board, which acts as the game's central processing unit. Visuals are rendered on a 1.8" SPI TFT display. Player input is managed via a shield integrating an analog joystick and buttons, enabling movement and actions. Audio feedback is delivered through two passive buzzers, generating sound effects and simple music. Jumper wires ensure flexible electrical connections. Power and code uploads are facilitated by a Mini-USB to USB-A cable. Finally, an 8-LED module is used to represent the player's health status. All components, including the NUCLEO-F411RE board, are housed within the original NUCLEO-F411RE box, serving as a budget-friendly enclosure for the handheld console.

Schematics

The KiCAD Schematic is not yet finished, below is an unfinished version.

The KiCAD Schematic for RustScape

Bill of Materials

DeviceUsagePrice
STM32 NUCLEO-F411REMicrocontroller that drives the peripherals, as well as game logic70 RON
1.8" SPI TFT Display128x160 Color screen that displays the game29 RON
KY-023 Analog JoystickJoystick + buttons for player movement20 RON
2 x Passive BuzzerAudio feedback and soundtrack for the game2 RON
Mini-USB to USB-A CableUSB Cable for power and code flashing4.5 RON
Jumper Wires2 x Male-male & 1 x Female-female Cables17 RON
8 Red LED Module8 LEDs to display the player health11.5 RON

Software

LibraryDescriptionUsage
embassy-stm32HAL for STM32Abstracts the NUCLEO-F411RE's hardware (SPI, GPIO, Timers) for easier control.
embassy-executorAsynchronous runtimeEnables non-blocking operations for smooth gameplay.
embassy-timeAsynchronous timingProvides delays and timing for game logic and display updates.
display-interface-spiSPI display interfaceHandles low-level communication with the ST7735R.
mipidsiST7735 driverOffers display initialization and control.
embedded-graphics2D graphics libraryDraws shapes, text, and other visuals on the screen.
defmtLogging frameworkProvides efficient debugging output.
panic-probePanic handlerImproves error handling during crashes.
cortex-m-rtCortex-M runtimeSets up the microcontroller environment.
  1. Embedded Rust Book
  2. embassy
  3. embedded-graphics