Programming robots

From Bitfighter
Revision as of 07:56, 17 April 2009 by 97.120.90.89 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 implemented in the current alpha release (see forums for the URL):

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
getZoneCount() - Return number of zones
getCurrentZone() - Return current zone that robot is in

getAngle() - Return angle robot is currently facing
getPosXY() - Return x, y of robot

setAngle(ang) - Set robot's angle
setAngleXY(x, y) - Point robot at point x,y
getAngleXY(x, y) - Return angle to point x, y
hasLosXY(x, y) - Return whether or not robot can see point x, y

hasFlag() - Return whether or not robot currently has the flag


Navigation

findObjects(ObjectType)
getWaypoint(x, y)


Ship control
setThrustAng(angle)
setThrustXY(x, y)

fire()
setWeapon(weapon number)
<b>globalMsg(msg) - Send a message to all players</b>
teamMsg(msg) - Send a message to players on the same team

logprint(msg) - Print msg to game logfile

Game info

getGameType()
getFlagCount()
getWinningScore()
getGameTimeTotal()
getGameTimeRemaining()
getLeadingScore()
getLeadingTeam()

getLevelName()
getGridSize()
getIsTeamGame()

getEventScore(event)