bot
Class Bot

Package class diagram package Bot
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController<BOT>
      extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController<BOT>
          extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
              extended by bot.Bot
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.agent.module.IAgentLogic, cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController, cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotLogicController

public class Bot
extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController

Pogamut's "Hello world!" example showing few extra things such as introspection and various bot-initializing methods.

Author:
Michal Bida aka Knight, Rudolf Kadlec aka ik, Jakub Gemrot aka Jimmy

Field Summary
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo agentInfo
           
 double currentTime
           
protected static double FEATURES_INTERVAL
           
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game game
           
 double gmtTime
           
 ItemMemory itemMemory
           
 HashMap<cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId,cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint> knownNavPoints
           
protected  double lastFeaturesTime
           
 int lifeTime
           
 String mapMarkings
           
 cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BeginMessage> myBegListener
          Listener to Beg Message
static boolean noFrames
           
protected static String PERC_LOG
           
 String planningFilename
           
 cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players players
           
static double TMP_TimeSpeed
           
static double TMP_TimeStart
           
 boolean verbose
           
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
act, body, config, descriptors, fwMap, info, items, listenerRegistrator, move, navBuilder, pathExecutor, pathPlanner, random, raycasting, senses, shoot, stats, weaponPrefs, weaponry, world
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
logicModule
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
bot, log, user, USER_LOG_CATEGORY_ID
 
Constructor Summary
Bot()
           
 
Method Summary
 void botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo gameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange currentConfig, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init)
          Handshake with GameBots2004 is over - bot has information about the map in its world view.
 void botKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled event)
          Called each time the bot dies.
 void botSpawned(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo gameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange config, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self self)
          The bot is initilized in the environment - a physical representation of the bot is present in the game.
 void createAgent()
           
protected  void doAction(String act)
           
 int getCurrentTime()
           
 DecisionModuleImpl getDecisions()
          Main method that controls the bot - makes decisions what to do next.
 cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize getInitializeCommand()
          Here we can modify initializing command for our bot, e.g., sets its name or skin.
 ArrayList<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item> getKnownWeapons()
           
 cz.cuni.amis.pogamut.base3d.worldview.object.Location getLocation()
           
 Object getSeeItem(long id)
           
 cz.cuni.amis.pogamut.base3d.worldview.IVisionWorldView getWorldView()
           
 void initializeController(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot bot)
           
 void logic()
           
static void main(String[] args)
           
 void prepareBot(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot bot)
          Initialize all necessary variables here, before the bot actually receives anything from the environment.
 void runAroundItemsInTheMap(ArrayList<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item> itemsToRunAround, boolean b)
           
 void safeRunToLocation(cz.cuni.amis.pogamut.base3d.worldview.object.Location location)
           
 void setPogamutEndEventListener(IPogamutEndEventListener _listener)
           
protected  void shutdownAgent()
           
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
finishControllerInitialization, getAct, getBody, getBot, getConfig, getDescriptors, getFwMap, getGame, getInfo, getItems, getMove, getNavBuilder, getPathExecutor, getPathPlanner, getPlayers, getRandom, getRaycasting, getSenses, getShoot, getStats, getWeaponPrefs, getWeaponry, getWorld, initializeListeners, initializeModules, initializePathFinding
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
getLogicInitializeTime, getLogicShutdownTime, logicInitialize, logicShutdown
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
botShutdown, getLog, getPassword
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
botShutdown, getLog, getPassword
 

Field Detail

verbose

public boolean verbose

gmtTime

public double gmtTime

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

mapMarkings

public String mapMarkings

planningFilename

public String planningFilename

lifeTime

public int lifeTime

noFrames

public static boolean noFrames

knownNavPoints

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

currentTime

public double currentTime

lastFeaturesTime

protected double lastFeaturesTime

FEATURES_INTERVAL

protected static final double FEATURES_INTERVAL
See Also:
Constant Field Values

itemMemory

public ItemMemory itemMemory

TMP_TimeSpeed

public static double TMP_TimeSpeed

TMP_TimeStart

public static double TMP_TimeStart

myBegListener

public cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BeginMessage> myBegListener
Listener to Beg Message


PERC_LOG

protected static final String PERC_LOG
See Also:
Constant Field Values
Constructor Detail

Bot

public Bot()
Method Detail

setPogamutEndEventListener

public void setPogamutEndEventListener(IPogamutEndEventListener _listener)

getWorldView

public cz.cuni.amis.pogamut.base3d.worldview.IVisionWorldView getWorldView()
Overrides:
getWorldView in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController

getDecisions

public DecisionModuleImpl getDecisions()
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 environment 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.

Throws:
cz.cuni.amis.pogamut.base.exceptions.PogamutException

logic

public void logic()
           throws cz.cuni.amis.utils.exception.PogamutException
Specified by:
logic in interface cz.cuni.amis.pogamut.base.agent.module.IAgentLogic
Overrides:
logic in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
Throws:
cz.cuni.amis.utils.exception.PogamutException

doAction

protected void doAction(String act)

prepareBot

public void prepareBot(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot bot)
Initialize all necessary variables here, before the bot actually receives anything from the environment.

Specified by:
prepareBot in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
prepareBot in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController

botInitialized

public void botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo gameInfo,
                           cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange currentConfig,
                           cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init)
Handshake with GameBots2004 is over - bot has information about the map in its world view. Many agent modules are usable since this method is called.

Specified by:
botInitialized in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
botInitialized in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
Parameters:
gameInfo - informaton about the game type
config - information about configuration
init - information about configuration

shutdownAgent

protected void shutdownAgent()

botSpawned

public void botSpawned(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo gameInfo,
                       cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange config,
                       cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage init,
                       cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self self)
The bot is initilized in the environment - a physical representation of the bot is present in the game.

Specified by:
botSpawned in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
botSpawned in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
Parameters:
gameInfo - informaton about the game type
config - information about configuration
init - information about configuration
self - information about the agent

botKilled

public void botKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled event)
Called each time the bot dies. Good for reseting all bot's state dependent variables.

Specified by:
botKilled in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
botKilled in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
Parameters:
event -

getInitializeCommand

public cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize getInitializeCommand()
Here we can modify initializing command for our bot, e.g., sets its name or skin.

Specified by:
getInitializeCommand in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
getInitializeCommand in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
Returns:
instance of Initialize

runAroundItemsInTheMap

public void runAroundItemsInTheMap(ArrayList<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item> itemsToRunAround,
                                   boolean b)

getKnownWeapons

public ArrayList<cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item> getKnownWeapons()

getSeeItem

public Object getSeeItem(long id)

safeRunToLocation

public void safeRunToLocation(cz.cuni.amis.pogamut.base3d.worldview.object.Location location)

getCurrentTime

public int getCurrentTime()

getLocation

public cz.cuni.amis.pogamut.base3d.worldview.object.Location getLocation()

createAgent

public void createAgent()

initializeController

public void initializeController(cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot bot)
Specified by:
initializeController in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
initializeController in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController

main

public static void main(String[] args)
                 throws cz.cuni.amis.utils.exception.PogamutException
Throws:
cz.cuni.amis.utils.exception.PogamutException


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.