[[ProtocolOne]] is the Java API which abstracts the Quagents game engine to a simple Java interface. The underlying clientside structure maintains data transmission, reception, and storage, while providing an API of all possible Quagent actions and queries, as well as providing useful compound . For all functions, a priority '1' indicates a "now" command and a priority "0" indicates a "then" command (this will change to a more intuitive format soon). All server commands and queries return the "commandid", which references the [[Command]] structure. [[ProtocolOne]] functions return values as specified. = Usage = To use quagents, you must have the Client directory in your filesystem. Create a class with a main method, and import the [[Necessary Classes]]. To create a Quagent, simply create a new client using the Client constructor. The constructor takes one argument, which must specify the IP address of the Quagents server. ''Example:'' {{{ Client quagent = new Client("127.0.0.1"); }}} Now, before the bot spawns, you may use initial commands to specify certain static parameters. These are optional. When you have completed these modifications, call the ready() function to initiate the live section of the session. ''Example:'' {{{ quagent.ready(); }}} During the live section, you are free to call any [[ProtocolZero]] or [[ProtocolOne]] functions you wish (with the exception of initial commands). ''Example:'' {{{ //this will make the Quagent face and shoot at the user. while(true){ quagent.faceEntityDirection(0,1); quagent.fireWeapon(1); } }}} Note that using multiple quagents is as simple as creating a new Client object, and following the same steps as above for each. = Initial Commands = {{{name(String name)}}} Specifies the Quagent's ingame name. {{{ready()}}} Spawns the bot, opens the nonblocking socket reader, and starts the live section of the game. This is the final command called during the initial section. {{{ready(String[] opcodes)}}} Same core functionality as above. The ''opcodes'' array specifies operations which the user wishes to be automatically updated on through the wiki:datastream. = Live Functions = '''[[ProtocolZero]] Actions''' {{{move(double dir, double dist, double speed, int obstacles, int priority)}}} Moves by ''dist'' towards the ''dir'' direction at ''speed'' quickness. ''obstacles'' indicates whether the bot automatically maneuvers past simple obstacles. {{{move(double dir, double speed, int obstacles, int priority)}}} Moves indefinitely towards the ''dir''direction at speed ''speed''. ''obstacles'' is as above. {{{jump(double dir, double speed, int priority)}}} Jumps in the ''dir'' direction at speed ''speed''. {{{rangeFinder(int type, int range, double rot, double azi, int priority)}}} Uses the wiki:rangefinder at a limited ''range'', in the direction specified by the ''rot''ational angle and the ''azi''muthal angle. The rangefinder is of the given ''type'' (for more information, see wiki:rf). {{{rangeFinder(int type, int priority)}}} Uses the wiki:rangefinder in the current direction, with no limit on distance. Uses the specified ''type''. {{{rangeFinder(int priority)}}} Uses the wiki:rangefinder in the current direction, with no limit on distance. Uses type #1. {{{rotate(double rot, double azi, int priority)}}} Rotates the bot by a rotational angle ''rot'' and an azimuthal angle ''azi''. '''Command Queue management''' {{{forgetAllTasks(int priority)}}} Clears Quagent command queue, acts as a soft "reset". {{{pause(int time, int priority)}}} Pauses command queue execution. {{{pop(int priority)}}} Pops action off command queue. {{{skip(int priority)}}} Skips the next AI game frame. For more information, see wiki:sk. '''[[ProtocolZero]] Queries''' {{{currentHealth(int priority)}}} Returns Quagent's current health. {{{maxHealth(int priority)}}} Returns Quagent's maximum health. Kind of useless. {{{currentArmour(int priority)}}} Returns Quagent's current armor. British spelling adds class. {{{maxArmour(int priority)}}} Returns Quagent's maximum armor. {{{canSee(int entityid, int priority)}}} Returns true if entity can see specified ''wiki:entityid''. Also returns distance, yaw, and pitch to target. {{{facing(int priority)}}} Returns the Quagent's current direction vector. '''[[ProtocolOne]] Actions (compound functions)''' {{{rotateMove(double rot, double azi, double dist, double speed, int obstacles, int priority)}}} Rotates by ''rot''ational and ''azi''muthal angles to face a new direction, then moves in that direction for ''dist''. {{{rotateMove(double rot, double azi, double speed, int obstacles, int priority)}}} Rotates by 'rot' and 'azi' to face a new direction, then moves in that direction indefinitely. {{{rotateFireWeapon(double rot, double azi, int priority)}}} Rotates by 'rot' and 'azi' to face a new direction, then fires weapon. {{{moveFireWeapon(double dir, double dist, double speed, int obstacles, int priority)}}} Moves ''dist'' distance in the specified ''dir'' direction, then fires weapon. {{{findMaxiumumDirection(int priority)}}} Returns the deepest direction as detected by the type 1 wiki:rangefinder. This values is directly returned by the function. {{{faceMaximumDirection(int priority)}}} Finds the maximum direction, and then rotates to face it. Does not return anything. {{{findEntityDirection(int entityid, int priority)}}} Directly returns the direction of the specified entityid, in the form of [rotational,azimuthal]. Returns -1 if nothing found. {{{faceEntityDirection(int entityid, int priority)}}} Finds the direction of specified entity, then rotates to face this direction. {{{gotoEntity(int entityid, double speed, int obstacles, int priority)}}} Moves to the specified entity. using the specified ''speed''. {{{followEntity(int entityid, double speed, int obstacles, long duration, int priority)}}} Follows the specified entity for ''duration''. {{{showImage(int priority)}}} Displays a depth mapping representing the bot's current "sight". = Class structure = = Example behaviors = * These assume that the Client object (which represents a Quagent) has been instantiated as "client". '''Take an depthmap of the player.''' {{{ client.faceEntityDirection(0,1); client.showImage(1); }}}