Robocode Tank Royale Bot API
    Preparing search index...

    Interface IBaseBot

    Interface containing the core API for a bot.

    interface IBaseBot {
        MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN: 10;
        TEAM_MESSAGE_MAX_SIZE: 32768;
        addCustomEvent(condition: Condition): boolean;
        bearingTo(x: number, y: number): number;
        broadcastTeamMessage(message: unknown): void;
        calcBearing(direction: number): number;
        calcBulletSpeed(firepower: number): number;
        calcDeltaAngle(targetAngle: number, sourceAngle: number): number;
        calcGunBearing(direction: number): number;
        calcGunHeat(firepower: number): number;
        calcMaxTurnRate(speed: number): number;
        calcRadarBearing(direction: number): number;
        clearEvents(): void;
        directionTo(x: number, y: number): number;
        distanceTo(x: number, y: number): number;
        getArenaHeight(): number;
        getArenaWidth(): number;
        getBodyColor(): Color | null;
        getBulletColor(): Color | null;
        getBulletStates(): ReadonlySet<BulletState>;
        getDirection(): number;
        getEnemyCount(): number;
        getEnergy(): number;
        getEventPriority(eventType: string): number;
        getEvents(): BotEvent[];
        getFirepower(): number;
        getGameType(): string;
        getGraphics(): IGraphics;
        getGunColor(): Color | null;
        getGunCoolingRate(): number;
        getGunDirection(): number;
        getGunHeat(): number;
        getGunTurnRate(): number;
        getMaxGunTurnRate(): number;
        getMaxInactivityTurns(): number;
        getMaxRadarTurnRate(): number;
        getMaxSpeed(): number;
        getMaxTurnRate(): number;
        getMyId(): number;
        getNumberOfRounds(): number;
        getRadarColor(): Color | null;
        getRadarDirection(): number;
        getRadarTurnRate(): number;
        getRoundNumber(): number;
        getScanColor(): Color | null;
        getSpeed(): number;
        getTargetSpeed(): number;
        getTeammateIds(): ReadonlySet<number>;
        getTimeLeft(): number;
        getTracksColor(): Color | null;
        getTurnNumber(): number;
        getTurnRate(): number;
        getTurnTimeout(): number;
        getTurretColor(): Color | null;
        getVariant(): string;
        getVersion(): string;
        getX(): number;
        getY(): number;
        go(): void;
        gunBearingTo(x: number, y: number): number;
        isAdjustGunForBodyTurn(): boolean;
        isAdjustRadarForBodyTurn(): boolean;
        isAdjustRadarForGunTurn(): boolean;
        isDebuggingEnabled(): boolean;
        isDisabled(): boolean;
        isStopped(): boolean;
        isTeammate(botId: number): boolean;
        normalizeAbsoluteAngle(angle: number): number;
        normalizeRelativeAngle(angle: number): number;
        onBotDeath(event: BotDeathEvent): void;
        onBulletFired(event: BulletFiredEvent): void;
        onBulletHitBot(event: BulletHitBotEvent): void;
        onBulletHitBullet(event: BulletHitBulletEvent): void;
        onBulletHitWall(event: BulletHitWallEvent): void;
        onConnected(event: ConnectedEvent): void;
        onConnectionError(event: ConnectionErrorEvent): void;
        onCustomEvent(event: CustomEvent): void;
        onDeath(event: DeathEvent): void;
        onDisconnected(event: DisconnectedEvent): void;
        onGameEnded(event: GameEndedEvent): void;
        onGameStarted(event: GameStartedEvent): void;
        onHitBot(event: HitBotEvent): void;
        onHitByBullet(event: HitByBulletEvent): void;
        onHitWall(event: HitWallEvent): void;
        onRoundEnded(event: RoundEndedEvent): void;
        onRoundStarted(event: RoundStartedEvent): void;
        onScannedBot(event: ScannedBotEvent): void;
        onSkippedTurn(event: SkippedTurnEvent): void;
        onTeamMessage(event: TeamMessageEvent): void;
        onTick(event: TickEvent): void;
        onWonRound(event: WonRoundEvent): void;
        radarBearingTo(x: number, y: number): number;
        removeCustomEvent(condition: Condition): boolean;
        sendTeamMessage(teammateId: number, message: unknown): void;
        setAdjustGunForBodyTurn(adjust: boolean): void;
        setAdjustRadarForBodyTurn(adjust: boolean): void;
        setAdjustRadarForGunTurn(adjust: boolean): void;
        setBodyColor(color: Color | null): void;
        setBulletColor(color: Color | null): void;
        setEventPriority(eventType: string, priority: number): void;
        setFire(firepower: number): boolean;
        setFireAssist(enable: boolean): void;
        setGunColor(color: Color | null): void;
        setGunTurnRate(gunTurnRate: number): void;
        setInterruptible(interruptible: boolean): void;
        setMaxGunTurnRate(maxGunTurnRate: number): void;
        setMaxRadarTurnRate(maxRadarTurnRate: number): void;
        setMaxSpeed(maxSpeed: number): void;
        setMaxTurnRate(maxTurnRate: number): void;
        setRadarColor(color: Color | null): void;
        setRadarTurnRate(radarTurnRate: number): void;
        setRescan(): void;
        setResume(): void;
        setScanColor(color: Color | null): void;
        setStop(): void;
        setStop(overwrite: boolean): void;
        setTargetSpeed(targetSpeed: number): void;
        setTracksColor(color: Color | null): void;
        setTurnRate(turnRate: number): void;
        setTurretColor(color: Color | null): void;
        start(): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    Methods

    addCustomEvent bearingTo broadcastTeamMessage calcBearing calcBulletSpeed calcDeltaAngle calcGunBearing calcGunHeat calcMaxTurnRate calcRadarBearing clearEvents directionTo distanceTo getArenaHeight getArenaWidth getBodyColor getBulletColor getBulletStates getDirection getEnemyCount getEnergy getEventPriority getEvents getFirepower getGameType getGraphics getGunColor getGunCoolingRate getGunDirection getGunHeat getGunTurnRate getMaxGunTurnRate getMaxInactivityTurns getMaxRadarTurnRate getMaxSpeed getMaxTurnRate getMyId getNumberOfRounds getRadarColor getRadarDirection getRadarTurnRate getRoundNumber getScanColor getSpeed getTargetSpeed getTeammateIds getTimeLeft getTracksColor getTurnNumber getTurnRate getTurnTimeout getTurretColor getVariant getVersion getX getY go gunBearingTo isAdjustGunForBodyTurn isAdjustRadarForBodyTurn isAdjustRadarForGunTurn isDebuggingEnabled isDisabled isStopped isTeammate normalizeAbsoluteAngle normalizeRelativeAngle onBotDeath onBulletFired onBulletHitBot onBulletHitBullet onBulletHitWall onConnected onConnectionError onCustomEvent onDeath onDisconnected onGameEnded onGameStarted onHitBot onHitByBullet onHitWall onRoundEnded onRoundStarted onScannedBot onSkippedTurn onTeamMessage onTick onWonRound radarBearingTo removeCustomEvent sendTeamMessage setAdjustGunForBodyTurn setAdjustRadarForBodyTurn setAdjustRadarForGunTurn setBodyColor setBulletColor setEventPriority setFire setFireAssist setGunColor setGunTurnRate setInterruptible setMaxGunTurnRate setMaxRadarTurnRate setMaxSpeed setMaxTurnRate setRadarColor setRadarTurnRate setRescan setResume setScanColor setStop setTargetSpeed setTracksColor setTurnRate setTurretColor start

    Properties

    MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN: 10

    The maximum number of team messages that can be sent per turn.

    TEAM_MESSAGE_MAX_SIZE: 32768

    The maximum size of a team message in bytes (32 KB).

    Methods

    • Adds a custom condition that triggers a CustomEvent when met. Returns true if added.

      Parameters

      Returns boolean

    • Calculates the bearing from the bot's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Broadcasts a message to all teammates.

      Parameters

      • message: unknown

      Returns void

    • Calculates the bearing (angle) from the bot's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the bullet speed for a given firepower.

      Parameters

      • firepower: number

      Returns number

    • Calculates the delta angle between a target angle and a source angle.

      Parameters

      • targetAngle: number

        the target angle.

      • sourceAngle: number

        the source angle.

      Returns number

      the delta angle in degrees in the range [-180, 180].

    • Calculates the bearing from the gun's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the gun heat for a given firepower.

      Parameters

      • firepower: number

      Returns number

    • Calculates the maximum turn rate for a given speed.

      Parameters

      • speed: number

      Returns number

    • Calculates the bearing from the radar's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Clears the events for the current turn.

      Returns void

    • Calculates the direction from the bot to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the direction in degrees in the range [0, 360).

    • Calculates the distance from the bot to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the distance in units.

    • Height of the arena measured in units. First available when the game has started.

      Returns number

    • Width of the arena measured in units. First available when the game has started.

      Returns number

    • The driving direction of the bot in degrees.

      Returns number

    • The number of enemy bots left in the round.

      Returns number

    • The energy level of the bot.

      Returns number

    • Gets the event priority for a given event type name.

      Parameters

      • eventType: string

      Returns number

    • The firepower of the last setFire() call.

      Returns number

    • Game type, e.g. "melee" or "1v1". First available when the game has started.

      Returns string

    • Gun cooling rate. First available when the game has started.

      Returns number

    • The gun direction of the bot in degrees.

      Returns number

    • The gun heat of the bot. The gun cannot fire when the gun heat is > 0.

      Returns number

    • The current gun turn rate in degrees per turn.

      Returns number

    • The maximum gun turn rate in degrees per turn.

      Returns number

    • The maximum number of inactive turns allowed before the bot is zapped.

      Returns number

    • The maximum radar turn rate in degrees per turn.

      Returns number

    • The maximum speed in units per turn.

      Returns number

    • The maximum turn rate of the bot in degrees per turn.

      Returns number

    • Unique id of this bot, available when the game has started.

      Returns number

    • The number of rounds in a battle. First available when the game has started.

      Returns number

    • The radar direction of the bot in degrees.

      Returns number

    • The current radar turn rate in degrees per turn.

      Returns number

    • The current round number.

      Returns number

    • The speed of the bot measured in units per turn.

      Returns number

    • The target speed in units per turn.

      Returns number

    • Returns the set of teammate bot IDs.

      Returns ReadonlySet<number>

    • The number of microseconds left of this turn before the bot will skip the turn.

      Returns number

    • The current turn number.

      Returns number

    • The current turn rate of the bot in degrees per turn.

      Returns number

    • The turn timeout in microseconds. First available when the game has started.

      Returns number

    • The game variant, which is "Tank Royale".

      Returns string

    • Game version, e.g. "1.0.0".

      Returns string

    • The X coordinate of the bot.

      Returns number

    • The Y coordinate of the bot.

      Returns number

    • Commits the current commands (actions), finalizing the current turn for the bot. Must be called once per turn before the turn timeout occurs.

      Returns void

    • Calculates the bearing from the gun's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Returns whether the gun is set to adjust for the body turn.

      Returns boolean

    • Returns whether the radar is set to adjust for the body turn.

      Returns boolean

    • Returns whether the radar is set to adjust for the gun turn.

      Returns boolean

    • Returns whether debugging is enabled.

      Returns boolean

    • Whether the bot is disabled, i.e. has no energy.

      Returns boolean

    • Returns whether the bot is stopped.

      Returns boolean

    • Returns whether the given bot ID is a teammate.

      Parameters

      • botId: number

      Returns boolean

    • Normalizes an angle to an absolute angle in the range [0, 360).

      Parameters

      • angle: number

        the angle to normalize.

      Returns number

      the normalized angle.

    • Normalizes an angle to a relative angle in the range [-180, 180].

      Parameters

      • angle: number

        the angle to normalize.

      Returns number

      the normalized angle.

    • Calculates the bearing from the radar's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Removes a custom condition. Returns true if removed.

      Parameters

      Returns boolean

    • Sends a message to a specific teammate.

      Parameters

      • teammateId: number
      • message: unknown

      Returns void

    • Sets whether the gun should adjust for the body turn.

      Parameters

      • adjust: boolean

      Returns void

    • Sets whether the radar should adjust for the body turn.

      Parameters

      • adjust: boolean

      Returns void

    • Sets whether the radar should adjust for the gun turn.

      Parameters

      • adjust: boolean

      Returns void

    • Sets the body color of the bot.

      Parameters

      Returns void

    • Sets the bullet color of the bot.

      Parameters

      Returns void

    • Sets the event priority for a given event type name.

      Parameters

      • eventType: string
      • priority: number

      Returns void

    • Sets the gun to fire with the given firepower. Returns true if the gun will fire, false if not. The gun will not fire if the gun is still hot, or the firepower is out of range.

      Parameters

      • firepower: number

      Returns boolean

    • Enables or disables fire assistance.

      Parameters

      • enable: boolean

      Returns void

    • Sets the gun color of the bot.

      Parameters

      Returns void

    • Sets the gun turn rate in degrees per turn.

      Parameters

      • gunTurnRate: number

      Returns void

    • Sets whether the current event handler is interruptible.

      Parameters

      • interruptible: boolean

      Returns void

    • Sets the maximum gun turn rate in degrees per turn.

      Parameters

      • maxGunTurnRate: number

      Returns void

    • Sets the maximum radar turn rate in degrees per turn.

      Parameters

      • maxRadarTurnRate: number

      Returns void

    • Sets the maximum speed in units per turn.

      Parameters

      • maxSpeed: number

      Returns void

    • Sets the maximum turn rate of the bot in degrees per turn.

      Parameters

      • maxTurnRate: number

      Returns void

    • Sets the radar color of the bot.

      Parameters

      Returns void

    • Sets the radar turn rate in degrees per turn.

      Parameters

      • radarTurnRate: number

      Returns void

    • Sets the bot to rescan with the radar.

      Returns void

    • Sets the bot to resume movement after a stop.

      Returns void

    • Sets the scan arc color of the bot.

      Parameters

      Returns void

    • Sets the bot to stop all movement.

      Returns void

    • Sets the bot to stop all movement, optionally overwriting a previous stop.

      Parameters

      • overwrite: boolean

      Returns void

    • Sets the target speed in units per turn.

      Parameters

      • targetSpeed: number

      Returns void

    • Sets the tracks color of the bot.

      Parameters

      Returns void

    • Sets the turn rate of the bot in degrees per turn.

      Parameters

      • turnRate: number

      Returns void

    • Sets the turret color of the bot.

      Parameters

      Returns void

    • Starts the bot, connecting to the server and running until the game ends.

      Returns void