twors 0.1.1

A simple Rust 2D game engine based on canvas and WASM
Documentation

TwoRS

development crates.io

Easily render 2D graphics in a canvas - entirely powered by Rust!!! :crab:

:sunglasses: Why Rust/WASM?

It's use case is either the reuse of code written in another language or to offload heavy computations to the near-native execution speeds of WASM.

However this is not free - traversing the WASM boundary means going trough some glue code and copying data from JS to the WASM module memory and back. In the case of strings it's even more expensive - because JS strings are UTF-16 and Rust strings use UTF-8 any string passtrough needs to go trough a copy AND a re-encode.

twors doesn't have any complicated physics to offload to WASM at this point in time - neither is it making use of some advanced pre-existing Rust library. So why Rust then?

Simply because Rust is the best!!!

:zap: Quick start

:pencil: Roadmap

  • Adaptive canvas resolution on resize
  • Delta time
  • Keyboard & mouse inputs
  • Component system (with init() and update() lifecycle methods)
  • Transform (with inheritance) - translate, scale
  • Collision detection
  • Bezier curves
  • FPS benchmark

:computer: Development

Experiments and manual testing are to be done in the examples/playground crate.

# convenience scripts - see "Makefile.toml" for full list of commands
cargo install cargo-make

# run local pre-commit checks - will be run on "build" automatically
cargo make install-git-hooks

cargo make build # build the "playground" crate as a WASM module
cargo make serve # like "build", but will also start a HTTP server
cargo make watch # like "serve", but will restart the server on changes

# other commands
cargo make clean
cargo make format
cargo make licenses # update licenses.html (run after dependency addition/removal)