cz.cuni.amis.pogamut.ut2004.examples.ctfbot
Class CTFBot

Package class diagram package CTFBot
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<UT2004Bot>
              extended by cz.cuni.amis.pogamut.ut2004.examples.ctfbot.CTFBot
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.agent.module.IAgentLogic<cz.cuni.amis.pogamut.base.agent.module.LogicModule>, IUT2004BotController<UT2004Bot>, IUT2004BotLogicController<UT2004Bot,cz.cuni.amis.pogamut.base.agent.module.LogicModule>

public class CTFBot
extends UT2004BotModuleController<UT2004Bot>

Example of Simple Pogamut bot, that randomly walks around the map searching for preys shooting at everything that is in its way.

Author:
Rudolf Kadlec aka ik, Jimmy

Field Summary
 int deaths
          how many times the hunter died
protected  Player enemy
          Used internally to maintain the information about the bot we're currently hunting, i.e., should be firing at.
protected  boolean firstLogic
           
 int frags
          how many bot the hunter killed other bots (i.e., bot has fragged them / got point for killing somebody)
protected  GameInfo gameInfo
           
protected  GetItems getItemsGoal
           
protected  GoalManager goalManager
           
 int healthLevel
          how low the health level should be to start collecting health items
protected  int notMoving
          Global anti-stuck mechanism.
protected  cz.cuni.amis.pogamut.base3d.worldview.object.Location pathTarget
           
 boolean shouldCollectHealth
          boolean switch to activate collect health behavior
 boolean shouldCollectItems
          boolean switch to activate collect items behavior
 boolean shouldEngage
          boolean switch to activate engage behavior
 boolean shouldPursue
          boolean switch to activate pursue behavior
 boolean shouldRearm
          boolean switch to activate rearm behavior
protected  TabooSet<Item> tabooItems
          Taboo list of items that are forbidden for some time.
protected  cz.cuni.amis.utils.Heatup targetHU
           
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
act, body, combo, config, ctf, descriptors, fwMap, game, getBackToNavGraph, info, items, listenerRegistrator, move, navBuilder, navigation, pathExecutor, pathPlanner, players, random, raycasting, runStraight, senses, shoot, stats, visibility, 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_LOG_CATEGORY_ID
 
Constructor Summary
CTFBot()
           
 
Method Summary
 void botFirstSpawn(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init, Self self)
           
 void botInitialized(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init)
           
 void botKilled(BotKilled event)
           
 void botShutdown()
           
 Player getEnemy()
           
 FlagInfo getEnemyFlag()
           
 NavPoint getEnemyFlagBase()
           
 Initialize getInitializeCommand()
          Here we can modify initialization-command for our bot.
 FlagInfo getOurFlag()
           
 NavPoint getOurFlagBase()
           
 CTFBotParams getParams()
          Returns parameters of the bot.
 cz.cuni.amis.pogamut.base3d.worldview.object.Location getPathTarget()
           
 TabooSet<Item> getTaboo()
           
 boolean goTo(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated target)
           
 boolean goTo(cz.cuni.amis.pogamut.base3d.worldview.object.Location target)
           
 boolean holdingOrSupporting()
           
 void logic()
          Main method that controls the bot - makes decisions what to do next.
static void main(String[] args)
           
 void playerKilled(PlayerKilled event)
          PlayerKilled listener that provides "frag" counting + is switches the state of the hunter.
 void prepareBot(UT2004Bot bot)
          Bot's preparation - called before the bot is connected to GB2004 and launched into UT2004.
protected  void reset()
          Resets the state of the Hunter.
 void shoot()
           
 void updateFight()
           
 void updateFight(Player newEnemy)
           
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
finishControllerInitialization, getBody, getCombo, getConfig, getDescriptors, getFwMap, getGame, getInfo, getItems, getMove, getNavBuilder, getNavigation, getPathExecutor, getPathPlanner, getPlayers, getRandom, getRaycasting, getSenses, getShoot, getStats, getVisibility, getWeaponPrefs, getWeaponry, 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
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
getAct, getBot, getLog, getPassword, getWorldView
 

Field Detail

shouldEngage

public boolean shouldEngage
boolean switch to activate engage behavior


shouldPursue

public boolean shouldPursue
boolean switch to activate pursue behavior


shouldRearm

public boolean shouldRearm
boolean switch to activate rearm behavior


shouldCollectItems

public boolean shouldCollectItems
boolean switch to activate collect items behavior


shouldCollectHealth

public boolean shouldCollectHealth
boolean switch to activate collect health behavior


healthLevel

public int healthLevel
how low the health level should be to start collecting health items


frags

public int frags
how many bot the hunter killed other bots (i.e., bot has fragged them / got point for killing somebody)


deaths

public int deaths
how many times the hunter died


gameInfo

protected GameInfo gameInfo

pathTarget

protected cz.cuni.amis.pogamut.base3d.worldview.object.Location pathTarget

enemy

protected Player enemy
Used internally to maintain the information about the bot we're currently hunting, i.e., should be firing at.


tabooItems

protected TabooSet<Item> tabooItems
Taboo list of items that are forbidden for some time.


getItemsGoal

protected GetItems getItemsGoal

firstLogic

protected boolean firstLogic

goalManager

protected GoalManager goalManager

targetHU

protected final cz.cuni.amis.utils.Heatup targetHU

notMoving

protected int notMoving
Global anti-stuck mechanism. When this counter reaches a certain constant, the bot's mind gets a reset().

Constructor Detail

CTFBot

public CTFBot()
Method Detail

getParams

public CTFBotParams getParams()
Returns parameters of the bot.

Returns:

getPathTarget

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

playerKilled

public void playerKilled(PlayerKilled event)
PlayerKilled listener that provides "frag" counting + is switches the state of the hunter.

Parameters:
event -

prepareBot

public void prepareBot(UT2004Bot bot)
Bot's preparation - called before the bot is connected to GB2004 and launched into UT2004.

Specified by:
prepareBot in interface IUT2004BotController<UT2004Bot>
Overrides:
prepareBot in class UT2004BotController<UT2004Bot>

botInitialized

public void botInitialized(GameInfo gameInfo,
                           ConfigChange currentConfig,
                           InitedMessage init)
Specified by:
botInitialized in interface IUT2004BotController<UT2004Bot>
Overrides:
botInitialized in class UT2004BotController<UT2004Bot>

getInitializeCommand

public Initialize getInitializeCommand()
Here we can modify initialization-command for our bot.

Specified by:
getInitializeCommand in interface IUT2004BotController<UT2004Bot>
Overrides:
getInitializeCommand in class UT2004BotController<UT2004Bot>
Returns:

botFirstSpawn

public void botFirstSpawn(GameInfo gameInfo,
                          ConfigChange currentConfig,
                          InitedMessage init,
                          Self self)
Specified by:
botFirstSpawn in interface IUT2004BotController<UT2004Bot>
Overrides:
botFirstSpawn in class UT2004BotController<UT2004Bot>

botShutdown

public void botShutdown()
Specified by:
botShutdown in interface IUT2004BotController<UT2004Bot>
Overrides:
botShutdown in class UT2004BotController<UT2004Bot>

goTo

public boolean goTo(cz.cuni.amis.pogamut.base3d.worldview.object.ILocated target)

goTo

public boolean goTo(cz.cuni.amis.pogamut.base3d.worldview.object.Location target)

holdingOrSupporting

public boolean holdingOrSupporting()

updateFight

public void updateFight()

updateFight

public void updateFight(Player newEnemy)

shoot

public void shoot()

reset

protected void reset()
Resets the state of the Hunter.


getOurFlagBase

public NavPoint getOurFlagBase()

getEnemyFlagBase

public NavPoint getEnemyFlagBase()

getOurFlag

public FlagInfo getOurFlag()

getEnemyFlag

public FlagInfo getEnemyFlag()

getEnemy

public Player getEnemy()

logic

public void logic()
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<cz.cuni.amis.pogamut.base.agent.module.LogicModule>
Overrides:
logic in class UT2004BotLogicController<UT2004Bot>
Throws:
cz.cuni.amis.pogamut.base.exceptions.PogamutException

getTaboo

public TabooSet<Item> getTaboo()

botKilled

public void botKilled(BotKilled event)
Specified by:
botKilled in interface IUT2004BotController<UT2004Bot>
Overrides:
botKilled in class UT2004BotController<UT2004Bot>

main

public static void main(String[] args)
                 throws cz.cuni.amis.utils.exception.PogamutException
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.