View Javadoc

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