Skip to content

rust-gamedev/rust-game-ports

Repository files navigation

Rust Game Ports

Official host of games ported using Rust game libraries.

This project is intended to inform and help developers in the area of actual game programming with Rust and Rust game engines.

If you're a developer planning a contribution, it's crucial to read the Contribution Infos section.

Summary

The completed ports are:

Game Part of Source Language Source Libraries Port Libraries Tested on
Boing Code the Classics Vol. 1 Python PyGame Zero ggez 0.7 Linux
Catacomb II (SDL) - C SDL 2 Rust-SDL2 0.35 Linux
Cavern Code the Classics Vol. 1 Python PyGame Zero Macroquad 0.3 Linux
Soccer Code the Classics Vol. 1 Python PyGame Zero Fyrox 0.26 Linux
Rusty Roguelike Hands-on Rust: Effective Learning... Rust bracket-lib, Legion bracket-lib, Bevy (ECS) 0.7 Linux
Rusty Roguelike Hands-on Rust: Effective Learning... Rust bracket-lib, Legion Macroquad 0.3, Legion 0.3 Linux
Bunner Code the Classics Vol. 1 Python PyGame Zero Macroquad 0.3 Linux

Contribution Infos

Contributions are welcome!

Since this project is intended to be educational above all, it's important for the candidate ports to constitute proper examples 😄

In this section you'll find some suggestions to start a port, and the low and high level guidelines. Feel free to skip the first, but don't underestimate it! 😉

Choosing and implementing a port

Devs motivated to implement a port are advised to be very careful with what they choose 😄

While some ports are straightforward, for example Rust+immediate mode library ("IML") -> Rust+IML, other types of port can be subtly challenging:

  • Dynamic language+IML (e.g. Python+Pygame -> Rust+ggez) are challenging for many reasons:
    • It's difficult to understand the exact structure/state of the classes/instances
    • Globals may be used
    • Numeric types can be difficult to ascertain, and the descriptions may be buggy (e.g. a number may accept negative values, while being described as accepting only positive ones)
  • IML -> Retained mode library are very time consuming, as they require a full redesign, an example can be porting a Rust game from ggez to Fyrox
  • Object oriented -> ECS is another time consuming one, since it requires a full redesign

For beginners, a good starting point is to take a Rust+IML project, e.g. Boing, and convert it to another IML, e.g. Macroquad.

More adventurous devs can start from a Python/PyGame source, and port it to Rust+IML.

Committed devs can perform ports that require a redesign (e.g. Fyrox Framework to Fyrox scripted).

It's not advised to perform a port that requires a language translation and a redesign

Low-level requirements

These are the low-level requirements for candidate projects (they will be automated, so they don't need to be actively take caren of 🙂):

  • include a license in the port workspace (can be easily copied and edited from other similar projects)
  • work on stable Rust (this is because they ubiquitous Rust Analyzer has some open issues with nighly Rust)
  • be formatted according to cargo fmt
  • be linted according to cargo clippy -- -W clippy::correctness -D warnings
  • not have any unsafe code (it's not necessary for idiomatically ported games)
  • not use any highly unidiomatic Rust (e.g. globals)

High level guidelines

High level guidelines are under discussion. Generally speaking, ports should be performed according to the intended design of the game library used, since ports are meant to be examples for Rust game development. You'll be famous! 😎😂

Screenshots

Boing:

Boing

Bunner:

Bunner

Cavern:

Cavern

Rusty Roguelike:

Rusty Roguelike

Soccer:

Soccer

Catacomb II:

Catacomb II

Port notes

Boing/ggez

A very straightforward port 🙂

This port suffers from one (Winit) bug:

  • corruption when running on fullscreen (reported here).

Cavern/Macroquad

Another very straightforward port 🙂

This port suffers from two Macroquad bugs:

  • the music starts with a delay (reported by another developer here);
  • on Nvidia cards, on Linux, CPU runs at 100% load (reported here).

Only the stable part of the library is used (the experimental scene API is not used).

Rusty Roguelike/Bevy ECS

The ECS part of this game, originally Legion, has been ported to Bevy (the graphic/input library used is still bracket-lib).

A mini book, "Learn Bevy's ECS by ripping off someone else's project", is based on this project.

Soccer/Fyrox

This port required a redesign, in order to move to a scene graph.

The port suffers from one Fyrox bug:

  • at least one sound plays with a delay (reported here).

Rusty Roguelike/Macroquad

The graphics portion of the Rusty Roguelike has been ported to Macroquad. The ECS used is still Legion, and the pathfinding is from bracket-lib).

Bunner/Macroquad

A straight port from PyGame Zero to Macroquad of this infinite frogger like game.

Catacomb II/SDL 2

This is an exact port of the source codebase, performed in two stages - first transpiling to unsafe Rust via C2Rust, then manually converting to safe Rust.

Since the objective was testing such type of port, the result is not idiomatic Rust; nonetheless, the code is still 100% safe, and the Rust-SDL2 library is properly used. More details are provided on the port project repository.

In order to play this game, the game datafiles are required; a pack with all the Catacomb games currently costs just 4$ on GOG.