cz.cuni.amis.pogamut.ut2004.bot.command
Class AdvancedLocomotion

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.module.AgentModule<AGENT>
      extended by cz.cuni.amis.pogamut.base.agent.module.SensomotoricModule<UT2004Bot>
          extended by cz.cuni.amis.pogamut.ut2004.bot.command.BotCommands
              extended by cz.cuni.amis.pogamut.ut2004.bot.command.SimpleLocomotion
                  extended by cz.cuni.amis.pogamut.ut2004.bot.command.AdvancedLocomotion
All Implemented Interfaces:
IComponent

public class AdvancedLocomotion
extends SimpleLocomotion

Class providing Pogamut2 UT2004 advanced locomotion commands for the bot - strafing, advanced turning, dodging...


Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.SensomotoricModule
act, worldView
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
agent, controller, eventBus, log
 
Constructor Summary
AdvancedLocomotion(UT2004Bot agent, java.util.logging.Logger log)
          Constructor.
 
Method Summary
 void dodge(Vector3d direction)
          Makes the bot to dodge in the selected direction (this is in fact single jump that is executed to selected direction).
 void dodgeBack(ILocated botPosition, ILocated inFrontOfTheBot)
          Dodges to the back...
 void dodgeBack(ILocated botPosition, ILocated inFrontOfTheBot, double z)
          Dodges to the back...
 void dodgeLeft(ILocated botPosition, ILocated inFrontOfTheBot)
          Dodges to the left...
 void dodgeLeft(ILocated botPosition, ILocated inFrontOfTheBot, double z)
          Dodges to the left...
 void dodgeRight(ILocated botPosition, ILocated inFrontOfTheBot)
          Dodges to the right...
 void dodgeRight(ILocated botPosition, ILocated inFrontOfTheBot, double z)
          Dodges to the right...
 void doubleJump()
          Makes the bot to double jump instantly (issues GB JUMP command) with default settings.
 void doubleJump(double secondJumpDelay, double jumpZ)
          Makes the bot to double jump instantly (issues GB JUMP command) with custom settings.
 void generalJump(boolean doubleJump, double secondJumpDelay, double jumpZ)
          Makes the bot to jump instantly (issues GB JUMP command) with custom settings.
 void jump()
          Bot will make simple jump (Issues GB JUMP command)
 void jump(boolean doubleJump, double secondJumpDelay, double jumpZ)
          Makes the bot to jump (or double jump) instantly (issues GB JUMP command) with custom settings.
 void jump(double jumpZ)
          Makes the bot to jump instantly (issues GB JUMP command) with custom settings.
 void moveAlong(ILocated firstLocation, ILocated secondLocation)
          Makes the bot to move through first location to second location (may be specified directly or some ILocated object may be supplied - carefull with objects traversability).
 void moveContinuos()
          This makes the bot to run straight ahead continuously.
 void moveTo(ILocated location)
          Bot will move to supplied location.
 void setRotationSpeed(Rotation newRotationRate)
          Sets the rotation speed (rotation rate) for the bot.
 void setRun()
          Sets the running speed for the bot movement commands.
 void setSpeed(double speedMultiplier)
          Sets the speed multiplier for the bot.
 void setWalk()
          Sets the walking speed for the bot movement commands.
 void stopMovement()
          Makes the bot to stop all movement or turning.
 void strafeLeft(double distance)
          Bot strafes left.
 void strafeLeft(double distance, ILocated focusLocation)
          Bot strafes left.
 void strafeLeft(double distance, UnrealId focusId)
          Bot strafes left.
 void strafeRight(double distance)
          Bot strafes right.
 void strafeRight(double distance, ILocated focusLocation)
          Bot strafes right.
 void strafeRight(double distance, UnrealId focusId)
          Bot strafes right.
 void strafeTo(ILocated location, ILocated focusLocation)
          Makes the bot to move to location while looking at focusLocation.
 void strafeTo(ILocated location, UnrealId focus)
          Makes the bot to move at location, while looking at focus object.
 void turnHorizontal(int amount)
          Rotates the bot by the supported amount (in degrees) in left/right direction (issues GB ROTATE command)
 void turnTo(ILocated location)
          Bot will turn to face supported location (issues GB TURNTO command)
 void turnTo(Item item)
          Bot will turn to face 'item' (isseus GB TURNTO command), the bot will face the item even if it or the item moves.
 void turnTo(Player player)
          Bot will turn to face 'player' (isseus GB TURNTO command), the bot will face the player even if it or the player moves.
 void turnVertical(int amount)
          Rotates the bot by the supported amount (in degrees) in up/down direction (issues GB ROTATE command)
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.module.AgentModule
cleanUp, getComponentId, getLog, getState, initComponentId, isRunning, kill, pause, reset, resume, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdvancedLocomotion

public AdvancedLocomotion(UT2004Bot agent,
                          java.util.logging.Logger log)
Constructor. Setups the command module based on given agent and logger.

Parameters:
agent - AbstractUT2004Bot we will send commands for
log - Logger to be used for logging runtime/debug info.
Method Detail

moveAlong

public void moveAlong(ILocated firstLocation,
                      ILocated secondLocation)
Makes the bot to move through first location to second location (may be specified directly or some ILocated object may be supplied - carefull with objects traversability). Usage is when you want to have your bot to move really smooth. Where is the problem? If you would want to achive the same thing with 2 moveTo functions (first move to location1, when there move to location2), there may be a little lag - you have to check if you are already at first location and etc. This function can solve this problem as the check is done in UnrealScript. (issues GB MOVE command)

Parameters:
firstLocation - First location we will go through.
secondLocation - Second location we will go to (after reaching first).
See Also:
moveContinuous()

moveContinuos

public void moveContinuos()
This makes the bot to run straight ahead continuously. Will stop when other move command is issued - stopMovement, strafeTo, moveTo, moveAlong even turn commands will interrupt this. (issues GB CMOVE command)

See Also:
moveAlong(ILocated, ILocated)

strafeRight

public void strafeRight(double distance,
                        UnrealId focusId)
Bot strafes right. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be looking to object specified by the attribute focusId.

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
focusId - - UnrealId of the object that should be the bot focus.
See Also:
strafeLeft(double,ILocated)

strafeRight

public void strafeRight(double distance,
                        ILocated focusLocation)
Bot strafes right. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be looking to location specified by the attribute focusLocation.

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
focusLocation - - location where the bot should look
See Also:
strafeLeft(double,ILocated)

strafeRight

public void strafeRight(double distance)
Bot strafes right. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). Note that this will reset the bot focus. The bot will be looking straight ahead (however if the strafe is really long - more than 500 UT units - it will be visible the bot is turning slightly performing the strafe).

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
See Also:
strafeLeft(double)

strafeLeft

public void strafeLeft(double distance,
                       UnrealId focusId)
Bot strafes left. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be looking to object specified by the attribute focusId.

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
focusId - - UnrealId of the object that should be the bot focus.
See Also:
strafeRight(double,ILocated)

strafeLeft

public void strafeLeft(double distance,
                       ILocated focusLocation)
Bot strafes left. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). The bot will be looking to location specified by the attribute focusLocation.

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
focusLocation - - location where the bot should look
See Also:
strafeRight(double,ILocated)

strafeLeft

public void strafeLeft(double distance)
Bot strafes left. The length of the strafe is specified by distance attribute (in UT units, 1 UT unit equals roughly 1 cm). Note that this will reset the bot focus. The bot will be looking straight ahead (however if the strafe is really long - more than 500 UT units - it will be visible the bot is turning slightly performing the strafe).

Parameters:
distance - - how far the bot strafes (in UT units, 1 UT unit equals roughly 1 cm).
See Also:
strafeRight(double)

strafeTo

public void strafeTo(ILocated location,
                     ILocated focusLocation)
Makes the bot to move to location while looking at focusLocation. (issues GB STRAFE command)

Parameters:
location - Location we will strafe to.
focusLocation - Location we will look at while strafing.
See Also:
strafeTo(ILocated, UnrealId)

strafeTo

public void strafeTo(ILocated location,
                     UnrealId focus)
Makes the bot to move at location, while looking at focus object. Note that when you support focus object, the bot will update his focus (place he is looking at) according to focus object location (this will be provided by GB UnrealScript code). Usefull when you want to track some player position while moving somewhere else. (issues GB STRAFE command)

Parameters:
location - Location we will strafe to.
focus - Object with UrealId. We will look at this location while strafing. We will update our focus location according to the current position of this obejct in UT.
See Also:
strafeTo(ILocated, ILocated)

doubleJump

public void doubleJump()
Makes the bot to double jump instantly (issues GB JUMP command) with default settings.

See Also:
jump(), dodge(Vector3d)

generalJump

public void generalJump(boolean doubleJump,
                        double secondJumpDelay,
                        double jumpZ)
Makes the bot to jump instantly (issues GB JUMP command) with custom settings.

See also SimpleLocomotion.jump().

Parameters:
doubleJump - whether the bot should double jump
secondJumpDelay - If doubleJump, than after time specified here, the bot performs second jump of a double jump (if DoubleJump is true). Time is in seconds. GB2004 default is 0.5s.
jumpZ - than this is a force vector specifying how big the jump should be. Can't be set more than 2 * JumpZ = 680 for double jump.
See Also:
jump(), dodge(Vector3d)

doubleJump

public void doubleJump(double secondJumpDelay,
                       double jumpZ)
Makes the bot to double jump instantly (issues GB JUMP command) with custom settings.

See also SimpleLocomotion.jump().

Parameters:
secondJumpDelay - After time specified here, the bot performs second jump of a double jump (if DoubleJump is true). Time is in seconds. GB2004 default is 0.5s.
jumpZ - Force vector specifying how big the jump should be. Can't be set more than 2 * JumpZ = 680 for double jump.
See Also:
jump(), dodge(Vector3d)

dodge

public void dodge(Vector3d direction)
Makes the bot to dodge in the selected direction (this is in fact single jump that is executed to selected direction). (issues GB DODGE command)

Parameters:
direction - Vector (that will be normalized) that specifies direction of the jump.
See Also:
jump(), doubleJump()

dodgeRight

public void dodgeRight(ILocated botPosition,
                       ILocated inFrontOfTheBot)
Dodges to the right... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot

dodgeRight

public void dodgeRight(ILocated botPosition,
                       ILocated inFrontOfTheBot,
                       double z)
Dodges to the right... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot
z - allows you to dodge to the air, usual const is 50-100

dodgeLeft

public void dodgeLeft(ILocated botPosition,
                      ILocated inFrontOfTheBot)
Dodges to the left... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot

dodgeLeft

public void dodgeLeft(ILocated botPosition,
                      ILocated inFrontOfTheBot,
                      double z)
Dodges to the left... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot
z - allows you to dodge to the air, usual const is 50-100

dodgeBack

public void dodgeBack(ILocated botPosition,
                      ILocated inFrontOfTheBot)
Dodges to the back... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot

dodgeBack

public void dodgeBack(ILocated botPosition,
                      ILocated inFrontOfTheBot,
                      double z)
Dodges to the back... direction is taken as vector(botPosition, inFrontOfTheBot).

Parameters:
botPosition - current bot position
inFrontOfTheBot - usually the enemy of the bot
z - allows you to dodge to the air, usual const is 50-100

setSpeed

public void setSpeed(double speedMultiplier)
Sets the speed multiplier for the bot. By this number the bots default speed will be multiplied by. (issues GB CONF command)

Parameters:
speedMultiplier - Ranges from 0.1 to 2 (max may be set in ini in [RemoteBot] MaxSpeed)
See Also:
setRotationSpeed(Rotation)

setRotationSpeed

public void setRotationSpeed(Rotation newRotationRate)
Sets the rotation speed (rotation rate) for the bot. Default rotation rate can be set in GameBots INI file in UT2004/System directory ( look for DefaultRotationRate attribute). Default rotation rate is now Pitch=3072, Yaw=60000, Roll=2048 (pitch = up/down, yaw = left/right, roll = equivalent of doing a cartwheel). (issues GB CONF command)

Parameters:
newRotationRate - Default is Pitch=3072, Yaw=60000, Roll=2048. To achieve best results we suggest to multiply the default setting.
See Also:
setSpeed(double)

jump

public void jump()
Description copied from class: SimpleLocomotion
Bot will make simple jump (Issues GB JUMP command)

Overrides:
jump in class SimpleLocomotion

jump

public void jump(double jumpZ)
Makes the bot to jump instantly (issues GB JUMP command) with custom settings.

See also SimpleLocomotion.jump().

Parameters:
jumpZ - Force vector specifying how big the jump should be. Can't be set more than JumpZ = 340 for single jump.
See Also:
jump(), dodge(Vector3d)

jump

public void jump(boolean doubleJump,
                 double secondJumpDelay,
                 double jumpZ)
Makes the bot to jump (or double jump) instantly (issues GB JUMP command) with custom settings.

See also SimpleLocomotion.jump().

Parameters:
doubleJump - whether to perform double jump
secondJumpDelay - After time specified here, the bot performs second jump of a double jump (if DoubleJump is true). Time is in seconds. GB2004 default is 0.5s.
jumpZ - Force vector specifying how big the jump should be. Can't be set more than 2 * JumpZ = 680 for double jump.
See Also:
jump(), dodge(Vector3d)

moveTo

public void moveTo(ILocated location)
Description copied from class: SimpleLocomotion
Bot will move to supplied location. (issues GB MOVE command)

Overrides:
moveTo in class SimpleLocomotion
See Also:
SimpleLocomotion.stopMovement()

setRun

public void setRun()
Description copied from class: SimpleLocomotion
Sets the running speed for the bot movement commands. (issues GB SETWALK command)

Overrides:
setRun in class SimpleLocomotion
See Also:
SimpleLocomotion.setWalk()

setWalk

public void setWalk()
Description copied from class: SimpleLocomotion
Sets the walking speed for the bot movement commands. (issues GB SETWALK command)

Overrides:
setWalk in class SimpleLocomotion
See Also:
SimpleLocomotion.setRun()

stopMovement

public void stopMovement()
Description copied from class: SimpleLocomotion
Makes the bot to stop all movement or turning. (Does not stop shooting.) (issues GB STOP command)

Overrides:
stopMovement in class SimpleLocomotion
See Also:
SimpleLocomotion.moveTo(ILocated)

turnHorizontal

public void turnHorizontal(int amount)
Description copied from class: SimpleLocomotion
Rotates the bot by the supported amount (in degrees) in left/right direction (issues GB ROTATE command)

Overrides:
turnHorizontal in class SimpleLocomotion
Parameters:
amount - Amount of rotation in degrees.
See Also:
SimpleLocomotion.turnVertical(int), SimpleLocomotion.turnTo(ILocated)

turnTo

public void turnTo(ILocated location)
Description copied from class: SimpleLocomotion
Bot will turn to face supported location (issues GB TURNTO command)

Overrides:
turnTo in class SimpleLocomotion
Parameters:
location - Location we will face.
See Also:
SimpleLocomotion.turnHorizontal(int), SimpleLocomotion.turnVertical(int)

turnTo

public void turnTo(Player player)
Description copied from class: SimpleLocomotion
Bot will turn to face 'player' (isseus GB TURNTO command), the bot will face the player even if it or the player moves.

Overrides:
turnTo in class SimpleLocomotion
Parameters:
player - Player we will face.

turnTo

public void turnTo(Item item)
Description copied from class: SimpleLocomotion
Bot will turn to face 'item' (isseus GB TURNTO command), the bot will face the item even if it or the item moves.

Overrides:
turnTo in class SimpleLocomotion
Parameters:
item - Item we will face.

turnVertical

public void turnVertical(int amount)
Description copied from class: SimpleLocomotion
Rotates the bot by the supported amount (in degrees) in up/down direction (issues GB ROTATE command)

Overrides:
turnVertical in class SimpleLocomotion
Parameters:
amount - Amount of rotation in degrees.
See Also:
SimpleLocomotion.turnHorizontal(int), SimpleLocomotion.turnTo(ILocated)