fuzzyworld

herd / files / README.md

README.md

Blame: the commit that last changed each line ยท file ยท history

1a83062c 2026-05-17 Pavel Safronov1# Herd ๐Ÿ‘
2
3A browser game about herding sheep. Tap the field to move your border collie and guide the flock into the pen before time runs out.
4
5a542e96 2026-10-27 Pavel Safronov5**[Play it โ†’](https://apps.fuzzyworld.net/herd/)**
1a83062c 2026-05-17 Pavel Safronov6
7---
8
9## How to Play
10
11- **Tap / click** anywhere on the field to send the dog to that spot.
12- The dog scares nearby sheep โ€” use this to push the flock toward the pen.
13- Get enough sheep inside the pen to win the level.
14- If the timer runs out before the flock is penned, you lose.
15
16Sheep flock together naturally, so a little pressure in the right direction goes a long way. Chasing them head-on scatters the herd โ€” work from the sides and behind.
17
18---
19
20## Tech Stack
21
22| Tool | Role |
23| --- | --- |
24| TypeScript | Language |
25| Vite | Dev server & bundler |
26| HTML5 Canvas | Rendering |
27| npm | Package management |
28| GitLab Pages | Hosting |
29
30No game engine โ€” physics, flocking AI, and rendering are all hand-rolled.
31
32---
33
34## Development
35
36### Prerequisites
37
38- Node.js 20+
39- npm 10+
40
41### Setup
42
43```bash
5a542e96 2026-10-27 Pavel Safronov44git clone https://code.fuzzyworld.net/herd.git
1a83062c 2026-05-17 Pavel Safronov45cd herd
46npm install
47```
48
49### Run locally
50
51```bash
52npm run dev
53```
54
55Opens at `http://localhost:5173`.
56
57### Build
58
59```bash
60npm run build # outputs to dist/
61npm run preview # serve the production build locally
62```
63
64---
65
66## Deployment
67
68Pushes to `main` automatically deploy to GitLab Pages via `.gitlab-ci.yml`. The live URL is `https://<namespace>.gitlab.io/herd`.
69
70---
71
72## Project Structure
73
74```text
75src/
76โ”œโ”€โ”€ main.ts # entry point
77โ”œโ”€โ”€ math/Vec2.ts # immutable 2D vector math
78โ”œโ”€โ”€ game/ # loop, canvas setup, game state machine
79โ”œโ”€โ”€ entities/ # Sheep, Dog, Pen
80โ”œโ”€โ”€ ai/Boids.ts # flocking forces (separation, alignment, cohesion, flee)
81โ”œโ”€โ”€ input/ # pointer event โ†’ world coordinate mapping
82โ””โ”€โ”€ levels/ # level configs (sheep count, pen size, time limit)
83```
84
85The sheep use a [boids](https://www.red3d.com/cwr/boids/) flocking algorithm extended with a flee force triggered by the dog's proximity.
86
87---
88
89## Credits
90
91Grass / field icon (favicon + logo) by [Icongeek26](https://www.flaticon.com/authors/icongeek26) from the [Flaticon outline collection](https://www.flaticon.com/authors/icongeek26/outline?author_id=296&type=standard).
92
93---
94
95## License
96
97MIT