Skip to content

Room and eventsRoom

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.

NameID
Classicclassic
Easyeasy
Smallsmall
Bigbig
Roundedrounded
Big Easybig_easy
Big Roundedbig_rounded
Hugehuge
Asphaltasphalt
Asphalt Arenaasphalt_arena
Courtyardcourtyard
Meadowmeadow
Street Fivestreet_five
Training Greentraining_green

Parameters

namestringrequired
A bundled stadium, by its name or ID. Case-sensitive.

Returns

Promise<void>

JavaScript
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

sourcestringrequired
Stadium source text, as accepted by validateStadium().

Returns

Promise<void>

JavaScript
import { readFile } from 'node:fs/promises';

const source = await readFile(
  'stadiums/futsal.ball2dstadium',
  'utf8',
);
await room.setCustomStadium(source);