cz.cuni.amis.pogamut.emohawk.examples.twobots
Class EmohawkTwoBotsReacting

Package class diagram package EmohawkTwoBotsReacting
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.emohawk.bot.impl.EmohawkBotController
              extended by cz.cuni.amis.pogamut.emohawk.examples.twobots.EmohawkTwoBotsReacting
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 EmohawkTwoBotsReacting
extends EmohawkBotController

PogamutEmohawk's two bots example showing few extra things such as emoticons handling and characters synchronization.

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

Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.emohawk.bot.impl.EmohawkBotController
act, animations, comm, config, emohawkNavigation, emoticons, fwMap, game, getBackToNavGraph, info, inventory, listenerRegistrator, move, navigation, pathExecutor, pathPlanner, places, players, random, raycasting, runStraight, senses, stats, steering, 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_LOG_CATEGORY_ID
 
Constructor Summary
EmohawkTwoBotsReacting()
           
 
Method Summary
 void botFirstSpawn(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 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.
 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.
 void logic()
          Main method that controls the bot - makes decisions what to do next.
static void main(String[] args)
          This method is called when the bot is started either from IDE or from command line.
 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.
 
Methods inherited from class cz.cuni.amis.pogamut.emohawk.bot.impl.EmohawkBotController
finishControllerInitialization, getConfig, getFwMap, getGame, getInfo, getMove, getNavigation, getPathExecutor, getPathPlanner, getPlayers, getRandom, getRaycasting, getSenses, getStats, getWorld, initializeController, initializeListeners, initializeModules, initializePathFinding
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
beforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logicInitialize, logicShutdown
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
botShutdown, getAct, getBot, getLog, getPassword, getWorldView
 
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, getAct, getBot, getLog, getPassword, getWorldView
 

Constructor Detail

EmohawkTwoBotsReacting

public EmohawkTwoBotsReacting()
Method Detail

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

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

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

botFirstSpawn

public void botFirstSpawn(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:
botFirstSpawn in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
Overrides:
botFirstSpawn 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

logic

public void logic()
           throws cz.cuni.amis.utils.exception.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 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.

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.pogamut.base.exceptions.PogamutException
cz.cuni.amis.utils.exception.PogamutException

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 -

main

public static void main(String[] args)
                 throws cz.cuni.amis.utils.exception.PogamutException
This method is called when the bot is started either from IDE or from command line.

Parameters:
args -
Throws:
cz.cuni.amis.utils.exception.PogamutException


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