WordGrid/README.md

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:

  1. The core game logic resides in the wordgrid/ folder as Rust code and is a library for either the wasm/ code (if compiled to WebAssembly for singleplayer), or for the server/ code (if used in multiplayer).
  2. The Rust code in wasm/ is a small compatibility layer between the library and the browser. It gets compiled using wasm-pack to a Node package into wasm/pkg/ that gets read by ui/
  3. 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 the wasm/ code has been built.
  4. 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:

  1. Ensure you have Rust, Node, npm, and wasm-pack installed.
  2. Build wasm by navigating to the wasm/ folder and running wasm-pack build --target=web
  3. Build the ui by navigating to the ui/ folder and running npm run build. You may need to first run npm install.
  4. Build the server by navigating to the server/ folder and running cargo 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.