This wiki was in read-only mode for many years, but can now be edited again. A lot of information will need to be updated.

BZRobots/API: Difference between revisions

From BZFlagWiki
Jump to navigation Jump to search
Bulldozer (talk | contribs)
Zehra (talk | contribs)
merged content into BZRobots
Tag: New redirect
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=Overview=
#REDIRECT [[BZRobots]]
This page describes the API for the BZRobots Programmable Computer Player Client.
 
'''Available Methods'''
{| cellspacing="0" border="1"
!Method
!Description
!Steady-state required?
|-
|Execute
|Runs a tick of the 'planned actions', and perhaps fires a shot (see SetFire).
|'''Yes'''
|-
|GetBattleFieldSize
|Gives a 'BattleFieldSize'-reply with the size of the map in "units". (the map is size x size, and coordinates run from -size/2 to size/2)
|No
|-
|GetDistanceRemaining
|Gives a 'DistanceRemaining'-reply with how much is left of the currently planned movement.
|'''Yes'''
|-
|GetGunHeat
|Gives a 'GunHeat'-reply with how many seconds are left of the gun cooldown.
|'''Yes'''
|-
|GetHeading
|Gives a 'Heading'-reply with heading of the tank.
|'''Yes'''
|-
|GetHeight
|Gives a 'Height'-reply with height of the tank.
|No
|-
|GetLength
|Gives a 'Length'-reply with height of the tank.
|No
|-
|GetTickDuration
|Gives a 'TickDuration'-reply with how many seconds makes up one tick.
|No
|-
|GetTickRemaining
|Gives a 'TickRemaining'-reply with how many seconds are left of this tick.
|No
|-
|GetTurnRemaining
|Gives a 'TurnRemaining'-reply with how much is left of the currently planned turn.
|'''Yes'''
|-
|GetWidth
|Gives a 'Width'-reply with width of the tank.
|No
|-
|GetX
|Gives a 'X'-reply with x-coordinate of the tank. (0, 0) is "lower left" corner.
|'''Yes'''
|-
|GetY
|Gives a 'Y'-reply with y-coordinate of the tank. (0, 0) is "lower left" corner.
|'''Yes'''
|-
|GetZ
|Gives a 'Z'-reply with z-coordinate of the tank. 0 is ground level.
|'''Yes'''
|-
|IdentifyFrontend <version>
|Greets the backend. (specifying protocol-version <version>, under development: 0001)
|No
|-
|SetAhead <distance>
|Sets planned movement (for next 'execute'-s) that moves 'distance' units.
|No
|-
|SetFire
|Sets a planned shot (for next 'execute')
|No
|-
|SetResume
|Overwrites and restores the bots current actions (distance and turn) from a previous call to SetStop. This will fail if there are no previous SetStop-calls. Will not restore until you 'execute'. (If you call SetAhead, SetTurn etc before this, they will be overwritten unless SetResume fails)
|'''Yes'''
|-
|SetStop <overwrite>
|Stores and clears the bots current actions (distance and turn). If you've previously called SetStop and not SetResume, this will fail unless you've Set overwrite to true. Does not store & clear until you call 'execute'. (You can call SetAhead, SetTurn etc after this, and they will become the 'new' values, instead of 0.)
|'''Yes'''
|-
|SetSpeed <factor>
|Sets next actions speed, value between 0 and 1.0. (for future 'execute'-s)
|No
|-
|SetTickDuration <seconds>
|Sets the duration of a tick, in seconds.
|No
|-
|SetTurnLeft <degrees>
|Sets planned turn (for next 'execute'-s) that turns 'degrees' degrees to the left.
|No
|-
|SetTurnRate <factor>
|Sets next actions turnrate, value between 0 and 1.0. (for next 'execute'-s)
|No
 
|}
 
'''Frontend To Backend Messages - To Be Implemented'''
{| cellspacing="0" border="1"
!Message syntax
!Description
!Steady-state required?
|-
|GetConstants
|<explain>
|No
|-
|GetFlags
|<explain>
|No
|-
|GetMyTanks
|<explain>
|No
|-
|GetNumRounds
|To be defined (or removed?)
|No
|-
|GetObstacles
|<explain>
|No
|-
|GetOtherTanks
|<explain>
|No
|-
|GetRoundNum
|Returns the number of times the bot has died (or?).
|No
|-
|GetShots
|<explain>
|No
|-
|GetSpeed
|Returns the current velocity, as per default - or as per last SetSpeed.
|No
|-
|GetTeams
|<explain>
|No
|-
|GetTime
|RoboCode: "Returns the game time of the current round, where the time is equal to the current turn in the round." - Will most likely return number of times you've 'execute'-d. Alternatively; return elapsed seconds / tickDuration (but tickDuration can change), or elapsed seconds.
|'''Yes'''
|-
|GetBases
|<explain>
|No
 
|}
 
=See Also=
 
[[BZRobots/Ideas]] - Ideas for a possible future release

Latest revision as of 02:24, 30 November 2025

Redirect to: