Raytracing for the gba. to compile you just need cargo with the nightly compiler installed via rustup, as well as agb-gbafix (cargo install agb-gbafix)
This project is an implementation of "Raytracing in one Weekend", it is not a world-class raytracer nor am i trying to be the Heaven Seven demo. The primary goal is not to have perfect rendering or blow people's minds beyond "oh that's cool".
With that said, i am trying to keep it high quality, so for an faq:
Q: BVH?
A: At some point, i am largely following the order of the book
Q: Importance sampling?
A: Maybe some day but not right now.
Q: Realtime?
A: If you make a realtime raytracer with good quality you are a better dev than i
Q: Meshes?
A: Some day, when i add triangles, it will not be soon.
Q: Why are you not using X method?
A: Likely either memory constraints, or the fact that this was a project for fun, not a project for reading 500 page research documents and learning 4th year college math to understand them so i can make a slightly nicer raytracer on a gba.
Q: Rom?
A: Check the releases page
on linux you can use the makefile to compile with make fix assuming make is installed as well
you can also use make run to run in mgba-qt or make run_mesen to run in mesen2
cargo build --release
agb-gbafix target/armv4t-none-eabi/release/gba-rt -o gba-rt.gbathen run in your favorite emulator (i recommend mesen2)
While this is a CC0 project, i do kindly ask you add attribution. I cannot force you of course, but i will trust you to make whatever decision you see fit. If this helps you, consider making a pr with your improvements, to keep this a free resource for everyone!
- Zesterer for helping with finding inefficiencies as well as pointing out helpful libs and pushing me to better my code, as well as helping with a few implementations and some bug fixes
- gbadev (mainly the discord) users for helping keep me motivated to work on it and helping with some bugs
Apologies if the faq comes off as rude, but this is a fun project not a full time job, and i will be adding features as they come up or are useful. If you have an idea you can ask but don't push for it to be perfect, that is how projects get killed.
This makes getting started with a new project for the Game Boy Advance in rust really simple, by providing all the boiler plate files for you.
You will need the following installed in order to build and run this project:
- A recent version of
rustup. See the rust website for instructions for your operating systemYou will also want to install an emulator. The best support in agb is with mgba, with
println!support viaagb::println!but any emulator should work. You'll get the best experience ifmgba-qtis in yourPATH.If you want to run your game on real hardware, you will also need to install
agb-gbafixwhich you can do after installing rust with the following:cargo install agb-gbafix. This is not required if you are only running your game in an emulator.Once you have the prerequisites installed, you should be able to build using
cargo buildor in release mode (recommended for the final version to ship to players)
cargo build --releaseThe resulting file will be in
target/thumbv4t-none-eabi/debug/<your game>ortarget/thumbv4t-none-eabi/release/<your game>depending on whether you did a release or debug build.If you have
mgba-qtin your path, you will be able to run your game withcargo runor in release mode
cargo run --releaseYou can find the documentation for agb here.
You may also want to change the package name and version in
Cargo.tomlbefore you start.To make a game run on real hardware, you will need to convert the built file into a file suitable for running on the real thing.
First build the binary in release mode using the instructions above, then do the following:
agb-gbafix target/thumbv4t-none-eabi/release/<your game> -o <your game>.gba
