Research Article

Enhancing a Commercial Game Engine to Support Research on Route Realism for Synthetic Human Characters

Algorithm 3

MonitoedPlayer class listing.
/**
* New Pogamut Class for Monitoring Player Parameters during game play
* Class to Create MonitoredPlayer Instance and tie to GB2004 Messages
* @author fabien tence initial code
* @author gregg Hanold extended for player and A-star
*/
public class MonitoredPlayer extends Agent {
 private String unrealID;
 public MonitoredPlayer(String unrealID) {
  this.unrealID unrealID; //needed in initBody can't call super
  Agent.instancesAlive ;
  // init of compounds
  initLogging();
  initBody(); // preceeds memory, memory needs to register listener in body
  initMemory();
  initGameMap(); // must be called as the last item !
  // uses reference to the memory, body ( For A* search must know
  //where the agent is)
  this.body.addTypedRcvMsgListener(this,
   MessageType.MAP_FINISHED); }
 @Override
 protected GameBotConnection initGBConnection(URI gameBots)
  throws UnknownHostException {
  return new MonitoringConnection(gameBots.getHost(),
  gameBots.getPort() ? 3003: gameBots.getPort()); }
 @Override
 protected void initBody() {
  this.body new MonitoredPlayerBody(platformLog, unrealID);
  this.body.addRcvMsgListener(this); //GB20004 Messaging
  this.body.exceptionOccured.addListener(
   new FlagListener<Boolean>() {
    public void flagChanged(Boolean changedValue,
     int listenerParam) {
    if (changedValue) {
     platformLog.severe("Exception occured, stopping agent.");
     exceptionOccured true; }}} );
} }