Bots: size property
Available since
@irtio/room 0.1Hosted roomsirt dev@irtio/testingSelf-hosted room hostThe size read-only property of the Bots interface is the number of bots in the room.
Value
A number from 0 to MAX_BOTS (64).
Description
size counts bots only. People and bots together hold at most room.maxPlayers seats, and room.presence.size counts both, with people still in their presence grace.
Examples
Showing how many seats bots hold
// seats.ts
import { defineRoom } from "@irtio/room";
export default defineRoom({
bots: { filler: {} },
onCreate(room) {
room.bots.fill(4, "filler");
},
onJoin(room, connection) {
room.send(connection, { type: "seats", bots: room.bots.size, of: room.maxPlayers });
},
});
See also
Runtime availability
| Hosted rooms | irt dev | @irtio/testing | Self-hosted room host | |
|---|---|---|---|---|
size | 0.1 | 0.1 | 0.1 | 0.1 |