Difference between revisions of "Programming robots"
(→ScoringEvent constants) |
|||
Line 2: | Line 2: | ||
Robot coding is still fluid, and everything is subject to change, but here is a list of commands being implemented for the next alpha release (see forums for the URL): | Robot coding is still fluid, and everything is subject to change, but here is a list of commands being implemented for the next alpha release (see forums for the URL): | ||
+ | |||
+ | |||
+ | How to read the function notation: | ||
+ | |||
+ | returnType <b>funtionName( argType1, argType2 )</b> - Description of function<br> | ||
+ | |||
+ | |||
+ | Return types: | ||
+ | Unlike most languages, Lua does not differentiate between integers and floating point numbers. Instead, everything is simply a number. | ||
+ | |||
+ | |||
+ | Points to remember in Lua: | ||
+ | <ul> | ||
+ | <li>Lua arrays are 1-based: the first index is 1 rather than 0 as is the case in most programming languages</li> | ||
+ | </ul> | ||
Line 8: | Line 23: | ||
<b>getZoneCenterXY( x, y )</b> - Return point representing center of zone containing point x,y<br> | <b>getZoneCenterXY( x, y )</b> - Return point representing center of zone containing point x,y<br> | ||
<b>getGatewayFromZoneToZone( a, b )</b> - Return point representing fastest way from zone a to zone b. If zones a & b are not neighbors, returns nil<br> | <b>getGatewayFromZoneToZone( a, b )</b> - Return point representing fastest way from zone a to zone b. If zones a & b are not neighbors, returns nil<br> | ||
− | <b>getZoneCount()</b> - Return number of zones | + | number <b>getZoneCount()</b> - Return number of zones<br> |
− | <b>getCurrentZone()</b> - Return current zone that robot is in | + | number <b>getCurrentZone()</b> - Return current zone that robot is in<br> |
<br> | <br> | ||
− | <b>getAngle()</b> - Return angle robot is currently facing | + | number <b>getAngle()</b> - Return angle robot is currently facing<br> |
− | <b>getPosXY()</b> - Return x, y of robot | + | Point <b>getPosXY()</b> - Return x, y of robot<br> |
<br> | <br> | ||
− | <b>setAngle( ang )</b> - Point robot at angle | + | void <b>setAngle( ang )</b> - Point robot at angle<br> |
− | <b>setAngleXY( x, y )</b> - Point robot towards point x,y | + | void <b>setAngleXY( x, y )</b> - Point robot towards point x,y<br> |
− | <b>getAngleXY( x, y )</b> - Compute angle to point x, y | + | number <b>getAngleXY( x, y )</b> - Compute angle to point x, y<br> |
− | <b>hasLosXY( x, y )</b> - Return whether or not robot can see point x, y | + | boolean <b>hasLosXY( x, y )</b> - Return whether or not robot can see point x, y<br> |
<br> | <br> | ||
<b>hasFlag()</b> - Return whether or not robot currently has the flag<br> | <b>hasFlag()</b> - Return whether or not robot currently has the flag<br> | ||
<br> | <br> | ||
<br> | <br> | ||
− | <b>getWeapon()</b> - Return currently selected weapon | + | WeaponType <b>getWeapon()</b> - Return currently selected weapon<br> |
Example: | Example: | ||
<pre> | <pre> | ||
Line 30: | Line 45: | ||
</pre> | </pre> | ||
− | <b>activateModule(ModuleType)</b> - Activate module, specified by ModuleType. If specified module is not included in the current loadout, this command will have no effect. | + | void <b>activateModule(ModuleType)</b> - Activate module, specified by ModuleType. If specified module is not included in the current loadout, this command will have no effect.) |
Example: | Example: | ||
<pre> | <pre> | ||
Line 38: | Line 53: | ||
− | <b>activateModuleIndex(indx)</b> - Activate module, specified by its index (1 or 2 | + | void <b>activateModuleIndex(indx)</b> - Activate module, specified by its index (1 or 2)<br> |
Example: | Example: | ||
<pre> | <pre> | ||
Line 45: | Line 60: | ||
</pre> | </pre> | ||
− | <b>setReqLoadout(Loadout)</b> - Set the requested loadout to Loadout | + | void <b>setReqLoadout(Loadout)</b> - Set the requested loadout to Loadout<br> |
− | <b>getCurrLoadout()</b> - Returns current loadout | + | Loadout <b>getCurrLoadout()</b> - Returns current loadout<br> |
Example: | Example: | ||
<pre> | <pre> | ||
Line 67: | Line 82: | ||
− | <b>getReqLoadout()</b> - Returns requested loadout | + | Loadout <b>getReqLoadout()</b> - Returns requested loadout<br> |
Line 78: | Line 93: | ||
<br> | <br> | ||
<u>Ship control</u><br> | <u>Ship control</u><br> | ||
− | <b>setThrustAng( vel, angle )</b> - Set robot's velocity to vel (0-1), at angle | + | void <b>setThrustAng( vel, angle )</b> - Set robot's velocity to vel (0-1), at angle<br> |
− | <b>setThrustXY( vel, x, y )</b> - Set robot's velocity to vel (0-1), toward coordinates x, y | + | void <b>setThrustXY( vel, x, y )</b> - Set robot's velocity to vel (0-1), toward coordinates x, y<br> |
<br> | <br> | ||
− | <b>fire()</b> - Fires active weapon | + | void <b>fire()</b> - Fires active weapon<br> |
− | <b>setWeaponIndex( index )</b> - Activates weapon with index (1, 2, 3 | + | void <b>setWeaponIndex( index )</b> - Activates weapon with index (1, 2, 3)<br> |
− | <b>setWeapon( WeaponType )</b> - Activates weapon type specified (does nothing if WeaponType is not in current loadout | + | void <b>setWeapon( WeaponType )</b> - Activates weapon type specified (does nothing if WeaponType is not in current loadout)<br> |
− | <b>hasWeapon (WeaponType )</b> - Does current configuation have specified weapon | + | boolean <b>hasWeapon (WeaponType )</b> - Does current configuation have specified weapon<br> |
Example: | Example: | ||
Line 95: | Line 110: | ||
</pre> | </pre> | ||
− | <b>globalMsg( msg )</b> - Send a message to all players | + | void <b>globalMsg( msg )</b> - Send a message to all players<br> |
− | <b>teamMsg( msg )</b> - Send a message to players on the same team | + | void <b>teamMsg( msg )</b> - Send a message to players on the same team<br> |
<br> | <br> | ||
<b>logprint(msg)</b> - Print msg to game logfile<br> | <b>logprint(msg)</b> - Print msg to game logfile<br> | ||
Line 108: | Line 123: | ||
Category: GameItem<br> | Category: GameItem<br> | ||
<br> | <br> | ||
− | <b>getLoc()</b> - Center of testItem | + | Point <b>getLoc()</b> - Center of testItem<br> |
− | <b>getRad()</b> - Radius of testItem | + | number <b>getRad()</b> - Radius of testItem<br> |
− | <b>getVel()</b> - Speed of testItem | + | Point <b>getVel()</b> - Speed of testItem<br> |
Example: | Example: | ||
Line 120: | Line 135: | ||
Category: GameItem<br> | Category: GameItem<br> | ||
<br> | <br> | ||
− | <b>getSize()</b> - Index of current asteroid size (0 = initial size, 1 = next smaller, 2 = ... | + | number <b>getSize()</b> - Index of current asteroid size (0 = initial size, 1 = next smaller, 2 = ...)<br> |
− | <b>getSizeCount()</b> - Number of indexes of size we can have | + | number <b>getSizeCount()</b> - Number of indexes of size we can have<br> |
− | <b>getLoc()</b> - Center of asteroid | + | Point <b>getLoc()</b> - Center of asteroid<br> |
− | <b>getRad()</b> - Radius of asteroid | + | number <b>getRad()</b> - Radius of asteroid<br> |
− | <b>getVel()</b> - Speed of asteroid | + | Point <b>getVel()</b> - Speed of asteroid<br> |
Example: | Example: | ||
Line 135: | Line 150: | ||
Category: GameItem<br> | Category: GameItem<br> | ||
<br> | <br> | ||
− | <b>getLoc()</b> - Center of ResourceItem | + | Point <b>getLoc()</b> - Center of ResourceItem<br> |
− | <b>getRad()</b> - Radius of ResourceItem | + | number <b>getRad()</b> - Radius of ResourceItem<br> |
− | <b>getVel()</b> - Speed of ResourceItem | + | Point <b>getVel()</b> - Speed of ResourceItem<br> |
Example: | Example: | ||
Line 147: | Line 162: | ||
Category: GameItem<br> | Category: GameItem<br> | ||
<br> | <br> | ||
− | <b>getLoc()</b> - Center of RepairItem | + | Point <b>getLoc()</b> - Center of RepairItem<br> |
− | <b>getRad()</b> - Radius of RepairItem | + | number <b>getRad()</b> - Radius of RepairItem<br> |
− | <b>getVel()</b> - Speed of RepairItem | + | Point <b>getVel()</b> - Speed of RepairItem usually 0,0)<br> |
− | <b>isVis()</b> - Is repair item currently visible? | + | boolean <b>isVis()</b> - Is repair item currently visible?<br> |
Example: | Example: | ||
Line 172: | Line 187: | ||
− | <b>getName()</b> - Name of weapon ("Phaser", "Triple", etc. | + | string <b>getName()</b> - Name of weapon ("Phaser", "Triple", etc.)<br> |
− | <b>getID()</b> - ID of module (WeaponPhaser, WeaponTriple, etc. | + | WeaponType <b>getID()</b> - ID of module (WeaponPhaser, WeaponTriple, etc.)<br> |
− | <b>getRange()</b> - Get range of weapon (units | + | number <b>getRange()</b> - Get range of weapon (units)<br> |
− | <b>getFireDelay()</b> - Delay between shots in ms | + | number <b>getFireDelay()</b> - Delay between shots in ms<br> |
− | <b>getMinEnergy()</b> - Minimum energy needed to use | + | number <b>getMinEnergy()</b> - Minimum energy needed to use<br> |
− | <b>getEnergyDrain()</b> - Amount of energy weapon consumes | + | number <b>getEnergyDrain()</b> - Amount of energy weapon consumes<br> |
− | <b>getProjVel()</b> - Speed of projectile (units/sec | + | number <b>getProjVel()</b> - Speed of projectile (units/sec)<br> |
− | <b>getProjLife()</b> - Time projectile will live (ms) | + | number <b>getProjLife()</b> - Time projectile will live (ms) -1 == live forever)<br> |
− | <b>getDamage()</b> - Damage projectile does (0-1, where 1 = total destruction | + | number <b>getDamage()</b> - Damage projectile does (0-1, where 1 = total destruction)<br> |
− | <b>getCanDamageSelf()</b> - Will weapon damage self? | + | boolean <b>getCanDamageSelf()</b> - Will weapon damage self?<br> |
− | <b>getCanDamageTeammate()</b> - Will weapon damage teammates? | + | boolean <b>getCanDamageTeammate()</b> - Will weapon damage teammates?<br> |
== WeaponType constants == | == WeaponType constants == | ||
Line 197: | Line 212: | ||
bot:logprint( "This is a lame example!" )</pre> | bot:logprint( "This is a lame example!" )</pre> | ||
− | <b>getName()</b> - Name of module ("Shield", "Turbo", etc. | + | string <b>getName()</b> - Name of module ("Shield", "Turbo", etc.)<br> |
− | <b>getID()</b> - ID of module (ModuleShield, ModuleBoost, etc. | + | ModuleType <b>getID()</b> - ID of module (ModuleShield, ModuleBoost, etc.)<br> |
== ModuleType constants == | == ModuleType constants == | ||
Line 208: | Line 223: | ||
== Loadouts == | == Loadouts == | ||
− | <b>setWeapon(index, WeaponType)</b> - Set weapon at index | + | void <b>setWeapon(index, WeaponType)</b> - Set weapon at index<br> |
− | <b>setModule(index, ModuleType)</b> - Set module at index | + | void <b>setModule(index, ModuleType)</b> - Set module at index<br> |
− | <b>getWeapon(index)</b> - return weapon at index | + | WeaponType <b>getWeapon(index)</b> - return weapon at index<br> |
− | <b>getModule(index)</b> - return module at index | + | ModuleType <b>getModule(index)</b> - return module at index<br> |
Example: | Example: | ||
Line 234: | Line 249: | ||
</pre> | </pre> | ||
− | <b>isValid()</b> - Is loadout config valid? | + | boolean <b>isValid()</b> - Is loadout config valid?<br> |
− | <b>equals(Loadout)</b> - is loadout the same as Loadout? | + | boolean <b>equals(Loadout)</b> - is loadout the same as Loadout?<br> |
== GameInfo == | == GameInfo == | ||
Line 272: | Line 287: | ||
</pre> | </pre> | ||
− | <b>getGameType()</b> - Return current game | + | GameType <b>getGameType()</b> - Return current game typet) <br> |
− | <b>getGameTypeName()</b> - Return current game type | + | string <b>getGameTypeName()</b> - Return current game type <br> |
− | <b>getFlagCount()</b> - Return the number of flags in the game | + | number <b>getFlagCount()</b> - Return the number of flags in the game<br> |
− | <b>getWinningScore()</b> - Returns the score required to win the level | + | number <b>getWinningScore()</b> - Returns the score required to win the level<br> |
− | <b>getGameTimeTotal()</b> - Returns the time (in seconds) that the level will be played for | + | number <b>getGameTimeTotal()</b> - Returns the time (in seconds) that the level will be played for<br> |
− | <b>getGameTimeRemaining()</b> - Returns the time remaining (in seconds) for this level | + | number <b>getGameTimeRemaining()</b> - Returns the time remaining (in seconds) for this level<br> |
− | <b>getLeadingScore()</b> - Gets score of the leading team | + | number <b>getLeadingScore()</b> - Gets score of the leading team<br> |
− | <b>getLeadingTeam()</b> - Gets index of leading team | + | number <b>getLeadingTeam()</b> - Gets index of leading team<br> |
− | <b>getTeamCount()</b> - Return number of teams | + | number <b>getTeamCount()</b> - Return number of teams<br> |
Example: | Example: | ||
Line 293: | Line 308: | ||
</pre> | </pre> | ||
− | <b>getLevelName()</b> - Gets the level's name | + | string <b>getLevelName()</b> - Gets the level's name<br> |
− | <b>getGridSize()</b> - Gets the level's gridSize parameter | + | number <b>getGridSize()</b> - Gets the level's gridSize parameter<br> |
− | <b>getIsTeamGame()</b> - Is this a team game? | + | boolean <b>getIsTeamGame()</b> - Is this a team game?<br> |
<br> | <br> | ||
<b>getEventScore(ScoringEvent)</b><br> | <b>getEventScore(ScoringEvent)</b><br> | ||
Line 323: | Line 338: | ||
== TeamInfo == | == TeamInfo == | ||
− | <b>getName()</b> - return team name | + | string <b>getName()</b> - return team name<br> |
− | <b>getIndex()</b> - return team's index, index of first team is 1 | + | number <b>getIndex()</b> - return team's index, index of first team is 1<br> |
− | <b>getPlayerCount()</b> - return player count | + | number <b>getPlayerCount()</b> - return player count<br> |
− | <b>getScore()</b> - return team score | + | number <b>getScore()</b> - return team score<br> |
Example: | Example: |
Revision as of 07:24, 2 May 2009
Starting with release 011, server admins will be able to program their own robots in addition to designing their own levels. Robots will be coded in Lua, and will will have a number of special functions available to them.
Robot coding is still fluid, and everything is subject to change, but here is a list of commands being implemented for the next alpha release (see forums for the URL):
How to read the function notation:
returnType funtionName( argType1, argType2 ) - Description of function
Return types:
Unlike most languages, Lua does not differentiate between integers and floating point numbers. Instead, everything is simply a number.
Points to remember in Lua:
- Lua arrays are 1-based: the first index is 1 rather than 0 as is the case in most programming languages
Contents
getZoneCenterXY( x, y ) - Return point representing center of zone containing point x,y
getGatewayFromZoneToZone( a, b ) - Return point representing fastest way from zone a to zone b. If zones a & b are not neighbors, returns nil
number getZoneCount() - Return number of zones
number getCurrentZone() - Return current zone that robot is in
number getAngle() - Return angle robot is currently facing
Point getPosXY() - Return x, y of robot
void setAngle( ang ) - Point robot at angle
void setAngleXY( x, y ) - Point robot towards point x,y
number getAngleXY( x, y ) - Compute angle to point x, y
boolean hasLosXY( x, y ) - Return whether or not robot can see point x, y
hasFlag() - Return whether or not robot currently has the flag
WeaponType getWeapon() - Return currently selected weapon
Example:
weap = bot:getWeapon() -- Get info about our currently active weapon weapInfo = WeaponInfo( weap ) -- Get information about it bot:logprint( weapInfo:getName().." has a range of "..weapInfo:getRange() )
void activateModule(ModuleType) - Activate module, specified by ModuleType. If specified module is not included in the current loadout, this command will have no effect.) Example:
-- Note that this line will do nothing if we don't have shields bot:activateModule( ModuleShield ) -- Shields up!
void activateModuleIndex(indx) - Activate module, specified by its index (1 or 2)
Example:
-- Must specify an index, currently either 1 or 2 bot:activateModuleIndex( 1 ) -- Activate first module, whatever it is
void setReqLoadout(Loadout) - Set the requested loadout to Loadout
Loadout getCurrLoadout() - Returns current loadout
Example:
loadout = bot:getCurrLoadout() -- Retrieve current bot configuration weapType1 = loadout:getWeapon(1) -- Get the first weapon weapType2 = loadout:getWeapon(2) -- Get the second weapon weapType3 = loadout:getWeapon(3) -- Get the third weapon -- Check to see if the first weapon is a phaser if ( weapType1 == WeaponPhaser ) then bot:logprint("First weapon is a phaser!") end -- Print a list of our three current weapons bot:logprint( "My three weapons are: "..WeaponInfo(weapType1):getName()..", " ..WeaponInfo(weapType2):getName()..", and " ..WeaponInfo(weapType3):getName() )
Loadout getReqLoadout() - Returns requested loadout
Navigation
findObjects(ObjectType)
getWaypoint(x, y)
Ship control
void setThrustAng( vel, angle ) - Set robot's velocity to vel (0-1), at angle
void setThrustXY( vel, x, y ) - Set robot's velocity to vel (0-1), toward coordinates x, y
void fire() - Fires active weapon
void setWeaponIndex( index ) - Activates weapon with index (1, 2, 3)
void setWeapon( WeaponType ) - Activates weapon type specified (does nothing if WeaponType is not in current loadout)
boolean hasWeapon (WeaponType ) - Does current configuation have specified weapon
Example:
if ( bot:hasWeapon( WeaponMine ) ) then bot:setWeapon( WeaponMine ) -- Make mine layer active, if it's -- part of our current loadout bot:fire() -- Lay a mine end
void globalMsg( msg ) - Send a message to all players
void teamMsg( msg ) - Send a message to players on the same team
logprint(msg) - Print msg to game logfile
GameItems
The Lua object structure follows that used by Bitfighter. The GameItems group conisists of RepairItems, Asteroids, ResourceItems, and TestItems. These all share similar properties, and have similar methods. All of these implement the getLoc, getVel, and getRad methods for querying location, velocity, and radius respectively. Some items have additional methods that apply only to them. See below for details on these additional methods.
TestItems
Category: GameItem
Point getLoc() - Center of testItem
number getRad() - Radius of testItem
Point getVel() - Speed of testItem
Example:
ti = bot:findTestItem() -- Function likely to change vel = it:getVel()
Asteroids
Category: GameItem
number getSize() - Index of current asteroid size (0 = initial size, 1 = next smaller, 2 = ...)
number getSizeCount() - Number of indexes of size we can have
Point getLoc() - Center of asteroid
number getRad() - Radius of asteroid
Point getVel() - Speed of asteroid
Example:
asteroid = bot:findAsteroid() -- Function likely to change target = asteroid:getLoc()
ResourceItems
Category: GameItem
Point getLoc() - Center of ResourceItem
number getRad() - Radius of ResourceItem
Point getVel() - Speed of ResourceItem
Example:
ri = bot:ResourceItem() -- Function likely to change vel = ri:getVel()
RepairItems
Category: GameItem
Point getLoc() - Center of RepairItem
number getRad() - Radius of RepairItem
Point getVel() - Speed of RepairItem usually 0,0)
boolean isVis() - Is repair item currently visible?
Example:
ri = bot:findRepairItem() -- Function likely to change vel = ri:getVel()
Weapon Information
All the WeaponInfo data will remain constant throughout the game. Therefore, if you need some information about a weapon, it might make sense to retrieve it in the bot's header and store it in a local variable rather than instantiating a new WeaponInfo object during every loop of the robot's getMove() method.
Example:
weap = bot:getWeapon() -- Get bot's currently active weapon bot:logprint( weap:getName().." has a range of "..weap:getRange() )
weap = WeaponInfo( WeaponTurret ) -- Get info about those infernal turrets bot:logprint( weap:getName().." shoots with a speed of "..weap:getProjVel() )
string getName() - Name of weapon ("Phaser", "Triple", etc.)
WeaponType getID() - ID of module (WeaponPhaser, WeaponTriple, etc.)
number getRange() - Get range of weapon (units)
number getFireDelay() - Delay between shots in ms
number getMinEnergy() - Minimum energy needed to use
number getEnergyDrain() - Amount of energy weapon consumes
number getProjVel() - Speed of projectile (units/sec)
number getProjLife() - Time projectile will live (ms) -1 == live forever)
number getDamage() - Damage projectile does (0-1, where 1 = total destruction)
boolean getCanDamageSelf() - Will weapon damage self?
boolean getCanDamageTeammate() - Will weapon damage teammates?
WeaponType constants
WeaponPhaser | WeaponBounce |
WeaponTriple | WeaponBurst |
WeaponMine | WeaponSpyBug |
WeaponTurret |
Module Information
Example:
mod = ModuleInfo( ModuleBoost ) bot:logprint( "This is a lame example!" )
string getName() - Name of module ("Shield", "Turbo", etc.)
ModuleType getID() - ID of module (ModuleShield, ModuleBoost, etc.)
ModuleType constants
ModuleShield | ModuleBoost |
ModuleSensor | ModuleRepair |
ModuleCloak | ModuleEngineer (maybe someday) |
Loadouts
void setWeapon(index, WeaponType) - Set weapon at index
void setModule(index, ModuleType) - Set module at index
WeaponType getWeapon(index) - return weapon at index
ModuleType getModule(index) - return module at index
Example:
-- Get a new loadout (comes pre-filled with default values) loadout = Loadout() -- Configure the loadout to suit our needs loadout:setWeapon( 1, WeaponPhaser ) loadout:setWeapon( 2, WeaponBurst ) loadout:setWeapon( 3, WeaponMine ) loadout:setModule( 1, ModuleShield ) loadout:setModule( 2, ModuleCloak ) -- Set the loadout, will become active when bot hits loadout zone -- or spawns, depending on game bot:setReqLoadout( loadout ) if( loadout:getWeapon(1) == WeaponPhaser) then bot:logprintf( "This line always gets printed!" ) end
boolean isValid() - Is loadout config valid?
boolean equals(Loadout) - is loadout the same as Loadout?
GameInfo
You can get information about the current game with the GameInfo object. You only need get this object once, then you can use it as often as you like. It will always reflect the latest data.
Example:
game = GameInfo() -- Create the GameInfo object gameType = game:getGameType() if( gameType == SoccerGame ) then bot:logprint("This bot is not very good at soccer!") else gameTypeName = game:getGameTypeName() bot:logprintf("I just love playing "..gameTypeName.."!") end
Example:
-- Create the GameInfo object in header: game = GameInfo() ... -- Even though we only create our GameInfo once, it is always current ... -- Later, in getMove(): remTime = game:getGameTimeReamaining() totTime = game:getGameTimeTotal() percent = ( totTime - remTime ) / remTime bot:logprint( "Game is "..percent.."% over )
GameType getGameType() - Return current game typet)
string getGameTypeName() - Return current game type
number getFlagCount() - Return the number of flags in the game
number getWinningScore() - Returns the score required to win the level
number getGameTimeTotal() - Returns the time (in seconds) that the level will be played for
number getGameTimeRemaining() - Returns the time remaining (in seconds) for this level
number getLeadingScore() - Gets score of the leading team
number getLeadingTeam() - Gets index of leading team
number getTeamCount() - Return number of teams
Example:
-- Create the GameInfo object in header: game = GameInfo() ... -- Then later... leadingTeam = game:getLeadingTeam() team = TeamInfo( leadingTeam ) bot:teamMsg( "Hurry up! Team "..team:getName().." is winning!" )
string getLevelName() - Gets the level's name
number getGridSize() - Gets the level's gridSize parameter
boolean getIsTeamGame() - Is this a team game?
getEventScore(ScoringEvent)
GameType constants
BitmatchGame | CTFGame |
HTFGame | NexusGame |
RabbitGame | RetrieveGame |
SoccerGame | ZoneControlGame |
ScoringEvent constants
KillEnemy | KillSelf |
KillTeammate | KillEnemyTurret |
KillOwnTurret | CaptureFlag |
CaptureZone | UncaptureZone |
HoldFlagInZone | RemoveFlagFromEnemyZone |
RabbitHoldsFlag | RabbitKilled |
RabbitKills | ReturnFlagsToNexus |
ReturnFlagToZone | LostFlag |
ReturnTeamFlag | ScoreGoalEnemyTeam |
ScoreGoalHostileTeam | ScoreGoalOwnTeam |
TeamInfo
string getName() - return team name
number getIndex() - return team's index, index of first team is 1
number getPlayerCount() - return player count
number getScore() - return team score
Example:
gameInfo = GameInfo() teams = gameInfo:getTeamCount() -- Note that while the number of teams will not change throughout the game, -- the number of players on each team might. Also, the robot may be initialized -- before the players have been added, so if you run this code in the bot header, -- it may report some teams having 0 players. for i = 1, teams do -- First team has an index of 1 team = TeamInfo( i ) bot:logprint( "Team "..i.." is called "..team:getName().. " and has "..team:getPlayerCount().." players" ) end
Misc
Some constants available in game:
Game Objects
ShipType
BarrierType
MoveableType
BulletType
ItemType
ResourceItemType
EngineeredType
ForceFieldType
LoadoutZoneType
MineType
TestItemType
FlagType
TurretTargetType
SlipZoneType
HeatSeekerType
SpyBugType
NexusType
BotNavMeshZoneType
RobotType
TeleportType
GoalZoneType
AsteroidType