WordGrid/README.md

25 lines
1.7 KiB
Markdown
Raw Normal View History

2023-09-24 17:52:58 +00:00
# README
2024-12-26 18:54:30 +00:00
This repository contains the code for 'WordGrid', a browser game where you use letter tiles to form words.
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
There is support for both multiplayer and singleplayer, where singleplayer runs entirely in the browser through WebAssembly.
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
Here's the rough layout of the repository:
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
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.
2024-02-11 20:11:12 +00:00
2024-12-26 18:54:30 +00:00
If you want to try it now, I host a version at https://wordgrid.joeltherrien.ca
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
## Setup
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
I'd suggest just reading through the `Dockerfile` to precisely see what to do, but it's basically the following steps:
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
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`.
2023-09-24 17:52:58 +00:00
2024-12-26 18:54:30 +00:00
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.