bg3d
bg3d copied to clipboard
A multiplayer boardgame engine in Three.JS + Rust

Board Games in 3D!
This is a board game engine created in Three.js and Rust, designed to make it as easy as possible to start playing a boardgame online.
Try it now!, also check out the itch.io page.
Building
Building is simple. You will need a recent version of Rust + NPM.
First, install the npm packages with npm install
. Next, run build.sh
. You're done!
(Right now I'm patching Three.js to only export /src/Three.js
, for better tree-shaking).
Usage
All lobbies are given a unique URL: https://example.com/lobby_name
. You can
give a lobby a custom name, or get a random one generated by visiting the base URL.
Controls:
- Left click and drag to orbit
- Shift click and drag to pan
- Scroll wheel to zoom
- Click and drag to move objects
- T to take an object or card from a bag or deck
- G to add a card to your hand
- And of course Right click any object for more!
Making games
Creating a new game is easy. Just zip up your assets with a manifest.json
along with a script like game.js
.
Then just drag your zip file onto the game window.
You can register up to 40MiB of assets (each under 2 MiB), which will be stored and distributed on the server until the lobby closes.
Warning: Your game code runs in a web worker, which means that any state or logic can't be transferred.
If the host leaves, all other users will be kicked out to prevent broken games.
If you don't want this to happen, call self.world.close()
to indicate that your plugin is done.
There isn't any documentation yet, but take a look at static/js/prelude.js
and plugins/*/
for guidance.
For models:
- Add colliders to GLTF files by adding a custom
collider
property set to eitherbox
orcylinder
. - Units are in inches.