No description
Find a file
2022-04-05 12:39:13 +02:00
.cargo Add readme 2022-03-29 14:35:55 +02:00
assets/fonts Add readme 2022-03-29 14:35:55 +02:00
images Add readme 2022-03-29 14:35:55 +02:00
src Merge branch 'master' into minor-contributions 2022-04-05 12:38:23 +02:00
.gitignore Add readme 2022-03-29 14:35:55 +02:00
Cargo.toml Merge branch 'master' into minor-contributions 2022-04-05 12:38:23 +02:00
dev.sh Reddit feedback and fixes 2022-03-30 17:44:11 +02:00
flake.lock Add nix flake 2022-03-29 21:38:03 -07:00
flake.nix Add nix flake 2022-03-29 21:38:03 -07:00
index.html Reddit feedback and fixes 2022-03-30 17:44:11 +02:00
LICENSE Fix scrolling egui 2022-03-30 01:51:22 +02:00
publish.sh Reddit feedback and fixes 2022-03-30 17:44:11 +02:00
README.md Add readme 2022-03-29 14:35:55 +02:00
rust-toolchain.toml Add readme 2022-03-29 14:35:55 +02:00
shell.nix Add nix flake 2022-03-29 21:38:03 -07:00

Yet another n-body simulation in Rust

This is a weekend project utilizing several technologies:

  • Bevy - game engine
  • egui - UI elements
  • webassembly - wasm-bindgen is used to compile Rust to webassembly which can be run in the browser

The code to calculate velocities of objects is naive all pairs algorithm which can handle up to 1000 objects in 60.0 FPS on a laptop. Web version is 4x slower which means it can handle around 500 objects.

Screenshot

planet simulation

Demo

https://pjankiewicz.github.io/nbody/index.html

Running desktop application

cargo run --release

Building webassembly version

cargo build --release --target wasm32-unknown-unknown
wasm-bindgen --out-dir ./out/ --target web ./target/wasm32-unknown-unknown/release/nbody.wasm

Running

python -m http.server

And navigate to http://localhost:8000 in your browser.