1.7 KiB
1.7 KiB
README
This repository contains the code for 'WordGrid', a browser game where you use letter tiles to form words.
There is support for both multiplayer and singleplayer, where singleplayer runs entirely in the browser through WebAssembly.
Here's the rough layout of the repository:
- The core game logic resides in the
wordgrid/
folder as Rust code and is a library for either thewasm/
code (if compiled to WebAssembly for singleplayer), or for theserver/
code (if used in multiplayer). - The Rust code in
wasm/
is a small compatibility layer between the library and the browser. It gets compiled usingwasm-pack
to a Node package intowasm/pkg/
that gets read byui/
ui/
is a Node package that uses React & Typescript. Currently it assumes it's being run in an environment that supports both singleplayer & multiplayer. This can't be built until thewasm/
code has been built.server/
is a Rust program that runs a small web server for multiplayer purposes.
If you want to try it now, I host a version at https://wordgrid.joeltherrien.ca
Setup
I'd suggest just reading through the Dockerfile
to precisely see what to do, but it's basically the following steps:
- Ensure you have Rust, Node, npm, and wasm-pack installed.
- Build wasm by navigating to the
wasm/
folder and runningwasm-pack build --target=web
- Build the ui by navigating to the
ui/
folder and runningnpm run build
. You may need to first runnpm install
. - Build the server by navigating to the
server/
folder and runningcargo build --release
.
If you just want singleplayer, you can stop after step 3 and the static files you'll want are in ui/dist/
. You can rename singleplayer.html
-> index.html
if you want to save a click.