Stadiums
Switch between bundled stadiums or load your own between matches.
Both methods apply only between matches; during a match they do nothing. Loading a stadium returns the room to the lobby, resets the score and keeps the score, time and kick-rate settings. If a recording is running, it finishes first with the reason Stadium changed.
setDefaultStadium()
method
room.setDefaultStadium(name: string): Promise<void>Loads one of the fourteen stadiums in the package. Unknown names reject with Unknown default stadium. Fires onStadiumChange.
| Name | ID |
|---|---|
| Classic | classic |
| Easy | easy |
| Small | small |
| Big | big |
| Rounded | rounded |
| Big Easy | big_easy |
| Big Rounded | big_rounded |
| Huge | huge |
| Asphalt | asphalt |
| Asphalt Arena | asphalt_arena |
| Courtyard | courtyard |
| Meadow | meadow |
| Street Five | street_five |
| Training Green | training_green |
Parameters
name
stringrequiredA bundled stadium, by its name or ID. Case-sensitive.
Returns
Promise<void>
await room.setDefaultStadium('Big Rounded');
// or by ID
await room.setDefaultStadium('big_rounded');setCustomStadium()
method
room.setCustomStadium(source: string): Promise<void>Loads a stadium you provide. Invalid sources reject with the same error validateStadium() would throw, so validate files when you accept them rather than when you load them. Fires onStadiumChange.
Parameters
source
stringrequiredReturns
Promise<void>
import { readFile } from 'node:fs/promises';
const source = await readFile(
'stadiums/futsal.ball2dstadium',
'utf8',
);
await room.setCustomStadium(source);