A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly.
Built with 🦀🕸 by The Rust and WebAssembly Working Group
Now that it uses Rust WebAssembly, the performance is significantly better and uses much less CPU. I’m looking to expand the functionality by allowing users to add and remove planets, change the speed of the simulation, and maybe expand from Lagrange points to other educational topics about space, such as the Three-Body Problem.
Before getting started, you will need NodeJS v16 and the Rust Toolchain.
Once you have these, begin by cloning the repo and updating
git clone https://github.com/ben9583/solar-sim.git solar-sim cd solar-sim rustup update
You will also need to install the requisite
npm packages. Remember to be on NodeJS v16 if you use
cd website-src npm install cd ..
Ensure you are in the root directory of this project. Begin by creating the
npm package using
wasm-pack; this will create the package in
cargo install wasm-pack wasm-pack build
To start the website for development, run the following command in
website-src. This will reload the website when you make a change or run
wasm-pack build again.
cd website-src npm start
Finally, to make a production-ready build, use
npm run build to generate a static website in
cd website-src npm run build
console_error_panic_hookfor logging panic messages to the developer console.
wee_alloc, an allocator optimized for small code size.