API#
This is the collection of all the data that your bot has access to during the generation of a mach as well as all the methods that it can use in order to control game entities.
On this page you can find references for:
- InitialData - Gives you match state and all the constants when the match starts
- MatchState - Gives you access to match state during the match generation
- Response object - With it you can control your game units, make them move, spawn new ones, etc.
InitialData#
Bot receives InitialData object only once at the beginning of the match. It holds the following data:
- … same values as in MatchState except for the
time
value which is0
in InitialData… mapWidth
: int
- In world unitsmapHeight
: int
- In world unitsunitSize
: float
- In world unitsplanetDiameter
: float
- In world unitsunitSpeed
: float
- In world units / secondunitRotationSpeed
: float
- In degrees / secondnumberOfWorkersOnStart
: int
unitCost
: int
- How much resources a new unit costsresourceGenerationSpeed
: float
- resources / secondmaxActiveWorkersPerPlanet
: int
- How many workers can be simultaneously mining resources on the same planetmaxNumberOfUnitsPerTeam
: int
- If reached your bot won’t be able to spawn new unitsmaxMatchDuration
: float
workerHealth
: float
workerAttack
: float
warriorHealth
: float
warriorAttack
: float
damageReductionRatioOnDefence
: float
- How much the attack of a unit is reduced when it is attacking opponent units on opponent’s planet__matchDetails
: MatchDetails
- A few details about the match and participating botsyourBotIndex
: int
- Index of the bot in botsDetails to which this instance of MatchDetails was sent tobotsDetails
: list
- List of all bots that participate in this match with their detailsbotName
: string
teamIndex
: int
MatchState#
Bot receives MatchState every 0.2 match second (5 times per match second). It holds the data about what is going on with match entities at a current time during the match.
time
: float
- Current match time in secondsyourPlanets
: list
- List of planets that your bot currently ownsid
: float
- Id of the planetowner
: Owner
- Enum - can beRED
,GREEN
,NONE
x
: float
- x location of the planety
: float
- y location of the planetresources
: float
- How many resources are currently mined on the planetcanSpawnNewUnit
: boolean
- If there are enough resources on the planet to spawn a new unitidsOfUnitsOnPlanet
: list of int
- List of ids of the units that are currently on the planet
freePlanets
: list
- List of planets that are still free, same object types asyourPlanets
opponentPlanets
: list
- List of planets that are owned by the opponent, same object types asyourPlanets
yourWorkers
: list
- List of your workersid
: float
- Id of the unittype
: UnitType
- Enum - can beWORKER
,WARRIOR
x
: float
- x location of the unity
: float
- y location of the unitrotation
: float
- In degreeshealth
: float
currentPlanetId
: int
- Id of the current planet, if the unit is not on a planet the Id is-1
destinationPlanetId
: int
- Id of the destination planet, if the unit is not traveling the Id is-1
opponentWorkers
: list
- List of opponent workers, same object types asyourWorkers
yourWarriors
: list
- List of your warriors, same object types asyourWorkers
opponentWarriors
: list
- List of opponent warriors, same object types asyourWorkers
Response object#
Using Response object you can communicate with the match generator and tell it what you want your units to do. You can use the following methods:
spawnUnit(int planetId, UnitType type)
- Tells match generator to spawn new unit on a planet with id
planetId
and of typetype
that can beWORKER
orWARRIOR
- Tells match generator to spawn new unit on a planet with id
sendUnit(int unitId, int destinationPlanetId)
- Tells match generator to send a unit with
unitId
to the planet with iddestinationPlanetId
. Note that you can only send away units that are not already traveling somewhere.
- Tells match generator to send a unit with