View Javadoc

1   package cz.cuni.amis.pogamut.unreal.server;
2   
3   import java.util.Collection;
4   import java.util.List;
5   import java.util.concurrent.Future;
6   
7   import cz.cuni.amis.pogamut.base.agent.IGhostAgent;
8   import cz.cuni.amis.pogamut.base.server.IWorldServer;
9   import cz.cuni.amis.pogamut.unreal.bot.IUnrealBot;
10  import cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IMapList;
11  import cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IMutator;
12  import cz.cuni.amis.pogamut.unreal.communication.messages.gbinfomessages.IPlayer;
13  import cz.cuni.amis.pogamut.unreal.communication.worldview.map.IUnrealMap;
14  import cz.cuni.amis.pogamut.unreal.server.exception.MapChangeException;
15  
16  import cz.cuni.amis.utils.collections.ObservableCollection;
17  import cz.cuni.amis.utils.flag.Flag;
18  import java.io.IOException;
19  
20  public interface IUnrealServer<BOT extends IUnrealBot> extends IWorldServer<BOT>, IGhostAgent {
21      
22  	/**
23  	 * Sets the address of the server to different location - does not automatically reconnect,
24  	 * use {@link IUT2004Server#stop()} and {@link IUT2004Server#start()}.
25  	 * @param address
26  	 */
27  	public void setAddress(String host, int port);
28  	
29      /**
30       * @return List of all maps available on the UT server
31       */
32      public Collection<? extends IMapList> getAvailableMaps();
33    
34  // GameInfo doesn't exist anymore, JSimlo changed it into something else
35  //    public GameInfo getGameInfo();
36      
37      /**
38       * The flag raises events even when the game speed was changed by another 
39       * UTServer instance or directly in game.
40       * @return Speed of the game.
41       */
42      public Flag<Double> getGameSpeedFlag();
43      
44      /** 
45       * @return Name of the current map.
46       */
47      public String getMapName();
48      
49      /**
50       * Method that initiates map-change. It returns future that describes the result.
51       * <p><p>
52       * Note that the object must restart itself in order to reconnect to the new server. 
53       * 
54       * @param map
55       */
56      public Future<Boolean> setGameMap(String map) throws MapChangeException;
57      
58      /**
59       * Returns list of all players connected to the game server. The difference 
60       * compared to the getAgents() method is that this method can return even the
61       * native bots, human players etc. 
62       * @return List of all players on the server.
63       */
64      public ObservableCollection<? extends IPlayer> getPlayers();
65  
66      /**
67       * Returns list of all non pogamut players connected to the game server. Collection
68       * contains NativeBotAdapter classes, this means that you can deal with the
69       * players like with Pogamut agents.
70       * @
71       * @return List of all players on the server.
72       */
73      public ObservableCollection<? extends IUnrealBot> getNativeAgents();
74  
75      /**
76       * Reeturns list of all mutators available on the server. Mutators can be 
77       * used to modify the game (eg. disable weapons, change game speed).
78       * @return List of all mutators available on the server.
79       */
80      public List<? extends IMutator> getMutators();
81  
82      /**
83       * Connects a UT native bot to the current map.
84       * @param botName
85       */
86      public void connectNativeBot(String botName, String botType);
87  
88      /**
89       * Get current map from the server
90       * @return Map of current level.
91       */
92      public IUnrealMap getMap();
93  
94  }