Skip to content

An implementation of[reconstructing cavestory in the rust programming language.

Notifications You must be signed in to change notification settings

drbawb/rust-story

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

In an effort to teach myself Rust I've decided to follow along with the excellent youtube playlist reconstructing cavestory.

This project uses rust-sdl2 which binds to SDL2.

Build Status

Building w/ Cargo

This project uses Cargo to fetch dependencies and drive compilation. Make sure you have a recent version of rustc and cargo.

To build simply run: cargo build from the root of the project.

The project is structured as follows:

-- assets/ 	(assets linked to in the youtube playlist notes)
-- src/ 	(.rs files used to build the game)

For the most part this program reads much like it's C++ and C++11 counterparts.

  • Traits are used instead of extending abstract classes.

    • These are similar to interfaces in Go, Java, etc.
  • Pattern matching is leveraged where appropriate

    • For a fun head-scratcher: look at Player::load_sprite()
      • The rust compiler requires exhaustive patterns, so:
      • For every combination of (Movement, Looking, Facing) load_sprite() must return some sprite.
      • (Obviously the compiler cannot guarantee that we load the correct sprite.)
  • Reference counting is used for safely sharing pointers.


Some areas that could be improved:

  • Needless copying and allocation, espcially w.r.t using strings for map keys.
  • Remove unnecessary boxes
  • Re-evaluate usages of trait objects

About

An implementation of[reconstructing cavestory in the rust programming language.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages