Bot

The Bot interface represents an automated player. The Bot and its derived classes will have methods and properties similar to a PlayerState object.

Note: The behavior of a bot, particularly its decision-making and interactions, will heavily depend on its implementation and the given botClass. Ensure the bot’s behaviors align with the game’s requirements and player expectations.

Properties

NameTypeDescription
idstringUnique bot ID.
getProfile() => PlayerProfileReturns the bot’s profile.
getState(key: string) => anyReturns a specific state value for the bot.
setState(key: string, value: any, reliable?: boolean) => voidSets a specific state value for the bot.
onQuit(callback: (player: PlayerState) => void) => () => voidRegisters a callback when the bot quits. Returns unsubscribe function.
kick() => Promise<void>Kicks the bot from the room. Only host can call.
isBot() => booleanReturns true if this entity is a bot.