bot
Class SimpleBot

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.SimpleBot
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.agent.IAgent, cz.cuni.amis.pogamut.base.utils.IControllable

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

Example of Simple Pogamut bot, that randomly walks around the map. Bot is uncapable of handling movers so far.


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
           
 double currentTime
           
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game game
           
 java.util.HashMap<cz.cuni.amis.pogamut.ut2004.communication.messages.UnrealId,cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint> knownNavPoints
           
 double lastMovementTime
           
 cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myBegListener
           
 cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myMapListObtainedListener
           
 cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint myNavTarget
           
 java.util.ArrayList<cz.cuni.amis.pogamut.base3d.worldview.objects.ILocated> myPath
           
 cz.cuni.amis.pogamut.base.agent.navigation.PathPlannerListener myPathListener
           
 cz.cuni.amis.pogamut.ut2004.agent.navigation.UTAstar myPathPlanner
           
 boolean pathReceived
           
 boolean pathRequested
           
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players players
           
 
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
SimpleBot(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)
           
 
Method Summary
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  boolean goToLocation(cz.cuni.amis.pogamut.base3d.worldview.objects.Location targetLocation)
          Goes to target location.
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.
 
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

pathRequested

public boolean pathRequested

pathReceived

public boolean pathReceived

knownNavPoints

public java.util.HashMap<cz.cuni.amis.pogamut.ut2004.communication.messages.UnrealId,cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint> knownNavPoints

myNavTarget

public cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint myNavTarget

currentTime

public double currentTime

lastMovementTime

public double lastMovementTime

game

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game game

agentInfo

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo agentInfo

players

public cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players players

myPathPlanner

public cz.cuni.amis.pogamut.ut2004.agent.navigation.UTAstar myPathPlanner

myMapListObtainedListener

public cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myMapListObtainedListener

myBegListener

public cz.cuni.amis.pogamut.base.agent.worldview.WorldEventListener myBegListener

myPathListener

public cz.cuni.amis.pogamut.base.agent.navigation.PathPlannerListener myPathListener
Constructor Detail

SimpleBot

public SimpleBot(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)
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 -

goToLocation

private 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:

pickNewRandomNavTarget

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

Returns: