1 package cz.cuni.amis.pogamut.udk.bot;
2
3 import cz.cuni.amis.pogamut.udk.bot.impl.UDKBot;
4 import cz.cuni.amis.pogamut.udk.communication.messages.gbcommands.Initialize;
5 import cz.cuni.amis.pogamut.udk.communication.messages.gbcommands.PasswordReply;
6 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.BotKilled;
7 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.ConfigChange;
8 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.GameInfo;
9 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.InitedMessage;
10 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.Self;
11
12 public interface IUDKBotController<BOT extends UDKBot> {
13
14
15 /**
16 * Called during the construction of the {@link UDKBot} before the GameBots2004 greets the bot even before
17 * {@link IUDKBotController#prepareBot(UDKBot)} method.
18 * <p><p>
19 * <b>NOTE:</b> This is Pogamut's developers reserved method - do not override it and if you do, always use 'super'
20 * to call parent's initializeController.
21 */
22 public void initializeController(BOT bot);
23
24 /**
25 * Called during the construction of the {@link UDKBot} before the GameBots2004 greets the bot.
26 */
27 public void prepareBot(BOT bot);
28
29
30 /**
31 * Returns password that should be used to access the GameBots2004 server.
32 * <p><p>
33 * Called only if the bot is challenged by the password request.
34 *
35 * @return
36 */
37 public PasswordReply getPassword();
38
39 /**
40 * This method is called after handshake with GameBots2004 is over and the GameBots2004
41 * is awaiting the INIT command (Initialize class). Here you have to construct the
42 * Initialize message where you may specify many starting parameters of the bot including:
43 * <ul>
44 * <li>bot's name</li>
45 * <li>bot skill level (aim precision)</li>
46 * <li>bot skin</li>
47 * <li>raycasting</li>
48 * <li>etc. - for complete list see Initialize command</li>
49 * </ul>
50 * This message is then saved to private field initalizeCommand and is accessible
51 * via getInitializeCommand() method if required to probe the starting parameters (even though
52 * they can be changed during the bot's lifetime!).
53 */
54 public Initialize getInitializeCommand();
55
56 /**
57 * This method is called whenever {@link InitedMessage} is received. Various agent modules are usable since this
58 * method is called.
59 *
60 * @param gameInfo
61 * @param config
62 * @param init
63 * @param self
64 */
65 public void botInitialized(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init);
66
67 /**
68 * This method is called only once whenever first batch of information what the bot can see is received.
69 * <i><i>
70 * It is sort of "first-logic-method" where you may issue commands for the first time and handle everything
71 * else in bot's logic then. It eliminates the need to have 'boolean firstLogic' field inside your bot.
72 * <p><p>
73 * Note that this method has advantage over the {@link IUDKBotController#botInitialized(GameInfo, ConfigChange, InitedMessage)}
74 * that you already have {@link Self} object.
75 *
76 * @param gameInfo
77 * @param config
78 * @param init
79 * @param self
80 */
81 public void botSpawned(GameInfo gameInfo, ConfigChange currentConfig, InitedMessage init, Self self);
82
83 /**
84 * Called whenever the bot gets killed inside the game.
85 *
86 * @param event
87 */
88 public void botKilled(BotKilled event);
89
90 /**
91 * Called whenever the bot is shutdown (has finished) or killed (not in the game but as the instance).
92 * <p><p>
93 * Use the method to save your work / data collected during the run of the agent.
94 * <p><p>
95 * Pogamut's guarantee that this method is called even if exception happens inside your previous code.
96 */
97 public void botShutdown();
98
99 }