Skip to content

justinmichaud/rust-nes-emulator

Repository files navigation

Rust NES emulator

See justinmichaud.com for a playable demo.

Games that don't use any fancy ppu trickery work, including Donkey Kong and Super Mario Bros. Only mapper 0 is supported. Sound is not supported.

Super Mario Bros

Super Mario Bros level generation

Blog post

The emulator can read levels for Super Mario Bros from a file and insert them into memory. There is also a separate project, level_out, that can spit out a text file representation of most of the overworld levels in the game. The following level was generated using the output of emulator (overworld levels from SMB + the lost levels, repeated 20x each in random order), and torch-rnn with the default settings after ~20 epochs (I used the 10000th checkpoint).

A playable demo of the generated level is available here, or here (modified to fit Super Mario Maker restrictions).

Other Super Mario Bros game modifications

If USE_HACKS in settings.rs is set to true, the title screen and prelevel screens will be automatically skipped, and you will have infinite lives. If USE_HACKS and SPECIAL are set, the game is tweaked for a one-button challenge. You can jump, and you cannot stop. The game screen is warped for an extra challenge, but deaths are instant and you have infinite lives:

Super Mario Bros - SPECIAL and USE_HACKS

Building for web

Download the emscripten portable sdk, and source the emsdk_env.sh script. Run make and make serve, and you should be good to go! This is a huge PITA, so it may take some hacking around.

Building for desktop

Install SDL2-devel, then build. Then, cargo run --release --bin emulator. Put rom file in assets/smb.nes (sha1sum: ea343f4e445a9050d4b4fbac2c77d0693b1d0922)

About

Rust NES emulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages