cz.cuni.amis.pogamut.ut2004.bot.impl
Class UT2004BotController<BOT extends UT2004Bot>

java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController<BOT>
All Implemented Interfaces:
IUT2004BotController<BOT>
Direct Known Subclasses:
UT2004BotLogicController

public class UT2004BotController<BOT extends UT2004Bot>
extends java.lang.Object
implements IUT2004BotController<BOT>


Field Summary
protected  BOT bot
          Instance of the bot we're controlling.
protected  LogCategory log
          Alias for user's log.
protected  LogCategory user
          Deprecated. use log instead
static java.lang.String USER_LOG_CATEGORY_ID
          Name of the log category of the user log.
 
Constructor Summary
UT2004BotController()
           
 
Method Summary
 void botInitialized(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init)
          This method is called whenever InitedMessage is received.
 void botKilled(BotKilled event)
          Called whenever the bot gets killed inside the game.
 void botShutdown()
          Called whenever the bot is shutdown (has finished) or killed (not in the game but as the instance).
 void botSpawned(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init, Self self)
          This method is called only once whenever first batch of information what the bot can see is received.
 void finishControllerInitialization()
          Called after IUT2004BotController.botSpawned(GameInfo, ConfigChange, InitedMessage, Self) as a hook for Pogamut's core developers to finalize initialization of various modules.
 IAct getAct()
           
 Initialize getInitializeCommand()
          This method is called after handshake with GameBots2004 is over and the GameBots2004 is awaiting the INIT command (Initialize class).
 LogCategory getLog()
          Returns user logger.
 PasswordReply getPassword()
          Returns password that should be used to access the GameBots2004 server.
 IVisionWorldView getWorldView()
           
 void initializeController(BOT bot)
          Called during the construction of the UT2004Bot before the GameBots2004 greets the bot even before IUT2004BotController.prepareBot(UT2004Bot) method.
 void prepareBot(BOT bot)
          Called during the construction of the UT2004Bot before the GameBots2004 greets the bot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_LOG_CATEGORY_ID

public static final java.lang.String USER_LOG_CATEGORY_ID
Name of the log category of the user log.

See Also:
Constant Field Values

bot

protected BOT extends UT2004Bot bot
Instance of the bot we're controlling.


user

protected LogCategory user
Deprecated. use log instead
User log - it's log-level is initially set to Level.ALL.


log

protected LogCategory log
Alias for user's log.

Constructor Detail

UT2004BotController

public UT2004BotController()
Method Detail

initializeController

public void initializeController(BOT bot)
Description copied from interface: IUT2004BotController
Called during the construction of the UT2004Bot before the GameBots2004 greets the bot even before IUT2004BotController.prepareBot(UT2004Bot) method.

NOTE: This is Pogamut's developers reserved method - do not override it and if you do, always use 'super' to call parent's initializeController.

Specified by:
initializeController in interface IUT2004BotController<BOT extends UT2004Bot>

prepareBot

public void prepareBot(BOT bot)
Description copied from interface: IUT2004BotController
Called during the construction of the UT2004Bot before the GameBots2004 greets the bot.

Specified by:
prepareBot in interface IUT2004BotController<BOT extends UT2004Bot>

getPassword

public PasswordReply getPassword()
Description copied from interface: IUT2004BotController
Returns password that should be used to access the GameBots2004 server.

Called only if the bot is challenged by the password request.

Specified by:
getPassword in interface IUT2004BotController<BOT extends UT2004Bot>
Returns:

getInitializeCommand

public Initialize getInitializeCommand()
Description copied from interface: IUT2004BotController
This method is called after handshake with GameBots2004 is over and the GameBots2004 is awaiting the INIT command (Initialize class). Here you have to construct the Initialize message where you may specify many starting parameters of the bot including: This message is then saved to private field initalizeCommand and is accessible via getInitializeCommand() method if required to probe the starting parameters (even though they can be changed during the bot's lifetime!).

Specified by:
getInitializeCommand in interface IUT2004BotController<BOT extends UT2004Bot>

botInitialized

public void botInitialized(GameInfo gameInfo,
                           ConfigChange currentConfig,
                           InitedMessage init)
Description copied from interface: IUT2004BotController
This method is called whenever InitedMessage is received. Various agent modules are usable since this method is called.

Specified by:
botInitialized in interface IUT2004BotController<BOT extends UT2004Bot>

botSpawned

public void botSpawned(GameInfo gameInfo,
                       ConfigChange currentConfig,
                       InitedMessage init,
                       Self self)
Description copied from interface: IUT2004BotController
This method is called only once whenever first batch of information what the bot can see is received. It is sort of "first-logic-method" where you may issue commands for the first time and handle everything else in bot's logic then. It eliminates the need to have 'boolean firstLogic' field inside your bot.

Note that this method has advantage over the IUT2004BotController.botInitialized(GameInfo, ConfigChange, InitedMessage) that you already have Self object.

Specified by:
botSpawned in interface IUT2004BotController<BOT extends UT2004Bot>

finishControllerInitialization

public void finishControllerInitialization()
Description copied from interface: IUT2004BotController
Called after IUT2004BotController.botSpawned(GameInfo, ConfigChange, InitedMessage, Self) as a hook for Pogamut's core developers to finalize initialization of various modules.

NOTE: This is Pogamut's developers reserved method - do not override it and if you do, always use 'super' to call parent's finishControllerInitialization.

Specified by:
finishControllerInitialization in interface IUT2004BotController<BOT extends UT2004Bot>

botKilled

public void botKilled(BotKilled event)
Description copied from interface: IUT2004BotController
Called whenever the bot gets killed inside the game.

Specified by:
botKilled in interface IUT2004BotController<BOT extends UT2004Bot>

botShutdown

public void botShutdown()
Description copied from interface: IUT2004BotController
Called whenever the bot is shutdown (has finished) or killed (not in the game but as the instance).

Use the method to save your work / data collected during the run of the agent.

Pogamut's guarantee that this method is called even if exception happens inside your previous code.

Specified by:
botShutdown in interface IUT2004BotController<BOT extends UT2004Bot>

getWorldView

public IVisionWorldView getWorldView()

getAct

public IAct getAct()

getLog

public LogCategory getLog()
Returns user logger. This call is equivalent to bot.getLogger().getCategory(USER_LOG_ID).

Specified by:
getLog in interface IUT2004BotController<BOT extends UT2004Bot>
Returns: