Initial commit.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
# Super Auto Pets: The Board Game — Online
|
||||
|
||||
A web app for playing the Super Auto Pets board game remotely. 1v1 for now;
|
||||
the engine is built to grow to more players.
|
||||
|
||||
## Stack
|
||||
|
||||
- **Backend**: Go (stdlib-first). Pure game engine in `internal/game`,
|
||||
WebSocket sync via `coder/websocket`, persistence as JSON blobs in SQLite
|
||||
(`modernc.org/sqlite`, no cgo).
|
||||
- **Frontend**: React + Vite + TypeScript in `web/`. DOM/CSS card rendering
|
||||
and battle animations.
|
||||
- **Tasks**: [mise](https://mise.jdx.dev) (`mise.toml`).
|
||||
|
||||
## Quick start
|
||||
|
||||
```sh
|
||||
mise run install-web # once: npm install
|
||||
mise run serve # build frontend + server, run on :8080
|
||||
```
|
||||
|
||||
Open http://localhost:8080, host a game, and join from another browser (or
|
||||
incognito window) with the 5-letter code.
|
||||
|
||||
### Development
|
||||
|
||||
```sh
|
||||
mise run dev # Go server on :8080 + Vite hot reload on :5173
|
||||
mise run test # Go tests (game engine)
|
||||
mise run check # go vet + frontend type-check
|
||||
```
|
||||
|
||||
During development open the Vite URL (http://localhost:5173); it proxies
|
||||
`/api` (including the WebSocket) to the Go server.
|
||||
|
||||
## Configuration
|
||||
|
||||
Set via environment or a `.env` file (see `.env.example`):
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
| ------------ | ---------- | ------------------------------------ |
|
||||
| `DATA_DIR` | `data` | Directory holding the SQLite DB |
|
||||
| `PORT` | `8080` | HTTP port |
|
||||
| `STATIC_DIR` | `web/dist` | Built frontend to serve |
|
||||
|
||||
## Rules implemented
|
||||
|
||||
Six rounds, each with its own shop tier deck. Per round:
|
||||
|
||||
1. **Shop** — each player has 3 coins and players alternate actions, 1 coin
|
||||
each: **buy** one of 4 face-up cards; **discard** any number of hand cards
|
||||
(each becomes an 🍎 apple, +1 power food); or **trade in** 3 same-suit pets
|
||||
to pick 1 of the top 2 cards of the next tier's deck (the other goes under
|
||||
that deck). Passing forfeits remaining coins.
|
||||
2. **Cleanup** — anyone holding more than 5 pets must discard down to 5
|
||||
(discards become apples).
|
||||
3. **Arrange** — players secretly order their decks. Food cards apply to the
|
||||
next pet after them; trailing foods are wasted.
|
||||
4. **Battle** — automatic. Front pets simultaneously deal their full power to
|
||||
each other as damage markers; a pet with markers ≥ power dies (attack
|
||||
power never drops while wounded). Last player with pets standing wins the
|
||||
round: 1 trophy for rounds 1–5, 2 trophies for round 6. Draws award
|
||||
nothing.
|
||||
|
||||
Most trophies after round 6 wins. Pet effects are not yet implemented (the
|
||||
card model carries an `effect` field for when they land).
|
||||
|
||||
## Layout
|
||||
|
||||
```
|
||||
cmd/server/ entrypoint
|
||||
internal/game/ rules engine (pure, fully tested)
|
||||
internal/server/ HTTP + WebSocket rooms
|
||||
internal/store/ SQLite persistence
|
||||
internal/env/ .env loading
|
||||
web/ React frontend
|
||||
```
|
||||
Reference in New Issue
Block a user