|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.isi.gamebots.client.Bot | +--edu.isi.gamebots.examples.ExampleBot
This example implementation the Bot class shows basic message handling, Bot
control, and and uses UTMapUI
for a map in its user interface.
Nested Class Summary | |
protected class |
ExampleBot.Node
|
protected class |
ExampleBot.NodeMap
|
protected class |
ExampleBot.Path
|
Nested classes inherited from class edu.isi.gamebots.client.GamebotsConstants |
GamebotsConstants.TeamColorMap |
Field Summary | |
protected int |
ammo
|
protected int |
armor
|
protected boolean |
didInit
|
protected int |
direction
|
protected Set |
exploredNodes
|
protected static int |
EXPLORING
|
protected static int |
HEALING
|
protected int |
health
|
protected Vector3D |
here
|
protected static int |
HUNTING
|
protected Map |
idToNode
|
protected boolean |
interfered
|
protected static int |
INTERFERENCE_BUMP
|
protected static int |
INTERFERENCE_DAMAGE
|
protected static int |
INTERFERENCE_WALL
|
protected long |
interferenceTime
|
protected int |
interferenceType
|
protected Collection |
knownNodes
|
protected long |
lastRotIncTime
|
protected ExampleBot.Node |
lastTarget
|
protected static int |
LEFT
|
protected boolean |
logIntents
|
protected boolean |
logMessages
|
protected boolean |
logSelf
|
protected ExampleBot.NodeMap |
map
|
protected static int |
MAX_OUTPUT
|
protected Object |
nodeInfoLock
|
protected static int |
NONE
|
protected static Comparator |
pathComparator
Compares Paths based on theta. |
protected double |
pitch
|
protected static double |
PLAYER_RADIUS
|
protected Random |
random
|
protected Set |
reachableNodes
|
protected static int |
RIGHT
|
protected double |
roll
|
protected Runnable |
runner
|
protected Thread |
runnerThread
|
protected Object |
selfLock
This lock is used to synchronized reads from/writes to the various state variables. |
protected int |
state
|
protected long |
stateChangeTime
|
protected Object |
stateLock
|
protected ExampleBot.Node |
target
|
protected long |
targetAcquiredTime
|
protected long |
targetLostTime
|
protected int |
team
|
protected static double |
THETA_DELTA
|
protected Set |
visibleNodes
|
protected String |
weapon
|
protected double |
x
|
protected double |
y
|
protected double |
yaw
|
protected double |
yawTarget
|
protected double |
z
|
Fields inherited from class edu.isi.gamebots.client.Bot |
client, clientListener, eventProcessor, log |
Fields inherited from interface edu.isi.gamebots.client.GamebotsConstants |
ACTOR_CLASS, ACTOR_ID, ACTOR_REACHABLE, ARG_ALT, ARG_AMOUNT, ARG_GLOBAL, ARG_TARGET, ARG_TEXT, ARG_WALK, BEG, BUMP, CHANGEWEAPON, CHECKREACH, DAMAGE, DEATH_DAMAGE_TYPE, DEATH_KILLER, DEFAULT_BOT_PORT, DEFAULT_VIZ_PORT, DIE, DOM, DOMPOINTS, END, FALSE, FINISHED, GAMESTATE, GETPATH, INFO, INIT, INV, ITEM, ITEM_ID, JUMP, KILL, LOCATION, MESSAGE, MOV, NAV, NODE_DOMINATION, NODE_INVENTORY, NODE_MOVER, NODE_NAVIGATION, OWNER, PATH, PING, PLAYER, PLAYER_AMMO, PLAYER_ARMOR, PLAYER_HEALTH, PLAYER_NAME, PLAYER_TEAM, PLAYER_WEAPON, PONG, ROTATE, ROTATION, RUNTO, SEE, SELF, SETWALK, SHOOT, STOP, STOP_SHOOT, STRAFE, TEAM_ANY, TEAM_BLUE, TEAM_GOLD, TEAM_GREEN, TEAM_NONE, TEAM_RED, TRUE, TURNTO, VELOCITY, WALL, WEAPON_1, WEAPON_2 |
Constructor Summary | |
ExampleBot()
|
Method Summary | |
protected void |
connected()
Bot implementations override this to specify what to do (if anything) after the bot established a server connection. |
protected void |
disconnected()
Event handling. |
protected void |
explore()
|
protected void |
findNewTarget()
|
JComponent |
getView()
Returns a user interface for the bot. |
protected void |
heal()
|
protected void |
hunt()
|
protected void |
incRotation()
|
protected void |
jitter()
|
protected void |
receivedAsyncMessage(Message message)
Bot implementations must override this method. |
protected void |
receivedSyncMessage(MessageBlock block)
Bot implementations must override this method. |
protected void |
updateSelf(Message message)
|
Methods inherited from class edu.isi.gamebots.client.Bot |
changeWeapon, checkReach, checkReach, connect, destroy, destroyImpl, disconnect, getClient, getInitialTeam, getLog, getName, getPath, init, init, jump, parseVector, receivedError, rotate, runTo, runTo, say, setName, setWalk, shoot, shoot, shoot, stop, stopShoot, strafe, turnTo, turnToLoc, turnToLoc |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int MAX_OUTPUT
protected static final double PLAYER_RADIUS
protected static final double THETA_DELTA
protected static final int NONE
protected static final int EXPLORING
protected static final int HEALING
protected static final int HUNTING
protected static final int INTERFERENCE_BUMP
protected static final int INTERFERENCE_WALL
protected static final int INTERFERENCE_DAMAGE
protected static final int LEFT
protected static final int RIGHT
protected static final Comparator pathComparator
protected ExampleBot.NodeMap map
protected Random random
protected Thread runnerThread
protected boolean logIntents
protected boolean logMessages
protected boolean logSelf
protected boolean didInit
protected Object stateLock
protected long stateChangeTime
protected int state
protected int direction
protected final Object selfLock
protected double x
protected double y
protected double z
protected double yaw
protected double pitch
protected double roll
protected int health
protected int armor
protected int ammo
protected int team
protected String weapon
protected Vector3D here
protected boolean interfered
protected long interferenceTime
protected int interferenceType
protected long lastRotIncTime
protected double yawTarget
protected Object nodeInfoLock
protected Map idToNode
protected Collection knownNodes
protected Set exploredNodes
protected Set visibleNodes
protected Set reachableNodes
protected ExampleBot.Node target
protected ExampleBot.Node lastTarget
protected long targetAcquiredTime
protected long targetLostTime
protected Runnable runner
Constructor Detail |
public ExampleBot()
Method Detail |
public JComponent getView()
Bot
Returns a user interface for the bot. This is needed if you want to use the BotRunnerApp to start and view the status of your bots. The JComponent that this returns is what gets added to a new tab in the interface.
getView
in class Bot
protected void connected()
Bot
Bot implementations override this to specify what to do (if anything) after the bot established a server connection.
connected
in class Bot
protected void receivedAsyncMessage(Message message)
Bot
Bot implementations must override this method. This specifies what to do when an asynchronous message is recieved. A description of the difference between sync and async messages can be found at http://www.planetunreal.com/gamebots/docapi.html. Although this is not nessesarily a complete reference, it is a good general intro.
receivedAsyncMessage
in class Bot
message
- The Message
object to handleprotected void receivedSyncMessage(MessageBlock block)
Bot
Bot implementations must override this method. This specifies what to do when an synchronous message is recieved. A description of the difference between sync and async messages can be found at http://www.planetunreal.com/gamebots/docapi.html. Although this is not nessesarily a complete reference, it is a good general intro.
receivedSyncMessage
in class Bot
block
- The synchronous MessageBlock
to handleprotected void disconnected()
Bot
Event handling. Bot implementation overrides this to tell what to do when disconnected from the server.
disconnected
in class Bot
protected void updateSelf(Message message)
protected void explore()
protected void heal()
protected void hunt()
protected void findNewTarget()
protected void incRotation()
protected void jitter()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |