Giter Club home page Giter Club logo

rusty-sandbox's Introduction

Rusty Sandbox

A lightweight sandbox sim written in Rust.

Play via Browser (WASM) | Compile by yourself

This is a quick hobby project written to practice three things: Rust, Macroquad and Maths!


Dev Builds

Prerequisites: The Rust Toolchain (stable preferred).

Local Compile (For your architecture)
git clone https://github.com/JSKitty/rusty-sandbox.git && cd rusty-sandbox
cargo run --release
cargo build --release
WASM Compile (For web-based usage like this!)
git clone https://github.com/JSKitty/rusty-sandbox.git && cd rusty-sandbox
rustup target add wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknown

Aim / Goals

The primary aims of the project being:

  • Minimalistic codebase: easy to follow, easy to learn from, a 'living' tutorial.
  • Low Dependency: as much written in-house as possible, such as physics algorithms, etc.
  • Lightweight: should compile super fast, and execute super fast by users.
  • Fun: should be pretty fun to play with! Both in code and in user-land.

rusty-sandbox's People

Contributors

jskitty avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

rusty-sandbox's Issues

Occasional crashes when resizing window

The sandbox is intended to scale 'on-demand' to how the user shapes their window: adding X/Y coords when the screen exceeds the world space, however, when particles sometimes spill into 'newly-generated' screen space, there can be out-of-bounds panics.

Likely an issue with the on-demand screen space generation, and likely very easy to fix. (when I'm not dead sleepy). ๐Ÿ’ค

Engine loop scales worse than expected

The engine loop (consisting of both Physics and Rendering) is a fair bit slower than I'd expect with the hardware it runs on, often fully maxing out a CPU core with a decent simulation; I suspect there's a lot of optimisations that could be done to help with this, such as better re-sim protection (perhaps only track 'changed state' particles rather than ALL rendered particles?).

We could also potentially implement a system to 'deactivate' buried particles, since if a particle is surrounded below (y + 1) or either side (x +/-) then it cannot possibly move, yet is still included within full physics computation.

And lastly, which is most effective but highly challenging; we could potentially think about multi-threading the engine, but due to it's high reliance on a singular state (how would we be able to simulate two particles at once on two separate threads without a 'desync' in physics determinism?) this may be fairly hard to do.

Live Task List:

  • Optimise the re-sim protection by only tracking particle state changes.
  • 'Deactivate' still particles (i.e; unable to move) from the physics loop.
  • Introduce multi-threading in some form.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.