bot
Class EventGenerator

java.lang.Object
  extended by bot.EventGenerator

public class EventGenerator
extends java.lang.Object

In this class we will generate all the events our agent can encounter in the scenario. We will send here notifications to emotion model to generate emotional events and we will also update agent internal state. This class contains number of constants that affects the event generation. Methods with notify word in their name are called by listeners defined in EmotionalBot.java each time new event of certain type arrives. From notify methods we will call process method that will process the message and generate events and update agent internal state.


Field Summary
private  int actionLeaveDelayConst
          Delay between two leave action events generated
private  cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player agentTalkingToAgentWith
          last agent that talked to agent we accompany somewhere
private  cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player agentTalkingToUs
          last agent that talked to us
private  double aloneEventDelayTimeConst
          When we detect we are alone, we will generete alone event every this constant seconds
private  double conversationIgnoreDelayConst
          Delay between two conversation ignore events
private  double conversationIgnoreTimeConst
          If the delay between last response and last message sent to the player is higher then this ignore event will be generated
 int conversationIgnoreTogetherTimeConst
          This is the time we need to be together with agentWith to generate ignoreEvent
private  double lastAloneEventTime
          helper variable - time of last alone event
private  double lostEventsDelayTimeConst
          Minimum time between two player lost events
private  double messageHistoryTimerConst
          in communication info history we will delete messages older than currentTime - this
private  double messageIntensityReductionMultiplier
          We will reduce the emotional intensity of messages by this number, 2 default
private  double messageReductionCountConst
          This means that when we are sent this number per messageHistoryTimerConst, we will reduce emotion intensity significantly!
private  EmotionalBot myAgent
          Pointer to our agent
private  double polymorphEventHistoryTimerConst
          How long we will remember polymorph triggered events
private  double polymorphEventReductionCountConst
          This means that when we encountered this number of events per polymorphEventHistoryTimerConst, we will reduce emotion intensity significantly!
private  double reappearEventTriggerTimeConst
          We will generate new appear event when we haven't seen player for this const seconds
private  double sightLostConst
          After this const seconds when we haven't seen pawn, we will count it as lost sight and stop updating timeTogetherCounter
private  double sightLostEventTriggerTimeConst
          If we haven't seen player for this time, we will generate player lost event if also other conditions met
private  double togetherEventTriggerTimeConst
          We will generate together event every this const seconds
 
Constructor Summary
EventGenerator(EmotionalBot myAgent)
          Only constructor for this class.
 
Method Summary
private  boolean detectAgentSpeakingInterruptions()
          Here we detect other agents interruptions.
private  void checkRepeatingEvents()
          Check agent ignore and proposal ignore events and generate them if necessary.
 void notifyBegin(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BeginMessage beg)
          New begin message received.
 void notifyBotDamaged(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotDamaged bd)
          New bot damaged message received (DAM message).
 void notifyGotInv(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ReceivedInventoryMsg rIM)
          New received inventory message received.
 void notifyPickup(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ItemPickedUp ipk)
          New item picked up message received.
 void notifyPlayer(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player plr)
          New player message received.
 void notifyPlayerDamaged(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerDamaged pldam)
          New player damage message received (HIT message).
 void notifyPlayerKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerKilled pk)
          New player killed message received (KIL message).
 void notifyTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          New global chat message received.
private  void processActionToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat gc)
          Some agent did action to me.
private  void processActionToOther(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat gc)
          Some agent did some action to other agent.
private  void processDamMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotDamaged bd)
          Process DAM message and generate appropriate emotion event.
private  void processGotInvMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ReceivedInventoryMsg rim)
          Process received inventory message (GOT), generates emotional event and store information into agents internals.
private  void processHitMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerDamaged pd)
          Process HIT message and generate appropriate emotion event.
private  void processItemRequestToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Process the message and store the corresponding item request to agent internals.
private  void processKillMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerKilled pk)
          Player killed message.
private  void processOtherTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Process text message sent by someone to other agent.
private  void processPickup(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ItemPickedUp ipk)
          Process pickup messages.
private  void processPlayer(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player pl)
          Before the playersHistory is updated this allows us to generate appeared events.
private  void processPlayerHistory()
          Here we will generate events - PlayerDissapearedEvent and PlayerTogetherEvent
private  void processPolymorphTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Generate fear and disliking or liking depending on the noise the polymorph is making.
private  void processProposalToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Here we process proposal sent to our agent.
private  void processProposalToOther(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Some proposal or proposal answer was sent to some other agent.
private  void processTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Here we will determine what kind of a situation this text message corresponds to and call appropriate methods that will process the message further.
private  void processTextMessageToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
          Here we will process text message adressed to our agent.
 void updatePlayerHistory(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player pl)
          Called each time we receive some PLR message (from listener).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAgent

private EmotionalBot myAgent
Pointer to our agent


agentTalkingToUs

private cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player agentTalkingToUs
last agent that talked to us


agentTalkingToAgentWith

private cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player agentTalkingToAgentWith
last agent that talked to agent we accompany somewhere


lastAloneEventTime

private double lastAloneEventTime
helper variable - time of last alone event


messageHistoryTimerConst

private double messageHistoryTimerConst
in communication info history we will delete messages older than currentTime - this


messageReductionCountConst

private double messageReductionCountConst
This means that when we are sent this number per messageHistoryTimerConst, we will reduce emotion intensity significantly! (number_of_message_in_our_window/this const the time window is defined by messageHistoryTimerConst


messageIntensityReductionMultiplier

private double messageIntensityReductionMultiplier
We will reduce the emotional intensity of messages by this number, 2 default


polymorphEventHistoryTimerConst

private double polymorphEventHistoryTimerConst
How long we will remember polymorph triggered events


polymorphEventReductionCountConst

private double polymorphEventReductionCountConst
This means that when we encountered this number of events per polymorphEventHistoryTimerConst, we will reduce emotion intensity significantly!


togetherEventTriggerTimeConst

private double togetherEventTriggerTimeConst
We will generate together event every this const seconds


sightLostEventTriggerTimeConst

private double sightLostEventTriggerTimeConst
If we haven't seen player for this time, we will generate player lost event if also other conditions met


reappearEventTriggerTimeConst

private double reappearEventTriggerTimeConst
We will generate new appear event when we haven't seen player for this const seconds


lostEventsDelayTimeConst

private double lostEventsDelayTimeConst
Minimum time between two player lost events


aloneEventDelayTimeConst

private double aloneEventDelayTimeConst
When we detect we are alone, we will generete alone event every this constant seconds


conversationIgnoreTimeConst

private double conversationIgnoreTimeConst
If the delay between last response and last message sent to the player is higher then this ignore event will be generated


conversationIgnoreDelayConst

private double conversationIgnoreDelayConst
Delay between two conversation ignore events


conversationIgnoreTogetherTimeConst

public int conversationIgnoreTogetherTimeConst
This is the time we need to be together with agentWith to generate ignoreEvent


actionLeaveDelayConst

private int actionLeaveDelayConst
Delay between two leave action events generated


sightLostConst

private double sightLostConst
After this const seconds when we haven't seen pawn, we will count it as lost sight and stop updating timeTogetherCounter

Constructor Detail

EventGenerator

public EventGenerator(EmotionalBot myAgent)
Only constructor for this class.

Parameters:
myAgent - agent we generate events for
Method Detail

notifyBegin

public void notifyBegin(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BeginMessage beg)
New begin message received.

Parameters:
beg - new begin message

notifyGotInv

public void notifyGotInv(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ReceivedInventoryMsg rIM)
New received inventory message received.

Parameters:
rIM - new received inventory message

notifyPickup

public void notifyPickup(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ItemPickedUp ipk)
New item picked up message received.

Parameters:
ipk - new item picked up message

notifyPlayer

public void notifyPlayer(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player plr)
New player message received.

Parameters:
plr - new player message

notifyTextMessage

public void notifyTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
New global chat message received.

Parameters:
message - new global chat message

notifyPlayerDamaged

public void notifyPlayerDamaged(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerDamaged pldam)
New player damage message received (HIT message).

Parameters:
pldam - new player damaged message

notifyPlayerKilled

public void notifyPlayerKilled(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerKilled pk)
New player killed message received (KIL message).

Parameters:
pk - new player killed message

notifyBotDamaged

public void notifyBotDamaged(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotDamaged bd)
New bot damaged message received (DAM message).

Parameters:
bd - new bot damaged message

detectAgentSpeakingInterruptions

private boolean detectAgentSpeakingInterruptions()
Here we detect other agents interruptions. Other agents may interrupt our actions by speaking to us while we are doing certain action or by speaking to agent that is accompanying us. Here we will check the conditions and set agentInterrupter if it is necessary.

Returns:
true if someone has interrupted us (that doesn't mean our agent will actually switch to interrupted state)

processActionToMe

private void processActionToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat gc)
Some agent did action to me. Find out which one it was, notify emotion model and store it into history.

Parameters:
gc - message containing the action towards us

processActionToOther

private void processActionToOther(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat gc)
Some agent did some action to other agent. We can be jelaus or happy.

Parameters:
gc - message containing the action towards other

processItemRequestToMe

private void processItemRequestToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Process the message and store the corresponding item request to agent internals.

Parameters:
message - message containing the item request

processKillMessage

private void processKillMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerKilled pk)
Player killed message.

Parameters:
pk - player killed message

processPickup

private void processPickup(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ItemPickedUp ipk)
Process pickup messages. Flowers are MiniHealthVials, condoms are AdrenalinePickups for now. :-)

Parameters:
ipk -

processPlayerHistory

private void processPlayerHistory()
Here we will generate events - PlayerDissapearedEvent and PlayerTogetherEvent


processHitMessage

private void processHitMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerDamaged pd)
Process HIT message and generate appropriate emotion event. Currently just looking if we hit the polymorph.

Parameters:
pd - input HIT message

processDamMessage

private void processDamMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotDamaged bd)
Process DAM message and generate appropriate emotion event. Currently just processing polymorph damage event (polymorph bite).

Parameters:
bd - input DAM message

processGotInvMessage

private void processGotInvMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ReceivedInventoryMsg rim)
Process received inventory message (GOT), generates emotional event and store information into agents internals.

Parameters:
rim - input received inventory message

processPlayer

private void processPlayer(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player pl)
Before the playersHistory is updated this allows us to generate appeared events.

Parameters:
pl - other agent

processProposalToMe

private void processProposalToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Here we process proposal sent to our agent. It can be response to our proposal or new proposal from other agent. We will store it in our intenals for future processing.

Parameters:
message - contains the message with proposal to process

processProposalToOther

private void processProposalToOther(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Some proposal or proposal answer was sent to some other agent.

Parameters:
message - message containing the proposal

processTextMessage

private void processTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Here we will determine what kind of a situation this text message corresponds to and call appropriate methods that will process the message further.

Parameters:
message - input text message

processTextMessageToMe

private void processTextMessageToMe(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Here we will process text message adressed to our agent. And generate all emotion events. Also we will update CommunicationInfo object.

Parameters:
message - input text message

processOtherTextMessage

private void processOtherTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Process text message sent by someone to other agent.

Parameters:
message - input text message

processPolymorphTextMessage

private void processPolymorphTextMessage(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GlobalChat message)
Generate fear and disliking or liking depending on the noise the polymorph is making. Then updates the polymorph info so the events are not generated too often.

Parameters:
message - input text message

checkRepeatingEvents

private void checkRepeatingEvents()
Check agent ignore and proposal ignore events and generate them if necessary.


updatePlayerHistory

public void updatePlayerHistory(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player pl)
Called each time we receive some PLR message (from listener). Updates playersHistory information.

Parameters:
pl -