This wiki is archived and useful information is being migrated to the main bzflag.org website

Difference between revisions of "BZRobots/Protocol"

From BZFlagWiki
Jump to: navigation, search
(BZRobots Enhanced Protocol)
Line 1: Line 1:
 
== BZRobots Enhanced Protocol ==
 
== BZRobots Enhanced Protocol ==
  
This is a draft of the protocol that's being planned for the new bzrobots as a part of GSoC.
+
This is a draft of the protocol that's being planned for the new bzrobots as a part of GSoC. The protocol is inspired by the API it will convey the messages of, which in turn is inspired by [http://robocode.sourceforge.net RoboCode]. ;-)
  
 
{| cellspacing="0" border="1"
 
{| cellspacing="0" border="1"
|+ Backend messages
+
|+ Backend -> frontend messages
 
!Message syntax
 
!Message syntax
 
!Description
 
!Description
!Example
 
 
|-
 
|-
 
|SOME_COMMAND_HERE <float>
 
|SOME_COMMAND_HERE <float>
 
|THIS RUNS SOME COMMAND WITH FLOAT ARGUMENT
 
|THIS RUNS SOME COMMAND WITH FLOAT ARGUMENT
|SOME_COMMAND_HERE 15
 
 
|}
 
|}
  
 
{| cellspacing="0" border="1"
 
{| cellspacing="0" border="1"
|+ Frontend messages
+
|+ Frontend -> backend messages
 
!Message syntax
 
!Message syntax
 
!Description
 
!Description
!Example
 
 
|-
 
|-
|SOME_COMMAND_HERE <float>
+
|setAhead <distance>
|THIS RUNS SOME COMMAND WITH FLOAT ARGUMENT
+
|Sets planned movement (for next 'execute') that moves 'distance' units.
|SOME_COMMAND_HERE 15
+
|-
 +
|setBack <distance>
 +
|Sets planned movement backwards, same as setAhead -distance
 +
|-
 +
|setTurnLeft <degrees>
 +
|Sets planned turn (for next 'execute') that turns 'degrees' degrees to the left.
 +
|-
 +
|setTurnRight <degrees>
 +
|Sets planned turn (for next 'execute') that turns 'degrees' degrees to the right, same as setTurnLeft -degrees.
 +
|-
 +
|setFire
 +
|Sets a planned shot (for next 'execute')
 +
|-
 +
|getDistanceRemaining
 +
|Gives a 'distanceRemaining'-reply with how much is left of the currently planned movement.
 +
|-
 +
|getTurnRemaining
 +
|Gives a 'turnRemaining'-reply with how much is left of the currently planned turn.
 +
|-
 +
|execute
 +
|Runs a tick of the 'planned actions', and replies with a 'tick over' when the tick has passed.
 
|}
 
|}

Revision as of 19:38, 18 June 2007

BZRobots Enhanced Protocol

This is a draft of the protocol that's being planned for the new bzrobots as a part of GSoC. The protocol is inspired by the API it will convey the messages of, which in turn is inspired by RoboCode. ;-)

Backend -> frontend messages
Message syntax Description
SOME_COMMAND_HERE <float> THIS RUNS SOME COMMAND WITH FLOAT ARGUMENT
Frontend -> backend messages
Message syntax Description
setAhead <distance> Sets planned movement (for next 'execute') that moves 'distance' units.
setBack <distance> Sets planned movement backwards, same as setAhead -distance
setTurnLeft <degrees> Sets planned turn (for next 'execute') that turns 'degrees' degrees to the left.
setTurnRight <degrees> Sets planned turn (for next 'execute') that turns 'degrees' degrees to the right, same as setTurnLeft -degrees.
setFire Sets a planned shot (for next 'execute')
getDistanceRemaining Gives a 'distanceRemaining'-reply with how much is left of the currently planned movement.
getTurnRemaining Gives a 'turnRemaining'-reply with how much is left of the currently planned turn.
execute Runs a tick of the 'planned actions', and replies with a 'tick over' when the tick has passed.