Skip to content

A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly.

License

Notifications You must be signed in to change notification settings

ben9583/solar-sim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solar Sim 🪐

A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly.

Try the latest version here!

Travis CI Build Status

Built with 🦀🕸 by The Rust and WebAssembly Working Group

Preview of Solar Sim

About

This is a hobby project I started in 2020 as part of a project about Lagrange points for an astronomy class I took. Originally, this was written purely in JavaScript, but the performance was quite bad even on my i9 MacBook Pro and had a lot of stuttering, especially on Firefox. Almost 2 years later, I decided to return to the project to see if I could make it more useful for other people.

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.

Install

Before getting started, you will need NodeJS v16 and the Rust Toolchain.

Once you have these, begin by cloning the repo and updating rustup:

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 nvm.

cd website-src
npm install
cd ..

Develop

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 ./pkg.

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

Build

Finally, to make a production-ready build, use npm run build to generate a static website in website-src/dist:

cd website-src
npm run build

Links

About

A planetary body simulator with a HTML5/CSS3/JS frontend and simulated using Rust WebAssembly.

Resources

License

Stars

Watchers

Forks

Packages

No packages published