Back to winniegolf
SOURCE / PINNED RELEASE

Made of little things.

winniegolf

Release
017b791c0f4b…
Author-recorded commit
612845c125fd…
License
LICENSE
Author’s source reference
nostr://npub18weq5jzw27gkhwcuf6gu57alcptjdvh78nlulgpkz8s7pnlxfnnspc00s9/wss%3A%2F%2Fgit.napplet.soy%2F/n-2d501957e21

Archive hash verified: 713b42364f27a576…. The source-to-build association is the author’s claim; it has not been independently rebuilt.

docs/level-authoring.md
# Design a Winnie Golf hole — hand-off brief

Give this whole document to a fresh chat. The designer only returns filled-in
level blocks. The implementer pastes them into `src/game/levels.ts`. No other
context is needed.

---

## The game, in one paragraph

Top-down mini golf. Five (or more) holes on a **560 × 400** board. You putt a
white ball (radius **13**) into a cup (radius **19**) in as few strokes as
possible. Aim by pointing, set power on a slider, putt. Rails bounce, sand
kills speed, water loses the ball, one blade sweeps. **Do not invent new
objects, new surfaces, new physics, or new art.** Use only the pieces below.

---

## Hard rules for the designer

- Reuse **only** these objects: `walls` (rectangles), `sand` (rectangles),
  `land` (rectangles that are dry; everything else is water), `bumpers`
  (circles), `spinners` (one rotating blade), plus a `tee` and a `cup`.
- Always start `walls` with the outside frame (see helper below).
- Playable interior is roughly **(16, 16) to (544, 384)**.
- Do not change physics numbers, palette, HUD, controls, or the renderer.
- Hole names are short (one or two words). `hint` is one sentence, shown
  in-game.
- Par is **2–5**. Par 2 = open, par 5 = the meanest of the set.
- `id` is the hole number, 1-based, in play order.
- `w` and `h` are always `560` and `400`.

---

## The level shape (copy this)

```ts
{
  id: 1,
  name: 'Short name',
  hint: 'One sentence the player sees.',
  par: 3,
  w: 560,
  h: 400,
  tee: { x: 80, y: 320 },
  cup: { x: 480, y: 90 },
  walls: [
    // ALWAYS start with the frame:
    { x: 0, y: 0, w: 560, h: 16 },          // top
    { x: 0, y: 384, w: 560, h: 16 },        // bottom
    { x: 0, y: 16, w: 16, h: 368 },         // left
    { x: 544, y: 16, w: 16, h: 368 },       // right
    // ...then any extra walls (blocks, dividers, gate cheeks)
  ],
  sand: [ { x, y, w, h } ],                 // [] if none
  land: null,                               // null = whole hole is grass
  bumpers: [ { x, y, r } ],                 // [] if none
  spinners: [ { cx, cy, half, thick, speed, phase } ], // [] if none
}
```

Round par is computed automatically from the list. You do not write a total.

---

## What each piece does (design consequences)

### `tee` and `cup`

- `tee` is where the ball starts. Keep it **≥ 30 units** from any wall and
  **≥ 40 units** from the cup.
- `cup` is the hole. A ball whose **centre** is within **19** units and moving
  slower than **250** drops in. A slow ball within **25** is pulled in.
- Do not sit the cup inside sand, water, or a wall.

### `walls` — rails and blocks

- Axis-aligned rectangles. The ball (radius 13) bounces off them with
  **0.72** restitution (they eat a little speed).
- Always include the four frame pieces listed above (`RAIL = 16`).
- Extra walls are fairway furniture: dividers, gate cheeks, pillars.
- Leave gaps of at least **40 units** (ball is 26 wide) if you want the ball
  to pass through. **54+** is a comfortable gate.

### `sand` — bunkers

- A rectangle of sand. The ball slows the moment its **edge touches** the
  rect (not only the centre). Deceleration is **850** vs **135** on grass, so
  sand is a real carry.
- To carry a sand slab of width `W`, the ball needs roughly
  `speed ≈ sqrt(2 × 850 × (W + 13))` at the entry edge, after grass travel.
  A full-width bunker of **150** units needs a firm putt.
- Sand is drawn as a rounded blob; the collision is the plain rect.
- Sand does **not** cost a stroke. The ball plays from where it stops.

### `land` — dry ground, or water everywhere else

- `land: null` → the whole hole is grass. Use this unless you are making a
  water hole.
- `land: [rects]` → those rects are dry. **Every point not inside a land rect
  is water.**
- Water takes the ball only when the **centre** leaves all land rects. The
  edge may hang over the water — that is how a narrow bridge is threaded.
- Wet = **+1 stroke** and back to the last dry resting spot.
- Keep land bridges at least **45 units** wide for a threadable line
  (ball is 26 wide). Overlap land rects slightly (1–2 units) so there is no
  diagonal gap.

### `bumpers` — pegs

- Circles. Restitution **1.14** — they are bouncier than rails.
- Keep `r` between **18 and 28** (existing holes use 24).
- Do not place a bumper on the tee, the cup, or inside a wall.

### `spinners` — one windmill blade

- A bar of length `half * 2`, thickness `thick`, rotating around `(cx, cy)`
  at `speed` radians/second. `phase` is the starting angle in radians
  (`0` to `Math.PI * 2`).
- Existing hole uses: `half: 120, thick: 16, speed: 1.7, phase: 0`.
- The blade hits like a wall and drags the ball. Leave a timed gate of
  **54+** units between the blade sweep and a wall.
- One spinner per hole is plenty. Two is chaos unless that is the point.

---

## Numbers you may reuse (do not change them)

| Thing | Value |
| --- | --- |
| Board | 560 × 400 |
| Rail thickness | 16 |
| Ball radius | 13 |
| Cup radius | 19 |
| Cup pull radius | 25 |
| Max shot speed | 620 |
| Min shot speed | 95 |
| Grass decel | 135 |
| Sand decel | 850 |
| Wall bounce | 0.72 |
| Bumper bounce | 1.14 |

---

## The five shipped holes (style reference)

Copy their shape. Do not restyle them unless asked.

```ts
// 1 · First Light — par 2 — open diagonal, two block obstacles
{
  id: 1, name: 'First Light', hint: 'A clean line to the cup.', par: 2,
  w: 560, h: 400,
  tee: { x: 85, y: 300 }, cup: { x: 475, y: 110 },
  walls: [
    { x: 0, y: 0, w: 560, h: 16 },
    { x: 0, y: 384, w: 560, h: 16 },
    { x: 0, y: 16, w: 16, h: 368 },
    { x: 544, y: 16, w: 16, h: 368 },
    { x: 230, y: 40, w: 80, h: 70 },
    { x: 300, y: 290, w: 80, h: 70 },
  ],
  sand: [], land: null, bumpers: [], spinners: [],
}

// 2 · Dogleg — par 3 — long divider, thread the right gap, bank back
{
  id: 2, name: 'Dogleg', hint: 'Thread the gap on the right, then bank back to the cup.', par: 3,
  w: 560, h: 400,
  tee: { x: 80, y: 320 }, cup: { x: 170, y: 70 },
  walls: [
    { x: 0, y: 0, w: 560, h: 16 },
    { x: 0, y: 384, w: 560, h: 16 },
    { x: 0, y: 16, w: 16, h: 368 },
    { x: 544, y: 16, w: 16, h: 368 },
    { x: 16, y: 170, w: 360, h: 18 },
    { x: 280, y: 90, w: 90, h: 60 },
  ],
  sand: [], land: null, bumpers: [], spinners: [],
}

// 3 · Sandbar — par 3 — full-height bunker, then a gate onto the cup
{
  id: 3, name: 'Sandbar', hint: 'Carry the bunker, then thread the gate.', par: 3,
  w: 560, h: 400,
  tee: { x: 80, y: 193 }, cup: { x: 500, y: 193 },
  walls: [
    { x: 0, y: 0, w: 560, h: 16 },
    { x: 0, y: 384, w: 560, h: 16 },
    { x: 0, y: 16, w: 16, h: 368 },
    { x: 544, y: 16, w: 16, h: 368 },
    { x: 390, y: 16, w: 70, h: 120 },
    { x: 390, y: 250, w: 70, h: 134 },
  ],
  sand: [{ x: 170, y: 16, w: 150, h: 368 }],
  land: null, bumpers: [], spinners: [],
}

// 4 · Windmill — par 5 — timed blade, two pegs, gate onto the cup
{
  id: 4, name: 'Windmill', hint: 'Time the blade, then thread the gate.', par: 5,
  w: 560, h: 400,
  tee: { x: 80, y: 340 }, cup: { x: 510, y: 133 },
  walls: [
    { x: 0, y: 0, w: 560, h: 16 },
    { x: 0, y: 384, w: 560, h: 16 },
    { x: 0, y: 16, w: 16, h: 368 },
    { x: 544, y: 16, w: 16, h: 368 },
    { x: 400, y: 16, w: 70, h: 90 },
    { x: 400, y: 160, w: 70, h: 80 },
  ],
  sand: [], land: null,
  bumpers: [{ x: 120, y: 90, r: 24 }, { x: 470, y: 310, r: 24 }],
  spinners: [{ cx: 250, cy: 200, half: 120, thick: 16, speed: 1.7, phase: 0 }],
}

// 5 · Island Green — par 4 — water everywhere except a winding land path
// Water only takes the ball when its CENTRE leaves the land.
{
  id: 5, name: 'Island Green', hint: 'Stay on the dry line. Water costs a stroke.', par: 4,
  w: 560, h: 400,
  tee: { x: 110, y: 325 }, cup: { x: 455, y: 85 },
  walls: [
    { x: 0, y: 0, w: 560, h: 16 },
    { x: 0, y: 384, w: 560, h: 16 },
    { x: 0, y: 16, w: 16, h: 368 },
    { x: 544, y: 16, w: 16, h: 368 },
  ],
  sand: [],
  land: [
    { x: 40, y: 280, w: 150, h: 90 },
    { x: 190, y: 300, w: 210, h: 45 },
    { x: 365, y: 130, w: 45, h: 170 },
    { x: 365, y: 40, w: 155, h: 90 },
  ],
  bumpers: [], spinners: [],
}
```

---

## What the designer returns

For each new hole, one filled-in block in the shape above, plus:

- **where it goes** in the order (after hole 5, or replacing a hole, or a
  new pack),
- **par**,
- a one-line **intent** (“carry a wide bunker then a tight gate”).

Nothing else. No TypeScript helpers, no render code, no physics, no names of
new objects.

## What the implementer does with it

1. Paste the block into `LEVELS` in `src/game/levels.ts` with the next `id`.
2. Keep `w: COURSE_W, h: COURSE_H` and reuse `frame(...)` for the border.
3. `ROUND_PAR` updates itself.
4. Run `pnpm type-check && pnpm build`. Play the hole. Fix only geometry if
   the tee, cup, or a gate is unreachable. Do not add new mechanics.

---

## Quick quality checklist

- [ ] Frame walls present
- [ ] Tee and cup on dry grass (or on `land`), not inside a wall/sand/water
- [ ] Any gap the ball must pass through is ≥ 40 units (54 for a comfortable gate)
- [ ] Land bridges ≥ 45 units if water is used
- [ ] Par matches the trouble (2 open, 3 one idea, 4 two ideas, 5 mean)
- [ ] No new object types, no new surfaces, no physics changes
- [ ] Hint is one player-facing sentence