bot
Class PolymorphBot

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.AbstractAgent
      extended by cz.cuni.amis.pogamut.base.agent.AbstractObservingAgent<WORLD_VIEW>
          extended by cz.cuni.amis.pogamut.base.agent.AbstractGhostAgent<WORLD_VIEW>
              extended by cz.cuni.amis.pogamut.base.agent.AbstractEmbodiedAgent<WORLD_VIEW>
                  extended by cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot<WorldView>
                      extended by cz.cuni.amis.pogamut.ut2004.bot.ThreadedUT2004Bot<WorldView>
                          extended by cz.cuni.amis.pogamut.ut2004.bot.SyncUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
                              extended by bot.PolymorphBot
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.agent.IAgent, cz.cuni.amis.pogamut.base.utils.IControllable

public class PolymorphBot
extends cz.cuni.amis.pogamut.ut2004.bot.SyncUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>

Emotional scenario polymorph.


Nested Class Summary
 
Nested classes/interfaces inherited from class cz.cuni.amis.pogamut.base.agent.AbstractGhostAgent
cz.cuni.amis.pogamut.base.agent.AbstractGhostAgent.AgentAct
 
Field Summary
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo agentInfo
          bot memory module - general info about this agent - location, rotation, etc.
private static double AVOID_OBSTACLE_FUNCTION
           
private static double AVOID_OBSTACLE_FUNCTION_MULTI
           
private static double AVOID_OBSTACLE_MIN_DISTANCE
           
private static double AVOID_OBSTACLE_RUN_LENGTH
           
private static double AVOID_OBSTACLE_RUN_VECTOR_LENGTH
           
static double AVOID_OBSTACLE_SECOND_RUN_MULTI
           
 boolean bHostilePolymorph
          If we are good or bad polymorph
 double biteDelayConst
          Minimal delay between two bites
 double biteDurationConst
          How long we will pause logic when we are biting.
 boolean bStationaryPolymorph
          Ff our polymorph is just staying at its place
 double currentTime
          Current UnrealTournament time
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game game
          bot memory module - general info about the game - map, timelimit, etc
 java.util.HashMap<cz.cuni.amis.pogamut.ut2004.communication.messages.UnrealId,cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint> knownNavPoints
          All NavPoints on the map are stored here
 double lastBiteTime
          Last time we have bitten someone
 double lastMessageTime
          Last time we have sent text message
 double lastMovementTime
          Last time we've actually moved
 double messageDelayConst
          Minimal delay between two messages sent
 double messageFadeOutConst
          Message text bubble fade out time
 cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myBegListener
          Listens to BeginMessage and stores current UnrealTournament time
 cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myMapListObtainedListener
          Here we will listen to map event and store all nav points in our internals
 cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint myNavTarget
          NavPoint i am heading to
 java.util.ArrayList<cz.cuni.amis.pogamut.base3d.worldview.objects.ILocated> myPath
          agent pathing helper variable
 cz.cuni.amis.pogamut.base.agent.navigation.PathPlannerListener myPathListener
          Path listener - initialized in goToLocation method
 cz.cuni.amis.pogamut.ut2004.agent.navigation.UTAstar myPathPlanner
          Path finding module
 boolean pathReceived
          agent pathing helper variable
 boolean pathRequested
          agent pathing helper variable
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players players
          bot memory module - general info about other agents we can see - location, rotation, etc.
 cz.cuni.amis.pogamut.base3d.worldview.objects.Location startLocation
          Our start location
 cz.cuni.amis.pogamut.base3d.worldview.objects.Rotation startRotation
          Our start rotation
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.ThreadedUT2004Bot
logicAlive, logicRunning, logicShouldBeAlive, logicShouldRun, logicThread
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.AbstractAgent
DEFAULT_AGENT_TIMEOUT_MILLIS
 
Constructor Summary
PolymorphBot(cz.cuni.amis.pogamut.base.utils.logging.AgentLogger logger, cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView worldView, cz.cuni.amis.pogamut.base.communication.commands.ICommandSerializer commandSerializer)
          Constructor.
 
Method Summary
private  cz.cuni.amis.pogamut.base3d.worldview.objects.Location[] adjustLocations(cz.cuni.amis.pogamut.base3d.worldview.objects.Location[] moveLocation)
          This will compute new Location to avoid hitting other players.
protected  void botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange config, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init)
          The bot is initilized in the environment - a physical representation of the bot is present in the game.
protected  void botKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled event)
          Called each time our bot die.
protected  cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize createInitializeCommand()
          Here we can modify initializing command for our bot.
protected  void doLogic()
          Main method that controls the bot - makes decisions what to do next.
private  double forceFunction(double x, double distance)
          Used by obstacle avoidance code.
protected  cz.cuni.amis.pogamut.base3d.worldview.objects.Location getNearestNavLocation(cz.cuni.amis.pogamut.base3d.worldview.objects.Location targetLocation)
          Returns nearest navigation point to input location in the map.
 boolean goToLocation(cz.cuni.amis.pogamut.base3d.worldview.objects.Location targetLocation)
          Goes to target location.
 void initPolymoprh(ScenarioType type)
          Will set up our polymorph internal variables so he can be later set up correctly in the environment by INIT command.
private  cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint pickNewRandomNavTarget()
          Rendomly picks some navigation point to head to.
protected  void postPrepareBot(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo info)
          Here we have already received information about game in GameInfo
protected  void prePrepareBot()
          Initialize all necessary variables here, before the bot actually receives anything from the environment.
 void shutdown()
          Does nothign for the polymorph yet.
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.SyncUT2004Bot
doBotLogic
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.ThreadedUT2004Bot
getBotAlive, getLastLogicRunMillis, getLogicPeriodMillis, kill, logicThreadCreated, pause, resume, setLogicPeriodMillis, start, stop
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot
createPasswordReply, getGameInfo, getInitializeCommand, getPasswordReply, getWorldView, initCommandRequested, readyCommandRequested, setPassword
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.AbstractGhostAgent
getAct
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.AbstractAgent
addAgentJMXComponents, getAgentState, getAgentStopTimeoutMillis, getFolder, getJMX, getLogger, getName, log, logPlatform, setAgentState, setAgentState, setAgentStateDescription, terminate, terminate, terminate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myPath

public java.util.ArrayList<cz.cuni.amis.pogamut.base3d.worldview.objects.ILocated> myPath
agent pathing helper variable


pathRequested

public boolean pathRequested
agent pathing helper variable


pathReceived

public boolean pathReceived
agent pathing helper variable


knownNavPoints

public java.util.HashMap<cz.cuni.amis.pogamut.ut2004.communication.messages.UnrealId,cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint> knownNavPoints
All NavPoints on the map are stored here


myNavTarget

public cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint myNavTarget
NavPoint i am heading to


currentTime

public double currentTime
Current UnrealTournament time


lastMovementTime

public double lastMovementTime
Last time we've actually moved


lastBiteTime

public double lastBiteTime
Last time we have bitten someone


lastMessageTime

public double lastMessageTime
Last time we have sent text message


bHostilePolymorph

public boolean bHostilePolymorph
If we are good or bad polymorph


bStationaryPolymorph

public boolean bStationaryPolymorph
Ff our polymorph is just staying at its place


startLocation

public cz.cuni.amis.pogamut.base3d.worldview.objects.Location startLocation
Our start location


startRotation

public cz.cuni.amis.pogamut.base3d.worldview.objects.Rotation startRotation
Our start rotation


biteDurationConst

public double biteDurationConst
How long we will pause logic when we are biting.


biteDelayConst

public double biteDelayConst
Minimal delay between two bites


messageDelayConst

public double messageDelayConst
Minimal delay between two messages sent


messageFadeOutConst

public double messageFadeOutConst
Message text bubble fade out time


AVOID_OBSTACLE_FUNCTION

private static final double AVOID_OBSTACLE_FUNCTION
See Also:
Constant Field Values

AVOID_OBSTACLE_FUNCTION_MULTI

private static final double AVOID_OBSTACLE_FUNCTION_MULTI
See Also:
Constant Field Values

AVOID_OBSTACLE_MIN_DISTANCE

private static final double AVOID_OBSTACLE_MIN_DISTANCE
See Also:
Constant Field Values

AVOID_OBSTACLE_RUN_VECTOR_LENGTH

private static final double AVOID_OBSTACLE_RUN_VECTOR_LENGTH
See Also:
Constant Field Values

AVOID_OBSTACLE_RUN_LENGTH

private static final double AVOID_OBSTACLE_RUN_LENGTH
See Also:
Constant Field Values

AVOID_OBSTACLE_SECOND_RUN_MULTI

public static double AVOID_OBSTACLE_SECOND_RUN_MULTI

game

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game game
bot memory module - general info about the game - map, timelimit, etc


agentInfo

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo agentInfo
bot memory module - general info about this agent - location, rotation, etc.


players

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players players
bot memory module - general info about other agents we can see - location, rotation, etc.


myPathPlanner

public cz.cuni.amis.pogamut.ut2004.agent.navigation.UTAstar myPathPlanner
Path finding module


myMapListObtainedListener

public cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myMapListObtainedListener
Here we will listen to map event and store all nav points in our internals


myBegListener

public cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myBegListener
Listens to BeginMessage and stores current UnrealTournament time


myPathListener

public cz.cuni.amis.pogamut.base.agent.navigation.PathPlannerListener myPathListener
Path listener - initialized in goToLocation method

Constructor Detail

PolymorphBot

public PolymorphBot(cz.cuni.amis.pogamut.base.utils.logging.AgentLogger logger,
                    cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView worldView,
                    cz.cuni.amis.pogamut.base.communication.commands.ICommandSerializer commandSerializer)
Constructor.

Parameters:
logger -
worldView -
commandSerializer -
Method Detail

prePrepareBot

protected void prePrepareBot()
Initialize all necessary variables here, before the bot actually receives anything from the environment.

Specified by:
prePrepareBot in class cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>

postPrepareBot

protected void postPrepareBot(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo info)
Here we have already received information about game in GameInfo

Specified by:
postPrepareBot in class cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
Parameters:
info -

createInitializeCommand

protected cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize createInitializeCommand()
Here we can modify initializing command for our bot.

Specified by:
createInitializeCommand in class cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
Returns:

botInitialized

protected void botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange config,
                              cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init)
The bot is initilized in the environment - a physical representation of the bot is present in the game.

Specified by:
botInitialized in class cz.cuni.amis.pogamut.ut2004.bot.AbstractUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
Parameters:
config - information about configuration
init - information about configuration

doLogic

protected void doLogic()
                throws cz.cuni.amis.pogamut.base.exceptions.PogamutException
Main method that controls the bot - makes decisions what to do next. It is called iteratively by Pogamut engine every time a synchronous batch from the environement is received. This is usually 4 times per second - it is affected by visionTime variable, that can be adjusted in GameBots ini file in UT2004/System folder.

Specified by:
doLogic in class cz.cuni.amis.pogamut.ut2004.bot.SyncUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
Throws:
cz.cuni.amis.pogamut.base.exceptions.PogamutException

botKilled

protected void botKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled event)
Called each time our bot die. Good for reseting all bot state dependent variables.

Specified by:
botKilled in class cz.cuni.amis.pogamut.ut2004.bot.ThreadedUT2004Bot<cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004SyncLockableWorldView>
Parameters:
event -

initPolymoprh

public void initPolymoprh(ScenarioType type)
Will set up our polymorph internal variables so he can be later set up correctly in the environment by INIT command.

Parameters:
type -

shutdown

public void shutdown()
Does nothign for the polymorph yet.


forceFunction

private double forceFunction(double x,
                             double distance)
Used by obstacle avoidance code.

Parameters:
x -
distance -
Returns:

adjustLocations

private cz.cuni.amis.pogamut.base3d.worldview.objects.Location[] adjustLocations(cz.cuni.amis.pogamut.base3d.worldview.objects.Location[] moveLocation)
This will compute new Location to avoid hitting other players.

Parameters:
moveLocation -
Returns:

goToLocation

public boolean goToLocation(cz.cuni.amis.pogamut.base3d.worldview.objects.Location targetLocation)
Goes to target location. Keeps returning true while we are on our way there. If we are at location or some problem encountered, then returns false.

Parameters:
targetLocation -
Returns:

getNearestNavLocation

protected cz.cuni.amis.pogamut.base3d.worldview.objects.Location getNearestNavLocation(cz.cuni.amis.pogamut.base3d.worldview.objects.Location targetLocation)
Returns nearest navigation point to input location in the map.

Parameters:
targetLocation -
Returns:

pickNewRandomNavTarget

private cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint pickNewRandomNavTarget()
Rendomly picks some navigation point to head to.

Returns: