MCPcopy Create free account
hub / github.com/drbawb/rust-story

github.com/drbawb/rust-story @ep-023-rust-1.0.0.c5961ad06

Chat with this repo
repository ↗ · DeepWiki ↗ · release ep-023-rust-1.0.0.c5961ad06 ↗ · + Follow
117 symbols 305 edges 14 files 46 documented · 39% updated 10y ago★ 82

Browse by type

Functions 86 Types & classes 31
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 85
Class 22
Interface 5
Enum 4
Function 1

Languages

Rust100%

Modules by API surface

src/player.rs29 symbols
src/units/drawing.rs14 symbols
src/map.rs12 symbols
src/units/physics.rs11 symbols
src/sprite.rs10 symbols
src/collisions.rs10 symbols
src/input.rs8 symbols
src/enemies/bat.rs7 symbols
src/graphics.rs6 symbols
src/game.rs6 symbols
src/backdrop.rs3 symbols
src/main.rs1 symbols

For agents

$ claude mcp add rust-story \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page