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