ball2d 0.2.2 → 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.
- package/README.md +17 -23
- package/dist/browser.js +3046 -2306
- package/dist/core.wasm +0 -0
- package/dist/licenses/native.json +6 -0
- package/dist/licenses/valibot.txt +9 -0
- package/dist/node.js +33 -33
- package/dist/stadiums/asphalt.ball2dstadium +515 -0
- package/dist/stadiums/{big_hockey.hbs → asphalt_arena.ball2dstadium} +118 -119
- package/dist/stadiums/{big.hbs → big.ball2dstadium} +16 -16
- package/dist/stadiums/{big_easy.hbs → big_easy.ball2dstadium} +16 -16
- package/dist/stadiums/{big_rounded.hbs → big_rounded.ball2dstadium} +20 -20
- package/dist/stadiums/{classic.hbs → classic.ball2dstadium} +16 -16
- package/dist/stadiums/courtyard.ball2dstadium +611 -0
- package/dist/stadiums/{easy.hbs → easy.ball2dstadium} +16 -16
- package/dist/stadiums/{huge.hbs → huge.ball2dstadium} +16 -16
- package/dist/stadiums/meadow.ball2dstadium +611 -0
- package/dist/stadiums/provenance.json +36 -20
- package/dist/stadiums/{rounded.hbs → rounded.ball2dstadium} +20 -20
- package/dist/stadiums/{small.hbs → small.ball2dstadium} +16 -16
- package/dist/stadiums/{hockey.hbs → street_five.ball2dstadium} +82 -83
- package/dist/stadiums/training_green.ball2dstadium +611 -0
- package/dist/types/browser.d.ts +6 -0
- package/dist/types/config.d.ts +3 -0
- package/dist/types/match-state.d.ts +8 -2
- package/dist/types/node.d.ts +2 -2
- package/dist/types/player.d.ts +2 -0
- package/dist/types/replay.d.ts +1 -1
- package/dist/types/room-geo.d.ts +6 -0
- package/dist/types/room.d.ts +6 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,10 +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
|
-
**
|
|
8
|
-
|
|
9
|
-
revocation. Local Chrome acceptance verified player input, signed stadium physics
|
|
10
|
-
and replay preservation. These checks do not establish broad device 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.
|
|
11
9
|
|
|
12
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).
|
|
13
11
|
|
|
@@ -17,7 +15,7 @@ Use Node.js 24 or newer. The verified native runtime is Node.js 24.19.0 on macOS
|
|
|
17
15
|
arm64; other systems need independent acceptance. Native transport is experimental.
|
|
18
16
|
|
|
19
17
|
```sh
|
|
20
|
-
npm install ball2d
|
|
18
|
+
npm install ball2d
|
|
21
19
|
```
|
|
22
20
|
|
|
23
21
|
Create an API key through your Ball2D account.
|
|
@@ -97,12 +95,10 @@ native declarations do not require DOM/WebRTC globals or `skipLibCheck`.
|
|
|
97
95
|
- **Players and lobby:** inspect players, assign teams/admins, lock teams, kick/ban,
|
|
98
96
|
manage admission, send chat and announcements, and configure the room.
|
|
99
97
|
- **Matches:** start/stop, pause/resume, score/time limits, kick-rate limits and
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
stadium resets it. Surface changes are retained in replays.
|
|
103
|
-
- **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,
|
|
104
100
|
query and modify supported player/disc properties, and use `CollisionFlags`.
|
|
105
|
-
- **Events:** player join/leave/chat, team/admin changes, ball kicks, goals,
|
|
101
|
+
- **Events:** player join/leave/input/chat, team/admin changes, ball kicks, goals,
|
|
106
102
|
match ticks, position resets, victory, stadium changes and recording completion.
|
|
107
103
|
- **Replay:** record and decode Ball2D recordings with their embedded stadium and
|
|
108
104
|
matching engine identity.
|
|
@@ -117,6 +113,8 @@ Callbacks receive the room facade as `this`. Callback failures are reported to
|
|
|
117
113
|
`onError`; that handler's own failures are contained. Chat filtering must return
|
|
118
114
|
`false` synchronously to suppress a message. Player IDs are stable public IDs,
|
|
119
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`.
|
|
120
118
|
|
|
121
119
|
Room creation resolves only after signaling confirms host authority. An optional
|
|
122
120
|
second argument `{ signal }` cancels startup. Startup has a 15-second overall
|
|
@@ -128,9 +126,10 @@ confirm that every remote player has received a shutdown message.
|
|
|
128
126
|
## Signaling recovery
|
|
129
127
|
|
|
130
128
|
Browser and native runtimes request resumable signaling by default. If the
|
|
131
|
-
signaling connection briefly drops, the same admitted
|
|
129
|
+
guest signaling connection briefly drops, the same admitted player can recover
|
|
132
130
|
within the service membership lifetime while retaining healthy direct peer
|
|
133
|
-
connections.
|
|
131
|
+
connections. Host loss closes the room, including when the service observes the
|
|
132
|
+
host signaling socket close. Custom services must support the matching protocol.
|
|
134
133
|
|
|
135
134
|
This does not automatically transfer ownership to another player when the host
|
|
136
135
|
leaves, guarantee uninterrupted delivery, or provide a relay for incompatible
|
|
@@ -139,6 +138,10 @@ not bypass revocation or quota enforcement.
|
|
|
139
138
|
|
|
140
139
|
## Stadiums and replays
|
|
141
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
|
+
|
|
142
145
|
```js
|
|
143
146
|
import { validateStadium, readReplay } from 'ball2d/node';
|
|
144
147
|
|
|
@@ -156,8 +159,8 @@ if (recording) {
|
|
|
156
159
|
|
|
157
160
|
Validation is synchronous and does not allocate a room. Passing validation means
|
|
158
161
|
the stadium can be parsed, not that all gameplay outcomes have been certified.
|
|
159
|
-
Bundled defaults are Classic, Easy, Small, Big, Rounded,
|
|
160
|
-
|
|
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;
|
|
161
164
|
provenance and hashes are included. Custom stadiums and embedded-stadium replays
|
|
162
165
|
remain supported. Geometry and physics can differ from earlier SDK assets.
|
|
163
166
|
Recordings are binary containers: use `readReplay`, not JSON parsing.
|
|
@@ -192,15 +195,6 @@ Remove secrets, personal data and private room links. Use
|
|
|
192
195
|
[private vulnerability reporting](https://github.com/fillbyte/ball2d/security/advisories/new)
|
|
193
196
|
for sensitive findings. See [contribution guidance](https://github.com/fillbyte/ball2d/blob/main/CONTRIBUTING.md).
|
|
194
197
|
|
|
195
|
-
Production acceptance on 12 September 2026 verified a confirmed-email account
|
|
196
|
-
creating an API key, Node.js room creation, wet-ground simulation with a Chrome
|
|
197
|
-
player, a second room rejected by the key quota, and active-key revocation closing
|
|
198
|
-
the official host and rejecting new admission. Local verification also includes
|
|
199
|
-
installed-package hosting, gameplay, replay and cleanup. This evidence does not
|
|
200
|
-
establish broad WAN/NAT reachability,
|
|
201
|
-
Linux compatibility, sustained capacity or an uptime guarantee. Direct WebRTC
|
|
202
|
-
requires peer reachability; no TURN relay is provided.
|
|
203
|
-
|
|
204
198
|
## Player mute
|
|
205
199
|
|
|
206
200
|
`await room.setPlayerMuted(id, true)` suppresses a player's room chat; pass `false`
|