|
|
Line 1: |
Line 1: |
| =Overview= | | =Overview= |
− | This page describes the BZRobots Enhanced Protocol that is part of the Programmable Computer Player Client project for the [[Google_Summer_of_Code]]. | + | This page describes the [[BZRobots]] Enhanced Protocol that forms the internals of the BZFlag Programmable Computer Player Client developed for [[Google_Summer_of_Code]]. |
| | | |
− | =Protocol Description= | + | =Description= |
− | The protocol is linebased, and works on a request-reply basis. Below is a table of all available requests. | + | The [[BZRobots]] client currently consists of two parts called the "backend" and the "frontend". The "backend" is a lightweight game client that communicates with BZFS. It also runs a lightweight line-by-line text-based server, on which commands can be sent to control a robot. The "frontend" is an instance of a BZAdvancedRobot, including the necessary parts to communicate with the "backend". |
− | The backend has something called a ''steady-state'' - this is basically when the backend is idle, and the tank likewise. Some commands will only work in this steady-state (because they will only make sense when the bot is not doing anything), and if one of these commands are sent when the bot is in ''active-state'' the backend will '''not reply''' until the backend has entered ''steady-state'' (and any commands sent after the first command are queued for handling until the ''blocking'' command has been handled). These commands are marked with "'''Yes'''" in the "Steady-state required?"-column.
| + | |
| | | |
− | '''Frontend To Backend Messages'''
| + | ==Available Commands== |
− | {| cellspacing="0" border="1"
| + | See the [[BZRobots/API]] for the commands currently available to the BZRobots protocol. |
− | !Message syntax
| + | |
− | !Description
| + | |
− | !Steady-state required?
| + | |
− | !Implemented?
| + | |
− | |-
| + | |
− | |Execute
| + | |
− | |Runs a tick of the 'planned actions', and perhaps fires a shot (see SetFire).
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetBases
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |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
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetConstants
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetFlags
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetDistanceRemaining
| + | |
− | |Gives a 'DistanceRemaining'-reply with how much is left of the currently planned movement.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetGunHeat
| + | |
− | |Gives a 'GunHeat'-reply with how many seconds are left of the gun cooldown.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetHeading
| + | |
− | |Gives a 'Heading'-reply with heading of the tank.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetHeight
| + | |
− | |Gives a 'Height'-reply with height of the tank.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetLength
| + | |
− | |Gives a 'Length'-reply with height of the tank.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetMyTanks
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetNumRounds
| + | |
− | |To be defined (or removed?)
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetObstacles
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetOtherTanks
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetRoundNum
| + | |
− | |Returns the number of times the bot has died (or?).
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetShots
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetSpeed
| + | |
− | |Returns the current velocity, as per default - or as per last SetSpeed.
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetTeams
| + | |
− | |<explain>
| + | |
− | |No
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetTickDuration
| + | |
− | |Gives a 'TickDuration'-reply with how many seconds makes up one tick.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetTickRemaining
| + | |
− | |Gives a 'TickRemaining'-reply with how many seconds are left of this tick.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |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'''
| + | |
− | !style="background-color: #ff3333"|No
| + | |
− | |-
| + | |
− | |GetTurnRemaining
| + | |
− | |Gives a 'TurnRemaining'-reply with how much is left of the currently planned turn.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetWidth
| + | |
− | |Gives a 'Width'-reply with width of the tank.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetX
| + | |
− | |Gives a 'X'-reply with x-coordinate of the tank. (0, 0) is "lower left" corner.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetY
| + | |
− | |Gives a 'Y'-reply with y-coordinate of the tank. (0, 0) is "lower left" corner.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |GetZ
| + | |
− | |Gives a 'Z'-reply with z-coordinate of the tank. 0 is ground level.
| + | |
− | |'''Yes'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |IdentifyFrontend <version>
| + | |
− | |Greets the backend. (specifying protocol-version <version>, under development: 0001)
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetAhead <distance>
| + | |
− | |Sets planned movement (for next 'execute'-s) that moves 'distance' units.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetFire
| + | |
− | |Sets a planned shot (for next 'execute')
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |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'''
| + | |
− | !style="background-color: #55ff55"|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'''
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetSpeed <factor>
| + | |
− | |Sets next actions speed, value between 0 and 1.0. (for future 'execute'-s)
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetTickDuration <seconds>
| + | |
− | |Sets the duration of a tick, in seconds.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetTurnLeft <degrees>
| + | |
− | |Sets planned turn (for next 'execute'-s) that turns 'degrees' degrees to the left.
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |-
| + | |
− | |SetTurnRate <factor>
| + | |
− | |Sets next actions turnrate, value between 0 and 1.0. (for next 'execute'-s)
| + | |
− | |No
| + | |
− | !style="background-color: #55ff55"|Yes
| + | |
− | |}
| + | |
| | | |
− | =See Also= | + | ==Legacy== |
− | [[BZRobots/About]] - Project Overview
| + | Eventually, in an effort to simplify the internals of BZRobots, the "frontend" and "backend" will likely be altogether removed, thereby eliminating the internal protocol. It is recommended to develop bots in C or Python using the published API, rather than attempting to develop a seperate client for the BZRobot backend. |
− | | + | |
− | [[BZRobots/Ideas]] - Feature suggestions / thoughts
| + | |
Eventually, in an effort to simplify the internals of BZRobots, the "frontend" and "backend" will likely be altogether removed, thereby eliminating the internal protocol. It is recommended to develop bots in C or Python using the published API, rather than attempting to develop a seperate client for the BZRobot backend.