cz.cuni.amis.pogamut.ut2004.examples.emotionalbot
Class EmotionalBot

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

public class EmotionalBot
extends UT2004BotModuleController

Example of integration Pogamut with ALMA (http://www.dfki.de/~gebhard/alma/). The bot walks around the map randomly. Bot is reacting to chat messages ("positive", "negative" and "happy") that generate emotions GRATITUDE ("positive"), ANGER ("negative") and JOY ("happy"). If the bot will be damaged, emotion anger will be generated. Bot will start jumping if his mood pleasure is positive and emotion JOY is active. Bot will move slow if his mood pleasure is below 0.

Author:
Michal Bida

Field Summary
 double currentTime
          current UT2004 time
 boolean isWalking
          If the bot is walking or running
 double lastMessageTime
          Last time we sent message about our current emotional state
static double MESSAGE_DELAY
          Delay between two emotional messages
protected  ALMA myALMA
          emotion engine
 cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<BeginMessage> myBegListener
          Listener to begin message, that will update currentTime for our agent.
protected  EEventGenerator myEEventGenerator
          event generator
 String myName
          desired name of our agent
 
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
EmotionalBot()
           
 
Method Summary
 void botInitialized(GameInfo gameInfo, ConfigChange config, InitedMessage init)
          The bot is initilized in the environment - a physical representation of the bot is present in the game.
 void botKilled(BotKilled event)
          Called each time our bot die.
 Initialize getInitializeCommand()
          Here we can modify initializing command for our bot.
 void logic()
          Main method that controls the bot - makes decisions what to do next.
static void main(String[] args)
           
 void prepareBot(UT2004Bot bot)
           
static String roundTwoDecimals(double d)
           
 
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
botFirstSpawn, 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
botFirstSpawn, botShutdown, getAct, getBot, getLog, getPassword, getWorldView
 

Field Detail

myName

public String myName
desired name of our agent


myALMA

protected ALMA myALMA
emotion engine


myEEventGenerator

protected EEventGenerator myEEventGenerator
event generator


currentTime

public double currentTime
current UT2004 time


isWalking

public boolean isWalking
If the bot is walking or running


lastMessageTime

public double lastMessageTime
Last time we sent message about our current emotional state


MESSAGE_DELAY

public static final double MESSAGE_DELAY
Delay between two emotional messages

See Also:
Constant Field Values

myBegListener

public cz.cuni.amis.pogamut.base.communication.worldview.event.IWorldEventListener<BeginMessage> myBegListener
Listener to begin message, that will update currentTime for our agent.

Constructor Detail

EmotionalBot

public EmotionalBot()
Method Detail

getInitializeCommand

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

Specified by:
getInitializeCommand in interface IUT2004BotController
Overrides:
getInitializeCommand in class UT2004BotController
Returns:

prepareBot

public void prepareBot(UT2004Bot bot)
Specified by:
prepareBot in interface IUT2004BotController
Overrides:
prepareBot in class UT2004BotController

botInitialized

public void botInitialized(GameInfo gameInfo,
                           ConfigChange config,
                           InitedMessage init)
The bot is initilized 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

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

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 -

roundTwoDecimals

public static String roundTwoDecimals(double d)

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.