bevy_ggrs_rapier_example
bevy_ggrs_rapier_example copied to clipboard
Bevy GGRS Rapier example
This is my quest to get GGRS and Rapier to work together in the Bevy engine, using the plugins.
Is it perfect? No. But is well-written? Also no.
Hopefully this will serve as a crash course to getting your fun weekend project going.
Things I have going
- Deterministic physics and rollbacks (allegedly)
- Desync detection (1v1 only)
- Plenty poorly strung-together comments
- And a whole lot of debug learning
Keys
- WASD movement
- R turn on random movement for this window
- T turn off random movement for this window
Running
This demo has no menus other than the debugging inspector. This demo assumes that you will run it twice, which establishes a connection between the two and runs the simulation.
Native
From the root directory:
cargo run
In VS Code, you can also run two of them with (Ctrl|Cmd)+Shift+B, which will run the demo twice.
WASM
From the root directory (requires wasm-server-runner):
cargo run --target wasm32-unknown-unknown --features web
Or, use the wasm.sh
script which runs several commands. This will produce an
optimized WASM build and launch a test HTTP server (requires wasm-bindgen-cli,
binaryen, and simple-http-server).
You will need to launch the demo in two windows. It is recommended to not use tabs to avoid and auto-sleep behavior from your browser.
Testing
- You can test rollbacks locally
- On Linux, I use the included
slowmode.sh
script.- Run with root/sudo.
- Run again to restore.
- On Windows, I use clumsy https://jagt.github.io/clumsy/
- On Linux, I use the included
Contributing
Please do! Pull requests are always welcome; and don't be afraid to checkout the Bevy discord for more help.