public class BotWithParams
extends cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController
There are two things you have to do:
UT2004BotParameters, in the example implementation that is done by implementation CustomBotParametersUT2004BotRunner.startAgents(UT2004BotParameters...), that is carried out inside main(String[])UT2004Bot class and they will become available through
UT2004Bot.getParams(). Notice, that you will need to cast these params to your class in order to use them.
For that we're recommend to create custom method inside your bot controller class that will do that for you.
Note that the implementation of this class is minimalistic, in order to show only methods that are needed. For the sake of simplicity, the bot's behavior is stupid one ... it will either jump, or rotate or both (depending on the parameters obtained from
act, body, combo, config, ctf, descriptors, fwMap, game, getBackToNavGraph, info, items, listenerRegistrator, move, navBuilder, navigation, pathExecutor, pathPlanner, players, random, raycasting, runStraight, senses, shoot, stats, visibility, weaponPrefs, weaponry, world| Constructor and Description |
|---|
BotWithParams() |
| Modifier and Type | Method and Description |
|---|---|
cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize |
getInitializeCommand()
Here we can modify initializing command for our bot, e.g., sets its name, skin, skill level according to
getParams(), i.e.,
CustomBotParameters.getName(), CustomBotParameters.getBotSkin() and CustomBotParameters.getSkillLevel(). |
CustomBotParameters |
getParams()
This method returns the parameters of the bot, to be used.
|
void |
logic()
Inside logic we're implementing jumping / turning behavior as instructed by
getParams(), i.e., CustomBotParameters.isJumping()
and CustomBotParameters.isRotating(). |
static void |
main(String[] args)
This method is called when the bot is started either from IDE or from command line.
|
finishControllerInitialization, getBody, getCombo, getConfig, getDescriptors, getFwMap, getGame, getInfo, getItems, getMove, getNavBuilder, getNavigation, getPathExecutor, getPathPlanner, getPlayers, getRandom, getRaycasting, getSenses, getShoot, getStats, getVisibility, getWeaponPrefs, getWeaponry, getWorld, initializeController, initializeListeners, initializeModules, initializePathFindingbeforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logicInitialize, logicShutdownbotFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getLog, getPassword, getWorldView, prepareBotpublic CustomBotParameters getParams()
UT2004Bot.getParams() and casts them
to CustomBotParameters that is, this bot can't be used with different parameters (it will screw up).public cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize getInitializeCommand()
getParams(), i.e.,
CustomBotParameters.getName(), CustomBotParameters.getBotSkin() and CustomBotParameters.getSkillLevel().getInitializeCommand in interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotControllergetInitializeCommand in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotControllerInitializepublic void logic()
throws cz.cuni.amis.utils.exception.PogamutException
getParams(), i.e., CustomBotParameters.isJumping()
and CustomBotParameters.isRotating().logic in interface cz.cuni.amis.pogamut.base.agent.module.IAgentLogiclogic in class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicControllercz.cuni.amis.utils.exception.PogamutExceptionpublic static void main(String[] args) throws cz.cuni.amis.utils.exception.PogamutException
Notice the usage of UT2004BotRunner.startAgents(UT2004BotParameters...) that is using
CustomBotParameters. Such method will start 4 bots with all combination of jumping/rotating behavior.
args - cz.cuni.amis.utils.exception.PogamutExceptionCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.