Shows how to use matchbox_socket
with bevy
and ggrs
using bevy_matchbox
and bevy_ggrs
, to create a simple working browser "game" (if moving cubes around on a plane can be called a game).
There is a live version here (move the cube with WASD):
- 2-Player: https://helsing.studio/box_game/
- 3-Player: https://helsing.studio/box_game/?players=3
- N-player: Edit the link above.
When enough players have joined, you should see a couple of boxes, one of which
you can move around using the WASD
keys.
You can open the browser console to get some rough idea about what's happening (or not happening if that's the unfortunate case).
- Run the matchbox-provided
matchbox_server
(help), or run your own onws://localhost:3536/
. - Run the demo (enough clients must connect before the game stats)
cargo run -- [--matchbox ws://127.0.0.1:3536] [--players 2] [--room <name>]
Install the wasm32-unknown-unknown
target
rustup target install wasm32-unknown-unknown
Install a lightweight web server
cargo install wasm-server-runner
cargo run --target wasm32-unknown-unknown
- Use a web browser and navigate to http://127.0.0.1:1334/?players=2
- Open the console to see execution logs