cz.cuni.amis.pogamut.ut2004.examples.communicatingbot
Class CommunicatingBot

Package class diagram package CommunicatingBot
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 cz.cuni.amis.pogamut.ut2004.examples.communicatingbot.CommunicatingBot
All Implemented Interfaces:
cz.cuni.amis.pogamut.base.agent.module.IAgentLogic, IUT2004BotController, IUT2004BotLogicController

public class CommunicatingBot
extends UT2004BotModuleController

CommunicatingBot is featuring utilization of PogamutJVMComm object to swiftly communicate with other bots within the same JVM ... note that if you're running ALL YOUR bots from single MAIN method, than you're using single JVM == you can easily use PogamutJVMComm.getInstance() and PogamutJVMComm.registerAgent(cz.cuni.amis.pogamut.base.agent.IObservingAgent, int) for inter-agent communication. Try to execute this bot on DM-1on1-Albatross and wait till they find each other. The bot is based on 02-NAVIGATION-BOT.

Author:
Jimmy

Field Summary
protected  UT2004PathAutoFixer autoFixer
          Path auto fixer watches for navigation failures and if some navigation link is found to be unwalkable, it removes it from underlying navigation graph.
protected static int COMM_CHANNEL
          Communication channel used by these bots.
protected  cz.cuni.amis.utils.Cooldown doNotFix
          We won't fix/hail the other bot if this is not cool.
protected  cz.cuni.amis.utils.Heatup iAmFixed
          TRUE == We can see each other! I'm seen by iAmSpotBy and I can see it as well!
protected  cz.cuni.amis.utils.Heatup iAmSpot
          If this is hot, than I have been spot and I'm searching (turning around) for the bot who has spot me stored within iAmSpotBy.
protected  cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId iAmSpotBy
          This bot has spot me!
protected  cz.cuni.amis.utils.Heatup iCanSee
          How long we're waiting for player to spot us and report it.
protected  cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId iCanSeeId
          Bot I'm fixating/hailing.
protected  TabooSet<NavPoint> tabooNavPoints
          Taboo set is working as "black-list", that is you might add some NavPoints to it for a certain time, marking them as "unavailable".
protected  NavPoint targetNavPoint
          Current navigation point we're navigating to.
 
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
CommunicatingBot()
           
 
Method Summary
 void botFirstSpawn(GameInfo gameInfo, ConfigChange config, InitedMessage init, Self self)
          First thing you HAVE TO do, is register on PogamutJVMComm to some channel
 void botInitialized(GameInfo gameInfo, ConfigChange config, InitedMessage init)
          The bot is initialized in the environment - a physical representation of the bot is present in the game.
 void botKilled(BotKilled event)
          Called each time our bot die.
 void botShutdown()
          DO NOT FORGET TO UNREGISTER YOUR AGENT FROM COMMUNICATION AT THE END! YOU HAVE TO PROVIDE THIS CLEANUP!!!
protected  NavPoint getRandomNavPoint()
          Randomly picks some navigation point to head to.
 void iCanSeePlayer(YouHaveBeenSpot event)
          I have received "ICanSeeYou" message !!!
 void iCanSeePlayerToo(YouHaveBeenSpotToo event)
          Somebody can see somebody too!!!
 void logic()
           
static void main(String[] args)
           
protected  void pathExecutorStateChange(cz.cuni.amis.pogamut.base.agent.navigation.PathExecutorState state)
          Path executor has changed its state (note that UT2004BotModuleController.getPathExecutor() is internally used by UT2004BotModuleController.getNavigation() as well!).
 void playerDisappear(cz.cuni.amis.pogamut.base3d.worldview.object.event.WorldObjectDisappearedEvent<Player> event)
          This method is called whenever some player disappears from my field of view.
 void playerUpdated(cz.cuni.amis.pogamut.base.communication.worldview.object.event.WorldObjectUpdatedEvent<Player> event)
          This method is called whenever some PLAYER object appears in my field of view
 void weCanSeeEachOther(WeCanSeeEachOther event)
          Cool, we can see each other!
 
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, getInitializeCommand, getLog, getPassword, getWorldView, prepareBot
 
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, getInitializeCommand, getLog, getPassword, getWorldView, prepareBot
 

Field Detail

COMM_CHANNEL

protected static final int COMM_CHANNEL
Communication channel used by these bots. Can be 0-MAX_INT, cannot be negative number.

See Also:
Constant Field Values

tabooNavPoints

protected TabooSet<NavPoint> tabooNavPoints
Taboo set is working as "black-list", that is you might add some NavPoints to it for a certain time, marking them as "unavailable".


targetNavPoint

protected NavPoint targetNavPoint
Current navigation point we're navigating to.


autoFixer

protected UT2004PathAutoFixer autoFixer
Path auto fixer watches for navigation failures and if some navigation link is found to be unwalkable, it removes it from underlying navigation graph. Note that UT2004 navigation graphs are some times VERY stupid or contains VERY HARD TO FOLLOW links...


iAmSpot

protected cz.cuni.amis.utils.Heatup iAmSpot
If this is hot, than I have been spot and I'm searching (turning around) for the bot who has spot me stored within iAmSpotBy.


iAmSpotBy

protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId iAmSpotBy
This bot has spot me!


iAmFixed

protected cz.cuni.amis.utils.Heatup iAmFixed
TRUE == We can see each other! I'm seen by iAmSpotBy and I can see it as well!


doNotFix

protected cz.cuni.amis.utils.Cooldown doNotFix
We won't fix/hail the other bot if this is not cool.


iCanSeeId

protected cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId iCanSeeId
Bot I'm fixating/hailing.


iCanSee

protected cz.cuni.amis.utils.Heatup iCanSee
How long we're waiting for player to spot us and report it.

Constructor Detail

CommunicatingBot

public CommunicatingBot()
Method Detail

botInitialized

public void botInitialized(GameInfo gameInfo,
                           ConfigChange config,
                           InitedMessage init)
The bot is initialized in the environment - a physical representation of the bot is present in the game.

Specified by:
botInitialized in interface IUT2004BotController
Overrides:
botInitialized in class UT2004BotController
Parameters:
config - information about configuration
init - information about configuration

botFirstSpawn

public void botFirstSpawn(GameInfo gameInfo,
                          ConfigChange config,
                          InitedMessage init,
                          Self self)
First thing you HAVE TO do, is register on PogamutJVMComm to some channel

Specified by:
botFirstSpawn in interface IUT2004BotController
Overrides:
botFirstSpawn in class UT2004BotController

botShutdown

public void botShutdown()
DO NOT FORGET TO UNREGISTER YOUR AGENT FROM COMMUNICATION AT THE END! YOU HAVE TO PROVIDE THIS CLEANUP!!!

Specified by:
botShutdown in interface IUT2004BotController
Overrides:
botShutdown in class UT2004BotController

iCanSeePlayer

public void iCanSeePlayer(YouHaveBeenSpot event)
I have received "ICanSeeYou" message !!!

Parameters:
event -

iCanSeePlayerToo

public void iCanSeePlayerToo(YouHaveBeenSpotToo event)
Somebody can see somebody too!!!

Parameters:
event -

weCanSeeEachOther

public void weCanSeeEachOther(WeCanSeeEachOther event)
Cool, we can see each other!

Parameters:
event -

playerUpdated

public void playerUpdated(cz.cuni.amis.pogamut.base.communication.worldview.object.event.WorldObjectUpdatedEvent<Player> event)
This method is called whenever some PLAYER object appears in my field of view

Parameters:
event -

playerDisappear

public void playerDisappear(cz.cuni.amis.pogamut.base3d.worldview.object.event.WorldObjectDisappearedEvent<Player> event)
This method is called whenever some player disappears from my field of view.

Parameters:
event -

logic

public void logic()
Specified by:
logic in interface cz.cuni.amis.pogamut.base.agent.module.IAgentLogic
Overrides:
logic in class UT2004BotLogicController

botKilled

public void botKilled(BotKilled event)
Called each time our bot die. Good for reseting all bot state dependent variables.

Specified by:
botKilled in interface IUT2004BotController
Overrides:
botKilled in class UT2004BotController
Parameters:
event -

pathExecutorStateChange

protected void pathExecutorStateChange(cz.cuni.amis.pogamut.base.agent.navigation.PathExecutorState state)
Path executor has changed its state (note that UT2004BotModuleController.getPathExecutor() is internally used by UT2004BotModuleController.getNavigation() as well!).

Parameters:
state -

getRandomNavPoint

protected NavPoint getRandomNavPoint()
Randomly picks some navigation point to head to.

Returns:
randomly choosed navpoint

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.