1 package cz.cuni.amis.pogamut.sposh.context;
2
3 import java.util.Random;
4 import java.util.logging.Level;
5
6 import cz.cuni.amis.pogamut.base.agent.navigation.IPathPlanner;
7 import cz.cuni.amis.pogamut.base.communication.command.IAct;
8 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.AnnotationListenerRegistrator;
9 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.EventListener;
10 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectClassEventListener;
11 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectClassListener;
12 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectEventListener;
13 import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.ObjectListener;
14 import cz.cuni.amis.pogamut.base.utils.logging.LogCategory;
15 import cz.cuni.amis.pogamut.base.utils.math.DistanceUtils;
16 import cz.cuni.amis.pogamut.base3d.worldview.IVisionWorldView;
17 import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated;
18 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.Animations;
19 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.Emoticons;
20 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.Inventory;
21 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.Places;
22 import cz.cuni.amis.pogamut.emohawk.agent.module.sensomotoric.Steering;
23 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.AgentConfig;
24 import cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Raycasting;
25 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentInfo;
26 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.AgentStats;
27 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Game;
28 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Players;
29 import cz.cuni.amis.pogamut.ut2004.agent.module.sensor.Senses;
30 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004AStarPathPlanner;
31 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004GetBackToNavGraph;
32 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004Navigation;
33 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004PathExecutor;
34 import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004RunStraight;
35 import cz.cuni.amis.pogamut.ut2004.agent.navigation.floydwarshall.FloydWarshallMap;
36 import cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator.KefikRunner;
37 import cz.cuni.amis.pogamut.ut2004.agent.navigation.loquenavigator.LoqueNavigator;
38 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004DistanceStuckDetector;
39 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004PositionStuckDetector;
40 import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004TimeStuckDetector;
41 import cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController;
42 import cz.cuni.amis.pogamut.ut2004.bot.command.AdvancedLocomotion;
43 import cz.cuni.amis.pogamut.ut2004.bot.command.Communication;
44 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
45 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController;
46 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController;
47 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.GetPath;
48 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.AutoTraceRay;
49 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled;
50 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange;
51 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo;
52 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage;
53 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
54 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PathList;
55 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
56
57 /**
58 * Primitive State Context for Emohawk.
59 * @author Jimmy
60 */
61 public class EmohawkContext<BOT extends UT2004Bot> extends Context<BOT> implements IUT2004Context<BOT> {
62
63 /**
64 * Random number generator that is usually useful to have during decision making.
65 */
66 protected Random random = new Random(System.currentTimeMillis());
67
68 /**
69 * Alias for user's log.
70 */
71 protected LogCategory log = null;
72
73 /**
74 * Memory module specialized on general info about the game - game type, time limit, frag limit, etc.
75 * <p><p>
76 * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
77 * is called.
78 * <p><p>
79 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
80 */
81 protected Game game;
82
83 /**
84 * Memory module specialized on general info about the agent whereabouts - location, rotation, health, current weapon, who is enemy/friend, etc.
85 * <p><p>
86 * May be used since first {@link Self} message is received, i.e, since the first {@link SposhBotLogic#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
87 * is called.
88 * <p><p>
89 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
90 */
91 protected AgentInfo info;
92
93 /**
94 * Memory module specialized on whereabouts of other players - who is visible, enemy / friend, whether bot can see anybody, etc.
95 * <p><p>
96 * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
97 * is called.
98 * <p><p>
99 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
100 */
101 protected Players players;
102
103 // /**
104 // * Sensory module that provides mapping between {@link ItemType} and {@link ItemDescriptor} providing
105 // * an easy way to obtain item descriptors for various items in UT2004.
106 // * <p><p>
107 // * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
108 // * is called.
109 // * <p><p>
110 // * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
111 // */
112 // protected ItemDescriptors descriptors;
113 //
114 // /**
115 // * Memory module specialized on items on the map - which are visible and which are probably spawned.
116 // * <p><p>
117 // * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
118 // * is called.
119 // * <p><p>
120 // * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
121 // */
122 // protected Items items;
123
124 /**
125 * Memory module specialized on agent's senses - whether the bot has been recently killed, collide with level's geometry, etc.
126 * <p><p>
127 * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
128 * is called.
129 * <p><p>
130 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
131 */
132 protected Senses senses;
133
134 // /**
135 // * Memory module specialized on info about the bot's weapon and ammo inventory - it can tell you which weapons are loaded, melee/ranged, etc.
136 // * <p><p>
137 // * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
138 // * is called.
139 // * <p><p>
140 // * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
141 // */
142 // protected Weaponry weaponry;
143
144 /**
145 * Memory module specialized on the agent's configuration inside UT2004 - name, vision time, manual spawn, cheats (if enabled at GB2004).
146 * <p><p>
147 * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
148 * is called.
149 * <p><p>
150 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
151 */
152 protected AgentConfig config;
153
154 /**
155 * Support for creating rays used for raycasting (see {@link AutoTraceRay} that is being utilized).
156 * <p><p>
157 * May be used since {@link SposhBotLogic#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange, cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage)}
158 * is called.
159 */
160 protected Raycasting raycasting;
161
162 // /**
163 // * Creates and wraps all available commands that can be issued to the virtual body of the bot inside UT2004.
164 // * <p><p>
165 // * May be used since since the first {@link SposhBotLogic#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
166 // * is called.
167 // * <p><p>
168 // * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
169 // */
170 // protected CompleteBotCommandsWrapper body;
171 //
172 // /**
173 // * Shortcut for <i>body.getImprovedShooting()</i> that allows you to shoot at opponent.
174 // * <p><p>
175 // * Note: more weapon-handling methods are available through {@link UT2004Behaviour#weaponry}.
176 // * <p><p>
177 // * May be used since since the first {@link SposhBotLogic#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
178 // * is called.
179 // * <p><p>
180 // * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
181 // */
182 // protected ImprovedShooting shoot;
183
184 /**
185 * Shortcut for <i>body.getAdvancedLocomotion()</i> that allows you to manually steer the movement through the environment.
186 * <p><p>
187 * Note: navigation is done via {@link UT2004Behaviour#pathExecutor} that needs {@link PathHandle} from the {@link UT2004Behaviour#pathPlanner}.
188 * <p><p>
189 * May be used since since the first {@link SposhBotLogic#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
190 * is called.
191 * <p><p>
192 * Initialized inside {@link UT2004Behaviour#initializeModules(UT2004Bot)}.
193 */
194 protected AdvancedLocomotion move;
195
196 /**
197 * Allows you to speak!
198 */
199 protected Communication comm;
200
201 /**
202 * Executor is used for following a path in the environment.
203 * <p><p>
204 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
205 * is called.
206 * <p><p>
207 * Initialized inside {@link UT2004BotModuleControllerNew#initializePathFinding(UT2004Bot)}.
208 */
209 protected UT2004PathExecutor<ILocated> pathExecutor = null;
210
211 /**
212 * Planner used to compute the path (consisting of navigation points) inside the map.
213 * <p><p>
214 * May be used since since the first {@link IUT2004BotController#botFirstSpawn(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)}
215 * is called.
216 * <p><p>
217 * Initialized inside {@link UT2004BotModuleControllerNew#initializePathFinding(UT2004Bot)}.
218 */
219 protected IPathPlanner<ILocated> pathPlanner = null;
220
221 // /**
222 // * Weapon preferences for your bot. See {@link WeaponPrefs} class javadoc. It allows you to define preferences for
223 // * weapons to be used at given distance (together with their firing mode).
224 // */
225 // protected WeaponPrefs weaponPrefs;
226
227 // /**
228 // * Navigation graph builder that may be used to manually extend the navigation graph of the UT2004.
229 // * <p><p>
230 // * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)}
231 // * is called.
232 // * <p><p>
233 // * Initialized inside {@link UT2004BotModuleController#initializeModules(UT2004Bot)}.
234 // */
235 // protected NavigationGraphBuilder navBuilder;
236
237 /**
238 * Module that is providing various statistics about the bot. You may also used it to output these stats (in CSV format)
239 * into some file using {@link AgentStats#startOutput(String)} or {@link AgentStats#startOutput(String, boolean)}.
240 */
241 protected AgentStats stats;
242
243 /**
244 * Path-planner ({@link IPathPlanner} using {@link NavPoint}s), you may use it to find paths inside the environment wihtout
245 * waiting for round-trip of {@link GetPath} command and {@link PathList}s response from UT2004. It is much faster than
246 * {@link UT2004BotModuleController#pathPlanner} but you need to pass {@link NavPoint} instances to planner instead of
247 * {@link ILocated} ... to find the nearest {@link NavPoint} instance, {@link DistanceUtils} is a handy, check especially
248 * {@link DistanceUtils#getNearest(java.util.Collection, ILocated)}.
249 */
250 protected FloydWarshallMap fwMap;
251
252 /**
253 * Command module that is internally using {@link UT2004PathExecutor} for path-following and {@link FloydWarshallMap}
254 * for path planning resulting in unified class that can solely handle navigation of the bot within the environment.
255 * <p><p>
256 * In contrast to {@link UT2004PathExecutor} methods
257 * of this module may be recalled every {@link UT2004BotModuleController#logic()} iteration even with
258 * the same argument (which is not true for {@link UT2004PathExecutor#followPath(cz.cuni.amis.pogamut.base.agent.navigation.IPathFuture)}.
259 * <p><p>
260 * Note that this class is actually initialized with instances of {@link UT2004BotModuleController#pathExecutor} and {@link UT2004BotModuleController#fwMap}
261 * so you must take care if using add/remove stuck detectors or reinitilize this property to your liking (you can do that in {@link UT2004BotModuleController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)}
262 * method.
263 * <p><p>
264 * May be used since first {@link UT2004BotModuleController#logic()} is called.
265 * <p><p>
266 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}.
267 */
268 protected UT2004Navigation navigation;
269
270 /**
271 * Listener registrator that probes declared methods for the presence of {@link EventListener}, {@link ObjectClassEventListener},
272 * {@link ObjectClassListener}, {@link ObjectEventListener} and {@link ObjectListener} annotations and automatically registers
273 * them as listeners on a specific events.
274 * <p><p>
275 * Note that this registrator is usable for 'this' object only! It will work only for 'this' object.
276 */
277 protected AnnotationListenerRegistrator listenerRegistrator;
278
279 /**
280 * Shortcut for the {@link UT2004BotModuleController#getWorldView()}.
281 */
282 protected IVisionWorldView world;
283
284 /**
285 * Shortcut for the {@link UT2004BotModuleController#getAct()}.
286 */
287 protected IAct act;
288
289 /**
290 * Navigation helper that is able to get your bot back to the nearest navigation graph so you can use {@link UT2004BotModuleController#navigation}
291 * without fear of catastrophe.
292 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)}
293 * is called.
294 * <p><p>
295 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}.
296 */
297 protected UT2004GetBackToNavGraph getBackToNavGraph;
298
299 /**
300 * Navigation helper that can run-straight to some point with stuck detectors.
301 * <p><p>
302 * May be used since {@link IUT2004BotController#botInitialized(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage)}
303 * is called.
304 * <p><p>
305 * Initialized inside {@link UT2004BotModuleController#initializePathFinding(UT2004Bot)}.
306 */
307 protected UT2004RunStraight runStraight;
308
309 /**
310 * Module for handling animations.
311 */
312 protected Animations animations;
313
314 /**
315 * Module for handling emoticons.
316 */
317 protected Emoticons emoticons;
318
319 /**
320 * High-level description of the map.
321 */
322 protected Places places;
323
324 /**
325 * High-level access to steering library.
326 */
327 protected Steering steering;
328
329 /**
330 * High-level access to inventory and items.
331 */
332 protected Inventory inventory;
333
334 public EmohawkContext(String name, BOT bot) {
335 super(name, bot);
336 log = bot.getLogger().getCategory(UT2004BotController.USER_LOG_CATEGORY_ID);
337 log.setLevel(Level.ALL);
338 }
339
340 /**
341 * Called after the construction of the {@link UT2004Behaviour} before the GameBots2004 greets the bot even before
342 * {@link UT2004Behaviour#prepareBehaviour(UT2004Bot)} method.
343 * <p><p>
344 * <b>NOTE:</b> This is Pogamut's developers reserved method - do not override it and if you do, always use 'super'
345 * to call parent's initializeBehaviour.
346 */
347 protected void initialize() {
348 initializeModules(bot);
349 initializePathFinding(bot);
350 initializeListeners(bot);
351 }
352
353 /**
354 * Initializes {@link UT2004Behaviour#listenerRegistrator} and calls {@link AnnotationListenerRegistrator#addListeners()} method
355 * to probe all declared methods for event-annotation presence.
356 * @param bot
357 */
358 protected void initializeListeners(BOT bot) {
359 listenerRegistrator = new AnnotationListenerRegistrator(this, getWorldView(), bot.getLogger().getCategory("Listeners"));
360 listenerRegistrator.addListeners();
361 }
362
363 /**
364 * Initializes path-finding modules: {@link UT2004BotModuleControllerNew#pathPlanner} and {@link UT2004BotModuleControllerNew#pathExecutor}.
365 * If you need different path planner / path executor - override this method and initialize your own modules.
366 * @param bot
367 */
368 protected void initializePathFinding(BOT bot) {
369 pathPlanner = new UT2004AStarPathPlanner(bot);
370 fwMap = new FloydWarshallMap(bot);
371 pathExecutor =
372 new UT2004PathExecutor<ILocated>(
373 bot,
374 new LoqueNavigator<ILocated>(bot,
375 bot.getLog())
376 );
377
378 // add stuck detectors that watch over the path-following, if it (heuristicly) finds out that the bot has stuck somewhere,
379 // it reports an appropriate path event and the path executor will stop following the path which in turn allows
380 // us to issue another follow-path command in the right time
381 pathExecutor.addStuckDetector(new UT2004TimeStuckDetector(bot, 3000, 100000)); // if the bot does not move for 3 seconds, considered that it is stuck
382 pathExecutor.addStuckDetector(new UT2004PositionStuckDetector(bot)); // watch over the position history of the bot, if the bot does not move sufficiently enough, consider that it is stuck
383 pathExecutor.addStuckDetector(new UT2004DistanceStuckDetector(bot)); // watch over distances to target
384
385 getBackToNavGraph = new UT2004GetBackToNavGraph(bot, info, move);
386 runStraight = new UT2004RunStraight(bot, info, move);
387 navigation = new UT2004Navigation(bot, pathExecutor, fwMap, getBackToNavGraph, runStraight);
388 }
389
390 /**
391 * Initializes memory/command modules of the bot.
392 *
393 * @param bot
394 */
395 protected void initializeModules(BOT bot) {
396 world = bot.getWorldView();
397 act = bot.getAct();
398 game = new Game(bot);
399 info = new AgentInfo(bot, game);
400 players = new Players(bot);
401 // descriptors = new ItemDescriptors(bot);
402 // weaponry = new Weaponry(bot, descriptors);
403 // items = new Items(bot, info, game, weaponry, null);
404 senses = new Senses(bot, info, players);
405 config = new AgentConfig(bot);
406 raycasting = new Raycasting(bot);
407 // shoot = body.getImprovedShooting();
408 move = new AdvancedLocomotion(getBot(), getBot().getLogger().getCategory("Move"));
409 comm = new Communication(getBot(), getBot().getLogger().getCategory("Communicaton"));
410 // navBuilder = new NavigationGraphBuilder(bot);
411 stats = new AgentStats(bot);
412 animations = new Animations(bot);
413 emoticons = new Emoticons(bot);
414 places = new Places(bot);
415 steering = new Steering(bot);
416 inventory = new Inventory(bot);
417 // weaponPrefs = new WeaponPrefs(weaponry, bot);
418 }
419
420 /**
421 * Called after the behaviour construction to initialize user's data structures.
422 * @param bot
423 */
424 protected void prepareBehaviour(BOT bot) {
425 }
426
427 /**
428 * This method is called whenever {@link InitedMessage} is received. Various agent modules are usable since this
429 * method is called.
430 *
431 * @param gameInfo
432 * @param config
433 * @param init
434 * @param self
435 */
436 public void botInitialized(GameInfo info, ConfigChange config, InitedMessage init) {
437 }
438
439 /**
440 * This method is called only once whenever first batch of information what the bot can see is received.
441 * <i><i>
442 * It is sort of "first-logic-method" where you may issue commands for the first time and handle everything
443 * else in bot's logic then. It eliminates the need to have 'boolean firstLogic' field inside your bot.
444 * <p><p>
445 * Note that this method has advantage over the {@link IUT2004BotController#botInitialized(GameInfo, ConfigChange, InitedMessage)}
446 * that you already have {@link Self} object.
447 *
448 * @param gameInfo
449 * @param config
450 * @param init
451 * @param self
452 */
453 public void botSpawned(GameInfo gameInfo, ConfigChange config, InitedMessage init, Self self) {
454 }
455
456 /**
457 * Called after {@link UT2004Behaviour#botFirstSpawn(GameInfo, ConfigChange, InitedMessage, Self)} as a hook for Pogamut's core developers
458 * to finalize initialization of various modules.
459 * <p><p>
460 * <b>NOTE:</b> This is Pogamut's developers reserved method - do not override it and if you do, always use 'super'
461 * to call parent's finishControllerInitialization.
462 */
463 public void finishInitialization() {
464 // if (navBuilder.isUsed()) {
465 // log.info("Navigation graph has been altered by 'navBuilder', triggering recomputation of Floyd-Warshall path matrix...");
466 // Level oldLevel = fwMap.getLog().getLevel();
467 // fwMap.getLog().setLevel(Level.FINER);
468 // fwMap.refreshPathMatrix();
469 // fwMap.getLog().setLevel(oldLevel);
470 // }
471 }
472
473 /**
474 * This method is called before the SPOSH iteration is invoked. You may clear previous-state variables here.
475 */
476 public void logicIteration() {
477 }
478
479 /**
480 * Called whenever the bot gets killed inside the game.
481 *
482 * @param event
483 */
484 public void botKilled(BotKilled event) {
485 }
486
487 public IVisionWorldView getWorldView() {
488 return bot.getWorldView();
489 }
490
491 public IAct getAct() {
492 return bot.getAct();
493 }
494
495 public Random getRandom() {
496 return random;
497 }
498
499 public LogCategory getLog() {
500 return log;
501 }
502
503 public Game getGame() {
504 return game;
505 }
506
507 public AgentInfo getInfo() {
508 return info;
509 }
510
511 public Players getPlayers() {
512 return players;
513 }
514
515 public Senses getSenses() {
516 return senses;
517 }
518
519 public AgentConfig getConfig() {
520 return config;
521 }
522
523 public Raycasting getRaycasting() {
524 return raycasting;
525 }
526
527 public AdvancedLocomotion getMove() {
528 return move;
529 }
530
531 public UT2004PathExecutor<ILocated> getPathExecutor() {
532 return pathExecutor;
533 }
534
535 public IPathPlanner<ILocated> getPathPlanner() {
536 return pathPlanner;
537 }
538
539 public AgentStats getStats() {
540 return stats;
541 }
542
543 public FloydWarshallMap getFwMap() {
544 return fwMap;
545 }
546
547 public UT2004Navigation getNavigation() {
548 return navigation;
549 }
550
551 public AnnotationListenerRegistrator getListenerRegistrator() {
552 return listenerRegistrator;
553 }
554
555 public IVisionWorldView getWorld() {
556 return world;
557 }
558
559 public UT2004GetBackToNavGraph getBackToNavGraph() {
560 return getBackToNavGraph;
561 }
562
563 public Communication getComm() {
564 return comm;
565 }
566
567 public UT2004GetBackToNavGraph getGetBackToNavGraph() {
568 return getBackToNavGraph;
569 }
570
571 public UT2004RunStraight getRunStraight() {
572 return runStraight;
573 }
574
575 public Animations getAnimations() {
576 return animations;
577 }
578
579 public Emoticons getEmoticons() {
580 return emoticons;
581 }
582
583 public Places getPlaces() {
584 return places;
585 }
586
587 public Steering getSteering() {
588 return steering;
589 }
590
591 public Inventory getInventory() {
592 return inventory;
593 }
594
595 }