ball2d 0.2.3 → 0.3.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 (30) hide show
  1. package/README.md +14 -22
  2. package/dist/browser.js +2839 -2238
  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 +6 -0
  23. package/dist/types/config.d.ts +3 -0
  24. package/dist/types/match-state.d.ts +8 -2
  25. package/dist/types/node.d.ts +2 -2
  26. package/dist/types/player.d.ts +2 -0
  27. package/dist/types/replay.d.ts +1 -1
  28. package/dist/types/room-geo.d.ts +6 -0
  29. package/dist/types/room.d.ts +6 -4
  30. package/package.json +2 -1
package/README.md CHANGED
@@ -4,11 +4,8 @@ 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 release: 0.3.0.** It matches the Ball2D service deployed on
8
+ 2026-09-25 (room protocol 5). Recordings and stadium geometry differ from 0.2.x.
12
9
 
13
10
  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
11
 
@@ -18,7 +15,7 @@ Use Node.js 24 or newer. The verified native runtime is Node.js 24.19.0 on macOS
18
15
  arm64; other systems need independent acceptance. Native transport is experimental.
19
16
 
20
17
  ```sh
21
- npm install ball2d@0.2.3
18
+ npm install ball2d
22
19
  ```
23
20
 
24
21
  Create an API key through your Ball2D account.
@@ -98,12 +95,10 @@ native declarations do not require DOM/WebRTC globals or `skipLibCheck`.
98
95
  - **Players and lobby:** inspect players, assign teams/admins, lock teams, kick/ban,
99
96
  manage admission, send chat and announcements, and configure the room.
100
97
  - **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,
98
+ team controls.
99
+ - **Physics and stadiums:** load custom stadium text, select fourteen bundled defaults,
105
100
  query and modify supported player/disc properties, and use `CollisionFlags`.
106
- - **Events:** player join/leave/chat, team/admin changes, ball kicks, goals,
101
+ - **Events:** player join/leave/input/chat, team/admin changes, ball kicks, goals,
107
102
  match ticks, position resets, victory, stadium changes and recording completion.
108
103
  - **Replay:** record and decode Ball2D recordings with their embedded stadium and
109
104
  matching engine identity.
@@ -118,6 +113,8 @@ Callbacks receive the room facade as `this`. Callback failures are reported to
118
113
  `onError`; that handler's own failures are contained. Chat filtering must return
119
114
  `false` synchronously to suppress a message. Player IDs are stable public IDs,
120
115
  not physics slots; departed player IDs are not reused within a room.
116
+ `onPlayerInput(player, prevInput)` reports accepted key-state changes. `player.input`
117
+ is the current bitmask: up `1`, down `2`, left `4`, right `8`, kick `16`.
121
118
 
122
119
  Room creation resolves only after signaling confirms host authority. An optional
123
120
  second argument `{ signal }` cancels startup. Startup has a 15-second overall
@@ -141,6 +138,10 @@ not bypass revocation or quota enforcement.
141
138
 
142
139
  ## Stadiums and replays
143
140
 
141
+ Stadium files use `.ball2dstadium` or JSON; recordings use `.ball2drep`.
142
+ Only recordings matching the current engine are accepted. Historical engine
143
+ compatibility is not part of this development baseline.
144
+
144
145
  ```js
145
146
  import { validateStadium, readReplay } from 'ball2d/node';
146
147
 
@@ -158,8 +159,8 @@ if (recording) {
158
159
 
159
160
  Validation is synchronous and does not allocate a room. Passing validation means
160
161
  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;
162
+ Bundled defaults are Classic, Easy, Small, Big, Rounded, Big Easy, Big Rounded,
163
+ Huge, Asphalt, Asphalt Arena, Courtyard, Meadow, Street Five and Training Green. They are Ball2D-authored procedural designs;
163
164
  provenance and hashes are included. Custom stadiums and embedded-stadium replays
164
165
  remain supported. Geometry and physics can differ from earlier SDK assets.
165
166
  Recordings are binary containers: use `readReplay`, not JSON parsing.
@@ -194,15 +195,6 @@ Remove secrets, personal data and private room links. Use
194
195
  [private vulnerability reporting](https://github.com/fillbyte/ball2d/security/advisories/new)
195
196
  for sensitive findings. See [contribution guidance](https://github.com/fillbyte/ball2d/blob/main/CONTRIBUTING.md).
196
197
 
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
198
  ## Player mute
207
199
 
208
200
  `await room.setPlayerMuted(id, true)` suppresses a player's room chat; pass `false`