quill/val Public Public: anyone can read this; nobody can change it.

forked from benjivers/val

workbenchthis machine
Files 00e29188271b60cb71e377df120e603f5649cfdb
96 lines · 4.9 KB · ~1.2k tok Raw History
1
# val
2
3
Five attackers with the spike, five defenders, abilities on cooldown. First to 13.
4
5
A 5v5 played in a browser, from inside the player's head — the map is a tile
6
grid and the view is a raycaster over it, so there is no 3D library and no
7
dependency at all. One match is always running on the server: open the page
8
and you are given a seat in the round that is happening, taken from a bot
9
where it stands. When a match ends it shows the result for a few seconds and
10
starts a new one, so nobody ever arrives at a frozen board.
11
12
## What is real
13
14
Everything that decides a round is computed on the server and only the
15
server:
16
17
- **Movement, shooting and hit detection.** The client sends intent — a
18
  direction, an angle, a held key — never a position. Damage is by hit
19
  location (how close the ray passes the target) with falloff and armour:
20
  a Vandal head shot kills through full armour at any range, a Phantom's
21
  does not past fifteen metres.
22
- **Line of sight.** A snapshot only carries the enemies that viewer can
23
  see. A wall of the map blocks the sight line, a smoke blocks it, a flash
24
  blinds by the angle you were facing, and a blinded player is sent no
25
  enemies at all. A dead player watches through their living team mates'
26
  eyes rather than through walls, so dying is not a wallhack to call out.
27
  No spawn can see the other spawn: mid is staggered on purpose. A patched
28
  client learns nothing a plain one does not.
29
- **The spike.** 100s round, 4s plant, 45s fuse, 7s defuse with a
30
  checkpoint at 3.5s — a defender killed past half way leaves the defuse
31
  half done for the next one.
32
- **Credits.** 800 to start, 9,000 cap, +200 a kill, +300 to the team on a
33
  plant, loss bonus 1,900 / 2,400 / 2,900. A buy you cannot afford is
34
  refused server-side.
35
- **Bots** fill every empty seat and use their kit: smokes on the way in,
36
  flashes before the entry, a recon dart, a molly on the planted spike.
37
38
Agents: Ember, Veil, Sable, Mender, Rook — two basics bought with credits
39
(charges last the round), a free signature on a cooldown, and an ultimate
40
paid for with ult points from kills, plants and the two orbs on the map.
41
42
Guns: Classic, Ghost, Sheriff, Spectre, Phantom, Vandal, Operator.
43
44
## What is not
45
46
- The view is a raycaster: walls are one tile tall and flat-shaded, there is
47
  no looking up or down, and everything that is not a wall — bodies, the
48
  spike, ability zones — is a flat billboard scaled by distance and clipped
49
  against the walls.
50
- One map, one match at a time, ten seats. There is no matchmaking, no
51
  ranking and no account: your seat belongs to a session cookie.
52
- No overtime — first to 13 ends it at 12–12 too.
53
- Sight is a full circle rather than a view cone — you are drawn what is in
54
  front of you, but the server reveals anything you have line of sight to,
55
  so a team mate behind you still appears on the minimap. The world has no
56
  vertical, so the hit location comes from how precisely the shot passes
57
  the target.
58
- Assists are counted as a field but never awarded.
59
- The live match lives in memory and is gone if the process restarts; only
60
  finished match results are written to SQLite under `FORGE_APP_DATA`.
61
62
## Playing
63
64
Click the view to capture the mouse, then WASD move and the mouse looks;
65
**Esc** gives the pointer back. Click fires, **R** reloads, **F** plants and
66
defuses (hold it), **C / Q / E / X** cast, **B** opens the buy, **Tab**
67
holds the big map open, **V** swaps to the top-down view and **H** or **?**
68
brings back the how-to-play card. On a phone it stays top-down: the left
69
thumb walks and the right thumb aims and fires.
70
71
```sh
72
PORT=8080 FORGE_APP_DATA=./data bun run src/server.ts   # run it here
73
bun test                                                # the check every pull runs
74
VAL_URL=http://127.0.0.1:8080 bun run src/tty.ts        # the terminal interface
75
```
76
77
The terminal plays the same match over the same socket: it draws the grid,
78
the scoreboard and the round, and takes a seat. The exact command that
79
reaches it is in `FORGE_APP_SSH` when the app runs, and the page prints it.
80
81
The forge sets `PORT`, `FORGE_APP_DATA`, `FORGE_APP_ENV`, `FORGE_APP_URL`,
82
`FORGE_APP_SSH` and `FORGE_APP_COMMIT` when it starts the app; `forge.json`
83
says how.
84
85
## Shape
86
87
`src/map.ts` the grid and its geometry · `src/weapons.ts` the damage table ·
88
`src/economy.ts` credits · `src/abilities.ts` the agent kits ·
89
`src/match.ts` the round loop (`tick(state, dt)` is the whole game and takes
90
no clock) · `src/bots.ts` the seats nobody is in · `src/arena.ts` the one
91
live match and its sockets · `src/server.ts` the door · `static/` the browser client —
92
`val.js` wires the socket, the keys and the HUD, `raycast.js` is the ray
93
maths, `scene.js` the first-person view, `topdown.js` the minimap,
94
`gun.js`, `beep.js`, `steer.js` and `prompt.js` the rest; the server bundles
95
them into one content-named file at start-up. The rules are pure functions and the tests play whole matches
96
headlessly.
↑↓ navigate ↵ open esc close
↑↓ navigate ↵ open esc close

Keyboard shortcuts