cz.cuni.amis.pogamut.ut2004.server.impl
Class UT2004Server

Package class diagram package UT2004Server
java.lang.Object
  extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
      extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractObservingAgent<WORLD_VIEW>
          extended by cz.cuni.amis.pogamut.base.agent.impl.AbstractGhostAgent<WORLD_VIEW,ACT>
              extended by cz.cuni.amis.pogamut.base.server.AbstractWorldServer<WORLD_VIEW,ACT,IUT2004Bot>
                  extended by cz.cuni.amis.pogamut.ut2004.server.impl.AbstractUT2004Server<UT2004WorldView,IAct>
                      extended by cz.cuni.amis.pogamut.ut2004.server.impl.UT2004Server
All Implemented Interfaces:
IAgent, IGhostAgent, IObservingAgent, IComponent, IComponentAware, IControllable, IWorldAgentsObserver<IUT2004Bot>, IWorldServer<IUT2004Bot>, IUnrealServer<IUT2004Bot>, IUT2004Server
Direct Known Subclasses:
UT2004Analyzer

public class UT2004Server
extends AbstractUT2004Server<UT2004WorldView,IAct>
implements IUT2004Server


Nested Class Summary
 class UT2004Server.MapChangeFuture
           
 
Field Summary
protected  boolean changingMap
           
protected  int changingMapAttempt
           
protected  Object changingMapMutex
           
static int MAP_CHANGE_CONNECT_INTERVAL_MILLIS
           
protected  UT2004Server.MapChangeFuture mapChangeFuture
           
protected  IWorldEventListener<MapListObtained> mapListListener
           
static int MAX_CHANGING_MAP_ATTEMPTS
          How many times we're going to try to connect to the GB2004 before declaring that the change-map has failed.
protected  IWorldEventListener<PlayerJoinsGame> playerJoinsListener
           
protected  String targetMap
           
 
Fields inherited from class cz.cuni.amis.pogamut.base.server.AbstractWorldServer
worldAddress
 
Fields inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
events, INTROSPECTION_ROOT_NAME, log, LOG_CATEGORY_NAME
 
Constructor Summary
UT2004Server(UT2004AgentParameters params, IAgentLogger agentLogger, IComponentBus bus, SocketConnection connection, UT2004WorldView worldView, IAct act)
           
 
Method Summary
 void connectNativeBot(String botName, String botType)
           
 UT2004AgentParameters getParams()
          Returns parameters that were passed into the agent during the construction.
protected  void init()
          Hook for users (descendants of this class) to fill-in initialization code, any listeners hooked here should be removed inside reset().
protected  void reset()
          Called during stop/kill/reset events.
 Future<Boolean> setGameMap(String map)
          Method that initiates map-change.
protected  void startAgent()
           
protected  void startPausedAgent()
           
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.server.impl.AbstractUT2004Server
connectNativeBot, createPasswordReply, getAgents, getAvailableMaps, getGameInfo, getGameSpeedFlag, getMap, getMapName, getMutators, getNativeAgents, getPasswordReply, getPlayers, getWorldView, killAgent, readyCommandRequested, resetAgent, setAddress, setPassword, stopAgent
 
Methods inherited from class cz.cuni.amis.pogamut.base.server.AbstractWorldServer
getWorldAddress
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractGhostAgent
getAct
 
Methods inherited from class cz.cuni.amis.pogamut.base.agent.impl.AbstractAgent
addDependency, addDependency, addDependency, addJMXComponents, awaitState, awaitState, componentFatalError, componentStarted, componentStarted, componentStopped, componentStopping, createAgentJMX, createIntrospection, equals, getComponentId, getEventBus, getIntrospection, getJMX, getLog, getLogger, getName, getState, hashCode, inState, kill, notInState, pause, pauseAgent, preKillAgent, preStopAgent, resetEvent, resume, resumeAgent, setState, start, startPaused, stop, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.ut2004.server.IUT2004Server
connectNativeBot, getAvailableMaps, getGameSpeedFlag, getMap, getMapName, getMutators, getNativeAgents, getPlayers, setAddress
 
Methods inherited from interface cz.cuni.amis.pogamut.base.server.IWorldServer
getWorldAddress
 
Methods inherited from interface cz.cuni.amis.pogamut.base.server.IWorldAgentsObserver
getAgents
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IGhostAgent
getAct
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IObservingAgent
getWorldView
 
Methods inherited from interface cz.cuni.amis.pogamut.base.agent.IAgent
getComponentId, getIntrospection, getLogger, getName, getState, kill, pause, resume, start, startPaused, stop
 
Methods inherited from interface cz.cuni.amis.pogamut.base.component.IComponentAware
getEventBus
 

Field Detail

MAX_CHANGING_MAP_ATTEMPTS

public static final int MAX_CHANGING_MAP_ATTEMPTS
How many times we're going to try to connect to the GB2004 before declaring that the change-map has failed.

See Also:
Constant Field Values

MAP_CHANGE_CONNECT_INTERVAL_MILLIS

public static final int MAP_CHANGE_CONNECT_INTERVAL_MILLIS
See Also:
Constant Field Values

playerJoinsListener

protected IWorldEventListener<PlayerJoinsGame> playerJoinsListener

mapListListener

protected IWorldEventListener<MapListObtained> mapListListener

changingMapMutex

protected Object changingMapMutex

changingMap

protected boolean changingMap

changingMapAttempt

protected int changingMapAttempt

targetMap

protected String targetMap

mapChangeFuture

protected UT2004Server.MapChangeFuture mapChangeFuture
Constructor Detail

UT2004Server

@Inject
public UT2004Server(UT2004AgentParameters params,
                           IAgentLogger agentLogger,
                           IComponentBus bus,
                           SocketConnection connection,
                           UT2004WorldView worldView,
                           IAct act)
Method Detail

getParams

public UT2004AgentParameters getParams()
Returns parameters that were passed into the agent during the construction.

This is a great place to parametrize your agent. Note that you may pass arbitrary subclass of UT2004AgentParameters to the constructor/factory/runner and pick them up here.

Returns:
parameters

startAgent

protected void startAgent()
Overrides:
startAgent in class AbstractUT2004Server<UT2004WorldView,IAct>

startPausedAgent

protected void startPausedAgent()
Overrides:
startPausedAgent in class AbstractUT2004Server<UT2004WorldView,IAct>

init

protected void init()
Hook for users (descendants of this class) to fill-in initialization code, any listeners hooked here should be removed inside reset().


reset

protected void reset()
Description copied from class: AbstractUT2004Server
Called during stop/kill/reset events.

Overrides:
reset in class AbstractUT2004Server<UT2004WorldView,IAct>

setGameMap

public Future<Boolean> setGameMap(String map)
                           throws MapChangeException
Description copied from interface: IUT2004Server
Method that initiates map-change. It returns future that describes the result.

Note that the object must restart itself in order to reconnect to the new server.

Specified by:
setGameMap in interface IUnrealServer<IUT2004Bot>
Specified by:
setGameMap in interface IUT2004Server
Throws:
MapChangeException

connectNativeBot

public void connectNativeBot(String botName,
                             String botType)
Specified by:
connectNativeBot in interface IUnrealServer<IUT2004Bot>


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.