public class UT2004Bot<WORLD_VIEW extends IVisionWorldView,ACT extends IAct,CONTROLLER extends IUT2004BotController> extends AbstractAgent3D<WORLD_VIEW,ACT> implements IUT2004Bot
TODO: [comment me!]
IUT2004Bot.BoolBotParam
Modifier and Type | Field and Description |
---|---|
protected Thread |
botDisconnectorThread
Disconnector thread serves as a last resort for shutting down the bot inside GB2004 in case of JVM failures.
|
events, INTROSPECTION_ROOT_NAME, log, LOG_CATEGORY_NAME
Constructor and Description |
---|
UT2004Bot(UT2004BotParameters parameters,
IComponentBus eventBus,
IAgentLogger logger,
IWorldView worldView,
IAct act,
IUT2004BotController init) |
Modifier and Type | Method and Description |
---|---|
protected void |
addBotDisconnector()
Initializes & registers
botDisconnectorThread as a Runtime.addShutdownHook(Thread) . |
protected AgentJMXComponents |
createAgentJMX() |
protected cz.cuni.amis.introspection.Folder |
createIntrospection() |
boolean |
getBoolConfigure(IUT2004Bot.BoolBotParam param)
Get configuration parameter value.
|
CONTROLLER |
getController()
Returns the bot controller passed inside
UT2004Bot#AbstractUT2004Bot(IAgentId, IComponentBus, IAgentLogger, IVisionWorldView, IAct, IUT2004BotInitialization) . |
Location |
getLocation() |
UT2004BotParameters |
getParams()
Returns parameters that were passed into the agent during the construction.
|
Rotation |
getRotation() |
Self |
getSelf()
Return's bot's
Self object. |
Velocity |
getVelocity() |
WORLD_VIEW |
getWorldView() |
protected void |
initCommandRequested()
This method is called whenever handshake with GameBots2004 is over - the GameBots2004 is awaiting
the bot to reply with Ready command to begin the handshake.
|
protected void |
killAgent() |
protected void |
preKillAgent() |
protected void |
preStopAgent() |
protected void |
readyCommandRequested()
This method is called whenever HelloBot message is parsed - the GameBots2004 is awaiting
the bot to reply with Ready command to begin the handshake.
|
protected void |
removeBotDisconnector()
Removes
botDisconnectorThread as a Runtime.removeShutdownHook(Thread) and nullify the field. |
void |
respawn() |
void |
setBoolConfigure(IUT2004Bot.BoolBotParam param,
boolean value)
Configures bot property.
|
protected void |
startAgent() |
protected void |
startPausedAgent() |
protected void |
stopAgent() |
protected void |
tryDisconnect()
Sends
DisconnectBot commands to GB2004, eats up all exceptions. |
getAct
addDependency, addDependency, addDependency, addJMXComponents, awaitState, awaitState, componentFatalError, componentStarted, componentStarted, componentStopped, componentStopping, equals, getComponentId, getEventBus, getIntrospection, getJMX, getLog, getLogger, getName, getState, hashCode, inState, kill, notInState, pause, pauseAgent, resetAgent, resetEvent, resume, resumeAgent, setState, start, startPaused, stop, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAct
getComponentId, getIntrospection, getLogger, getName, getState, kill, pause, resume, start, startPaused, stop
getEventBus
protected Thread botDisconnectorThread
@Inject public UT2004Bot(UT2004BotParameters parameters, IComponentBus eventBus, IAgentLogger logger, IWorldView worldView, IAct act, IUT2004BotController init)
agentId
- eventBus
- logger
- worldView
- due to Guice nature, this can't be templated with WORLD_VIEW - Guice can't use it as a key for the injectionact
- due to Guice nature, this can't be templated with ACT - Guice can't use it as a key for the injectioninit
- due to Guice nature, this can't be templated with CONTROLLER - Guice can't use it as a key for the injectionpublic CONTROLLER getController()
UT2004Bot#AbstractUT2004Bot(IAgentId, IComponentBus, IAgentLogger, IVisionWorldView, IAct, IUT2004BotInitialization)
.public UT2004BotParameters getParams()
This is a great place to parametrize your agent. Note that you may pass arbitrary subclass of UT2004BotParameters
to the constructor/factory/runner and pick them up here.
protected void startAgent()
startAgent
in class AbstractAgent
protected void startPausedAgent()
startPausedAgent
in class AbstractAgent
protected void preStopAgent()
preStopAgent
in class AbstractAgent
protected void stopAgent()
stopAgent
in class AbstractAgent
protected void preKillAgent()
preKillAgent
in class AbstractAgent
protected void killAgent()
killAgent
in class AbstractAgent
protected void tryDisconnect()
DisconnectBot
commands to GB2004, eats up all exceptions.protected void addBotDisconnector()
botDisconnectorThread
as a Runtime.addShutdownHook(Thread)
.protected void removeBotDisconnector()
botDisconnectorThread
as a Runtime.removeShutdownHook(Thread)
and nullify the field.protected void readyCommandRequested()
protected void initCommandRequested()
Left as protected if you need to override it - but you probably wouldn't.
public Self getSelf()
Self
object.
WARNING: this returns NULL until the first sync-batch is sent by GB2004 (first logic() called).public Location getLocation()
getLocation
in interface ILocated
public Rotation getRotation()
getRotation
in interface IRotable
public Velocity getVelocity()
getVelocity
in interface ILocomotive
public void respawn() throws cz.cuni.amis.utils.exception.PogamutException
respawn
in interface IUnrealBot
cz.cuni.amis.utils.exception.PogamutException
protected AgentJMXComponents createAgentJMX()
createAgentJMX
in class AbstractAgent3D<WORLD_VIEW extends IVisionWorldView,ACT extends IAct>
public void setBoolConfigure(IUT2004Bot.BoolBotParam param, boolean value)
IUT2004Bot
setBoolConfigure
in interface IUT2004Bot
public boolean getBoolConfigure(IUT2004Bot.BoolBotParam param)
IUT2004Bot
getBoolConfigure
in interface IUT2004Bot
protected cz.cuni.amis.introspection.Folder createIntrospection()
createIntrospection
in class AbstractAgent
public WORLD_VIEW getWorldView()
getWorldView
in interface IObservingAgent
getWorldView
in class AbstractObservingAgent<WORLD_VIEW extends IVisionWorldView>
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.