ball2d 0.2.3 → 0.3.2-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +16 -22
  2. package/dist/browser.js +7500 -3564
  3. package/dist/core.wasm +0 -0
  4. package/dist/licenses/native.json +6 -0
  5. package/dist/licenses/valibot.txt +9 -0
  6. package/dist/node.js +33 -33
  7. package/dist/stadiums/asphalt.ball2dstadium +515 -0
  8. package/dist/stadiums/{big_hockey.hbs → asphalt_arena.ball2dstadium} +118 -119
  9. package/dist/stadiums/{big.hbs → big.ball2dstadium} +16 -16
  10. package/dist/stadiums/{big_easy.hbs → big_easy.ball2dstadium} +16 -16
  11. package/dist/stadiums/{big_rounded.hbs → big_rounded.ball2dstadium} +20 -20
  12. package/dist/stadiums/{classic.hbs → classic.ball2dstadium} +16 -16
  13. package/dist/stadiums/courtyard.ball2dstadium +611 -0
  14. package/dist/stadiums/{easy.hbs → easy.ball2dstadium} +16 -16
  15. package/dist/stadiums/{huge.hbs → huge.ball2dstadium} +16 -16
  16. package/dist/stadiums/meadow.ball2dstadium +611 -0
  17. package/dist/stadiums/provenance.json +36 -20
  18. package/dist/stadiums/{rounded.hbs → rounded.ball2dstadium} +20 -20
  19. package/dist/stadiums/{small.hbs → small.ball2dstadium} +16 -16
  20. package/dist/stadiums/{hockey.hbs → street_five.ball2dstadium} +82 -83
  21. package/dist/stadiums/training_green.ball2dstadium +611 -0
  22. package/dist/types/browser.d.ts +10 -0
  23. package/dist/types/commentary.d.ts +276 -0
  24. package/dist/types/config.d.ts +3 -0
  25. package/dist/types/creation.d.ts +3 -0
  26. package/dist/types/match-intelligence.d.ts +128 -0
  27. package/dist/types/match-state.d.ts +8 -2
  28. package/dist/types/match-xg-runtime.d.ts +37 -0
  29. package/dist/types/match-xg.d.ts +88 -0
  30. package/dist/types/node.d.ts +6 -2
  31. package/dist/types/player.d.ts +2 -0
  32. package/dist/types/replay.d.ts +1 -1
  33. package/dist/types/room-geo.d.ts +6 -0
  34. package/dist/types/room-hooks.d.ts +48 -0
  35. package/dist/types/room.d.ts +29 -31
  36. package/package.json +2 -1
package/README.md CHANGED
@@ -4,11 +4,10 @@ Host a Ball2D football room on your own server and control it through a typed
4
4
  JavaScript API. The host runs the simulation; players connect directly over
5
5
  WebRTC. Ball2D provides authorization, room discovery and signaling.
6
6
 
7
- **SDK version: 0.2.3.** Requires the matching Ball2D web engine. Production
8
- acceptance verified account-issued keys, Node admission, quota rejection, a real
9
- same-Mac Chrome player's movement/replay, revocation and native cleanup.
10
- The verified native platform is Node 24.19.0 on macOS arm64. These checks do not
11
- establish broad device, operating-system or WAN support.
7
+ **Current candidate: 0.3.2-next.0.** It uses engine identity
8
+ `98c92c27828179bc4258` and room protocol 5. Install this candidate with
9
+ `npm install ball2d@next` after publication; the `latest` tag stays on the
10
+ previously accepted release. Recordings and stadium geometry differ from 0.2.x.
12
11
 
13
12
  Repository maintainers: [local setup](https://github.com/fillbyte/ball2d/blob/main/docs/DEVELOPMENT.md) · [release procedure](https://github.com/fillbyte/ball2d/blob/main/docs/RELEASING.md) · [changelog](https://github.com/fillbyte/ball2d/blob/main/CHANGELOG.md).
14
13
 
@@ -18,7 +17,7 @@ Use Node.js 24 or newer. The verified native runtime is Node.js 24.19.0 on macOS
18
17
  arm64; other systems need independent acceptance. Native transport is experimental.
19
18
 
20
19
  ```sh
21
- npm install ball2d@0.2.3
20
+ npm install ball2d@next
22
21
  ```
23
22
 
24
23
  Create an API key through your Ball2D account.
@@ -98,12 +97,10 @@ native declarations do not require DOM/WebRTC globals or `skipLibCheck`.
98
97
  - **Players and lobby:** inspect players, assign teams/admins, lock teams, kick/ban,
99
98
  manage admission, send chat and announcements, and configure the room.
100
99
  - **Matches:** start/stop, pause/resume, score/time limits, kick-rate limits and
101
- `await room.setSurfaceEnabled(true)` for wet grass and ground wear. Pass `false`
102
- to restore dry ground. Stop the match before changing the surface; loading a
103
- stadium resets it. Surface changes are retained in replays.
104
- - **Physics and stadiums:** load custom stadium text, select ten bundled defaults,
100
+ team controls.
101
+ - **Physics and stadiums:** load custom stadium text, select fourteen bundled defaults,
105
102
  query and modify supported player/disc properties, and use `CollisionFlags`.
106
- - **Events:** player join/leave/chat, team/admin changes, ball kicks, goals,
103
+ - **Events:** player join/leave/input/chat, team/admin changes, ball kicks, goals,
107
104
  match ticks, position resets, victory, stadium changes and recording completion.
108
105
  - **Replay:** record and decode Ball2D recordings with their embedded stadium and
109
106
  matching engine identity.
@@ -118,6 +115,8 @@ Callbacks receive the room facade as `this`. Callback failures are reported to
118
115
  `onError`; that handler's own failures are contained. Chat filtering must return
119
116
  `false` synchronously to suppress a message. Player IDs are stable public IDs,
120
117
  not physics slots; departed player IDs are not reused within a room.
118
+ `onPlayerInput(player, prevInput)` reports accepted key-state changes. `player.input`
119
+ is the current bitmask: up `1`, down `2`, left `4`, right `8`, kick `16`.
121
120
 
122
121
  Room creation resolves only after signaling confirms host authority. An optional
123
122
  second argument `{ signal }` cancels startup. Startup has a 15-second overall
@@ -141,6 +140,10 @@ not bypass revocation or quota enforcement.
141
140
 
142
141
  ## Stadiums and replays
143
142
 
143
+ Stadium files use `.ball2dstadium` or JSON; recordings use `.ball2drep`.
144
+ Only recordings matching the current engine are accepted. Historical engine
145
+ compatibility is not part of this development baseline.
146
+
144
147
  ```js
145
148
  import { validateStadium, readReplay } from 'ball2d/node';
146
149
 
@@ -158,8 +161,8 @@ if (recording) {
158
161
 
159
162
  Validation is synchronous and does not allocate a room. Passing validation means
160
163
  the stadium can be parsed, not that all gameplay outcomes have been certified.
161
- Bundled defaults are Classic, Easy, Small, Big, Rounded, Hockey, Big Easy,
162
- Big Rounded, Big Hockey and Huge. They are Ball2D-authored procedural designs;
164
+ Bundled defaults are Classic, Easy, Small, Big, Rounded, Big Easy, Big Rounded,
165
+ Huge, Asphalt, Asphalt Arena, Courtyard, Meadow, Street Five and Training Green. They are Ball2D-authored procedural designs;
163
166
  provenance and hashes are included. Custom stadiums and embedded-stadium replays
164
167
  remain supported. Geometry and physics can differ from earlier SDK assets.
165
168
  Recordings are binary containers: use `readReplay`, not JSON parsing.
@@ -194,15 +197,6 @@ Remove secrets, personal data and private room links. Use
194
197
  [private vulnerability reporting](https://github.com/fillbyte/ball2d/security/advisories/new)
195
198
  for sensitive findings. See [contribution guidance](https://github.com/fillbyte/ball2d/blob/main/CONTRIBUTING.md).
196
199
 
197
- Production acceptance on 12 September 2026 verified a confirmed-email account
198
- creating an API key, Node.js room creation, wet-ground simulation with a Chrome
199
- player, a second room rejected by the key quota, and active-key revocation closing
200
- the official host and rejecting new admission. Local verification also includes
201
- installed-package hosting, gameplay, replay and cleanup. This evidence does not
202
- establish broad WAN/NAT reachability,
203
- Linux compatibility, sustained capacity or an uptime guarantee. Direct WebRTC
204
- requires peer reachability; no TURN relay is provided.
205
-
206
200
  ## Player mute
207
201
 
208
202
  `await room.setPlayerMuted(id, true)` suppresses a player's room chat; pass `false`