- Node >= 5.11.0
npm install- Rename
player.default.jsontoplayer.jsonand replaceplayer_id,player_secretandapi_urlby the values that were given to you by the organisers
The only file you need to modify is ai.js.
npm start
The private game needs to already exist.
npm run join
Note that you can have a maximum of one private game at any given time.
If your private game already exists, it will destroy it and create a new one.
npm run create
npm test
State of a game.
-
id: Identifier of the game -
tick: How many updates the game has gone through so far -
players: List of players (Playerobjects) in the game -
resources: Resources in the game that can be collected to gain mass/points -
map: Dimensions of the map (Mapobject) -
viruses: List of viruses that split a cell when consumed -
me: YourPlayerinstance -
enemies: List of the otherPlayers
Dimensions of the map the players are on.
-
width: Width of the map -
height: Height of the map
Owner and controller of cells in the game. As a programmer of an AI, you are a
Player.
You can access your player via game.me.
-
id: Identifier of the player -
name: Display name of the player in-game -
cells: List ofCellobjects that the player owns and controls -
total_mass: Sum of the mass of the player's cells -
active: Whether the player is actively controlling their cells or not. If a player's AI is inactive for too long, this flag will becomeFalseand a dumb AI will take over the player's cells until the player becomes active once again.
Individual entity controlled by a Player. Through movement, it can consume
resources and enemy cells to grow. It loses a portion of its mass over time.
A cell can be moved by changing its target.
To collect a resource, a cell must collide with it.
To eat an enemy cell, a cell must almost completely overlap its enemy and be 10% bigger than it.
There is a maximum of 10 cells per player at any given time during a game.
-
id: Identifier of the cell -
mass: Mass of the cell. The bigger the mass, the bigger the cell, the slower the cell can move or accelerate. Mass decays over time (by a ratio of the current mass). The minimal mass of a cell is20. -
radius: Radius of the cell, influenced by its current mass -
position: Current position (Vec2object) of the cell in theMap -
target: Target (Vec2object) that the cell should go for. Move the cell by changing this value.
Note: the following methods will only have an effect when called on cells owned by your player.
-
move(target): Moves towards the givenVec2target. Convenience method that setscell.target. -
split(): Splits the cell into two distinct cells with half their parent's mass. The new cells will later be available to control via thecellslist inPlayer. The cell must be at least twice the minimum mass for this call to have an effect. -
burst(): Exchanges 4% of the cell's mass to gain a temporary speed boost. If the cell is too small to afford the price, this call has no effect. -
trade(mass): Trades a given amount of the cell's mass to gain a small gain in the player's score (competition points) with a ratio of 2:1. (trading 20 mass will give 10 points). This call freezes the cell for 5 seconds. After that, if the cell is still alive, the trade will complete. If the given quantity is too large for the cell's mass, the trade will only be based on how much the cell can afford.
Contains the information about the resources available on the map. Collecting those resources with a cell results in a potential increase of a cell's mass and a player's overall score in the competition.
To collect a resource, a Cell must collide with it.
There are three available resource types:
| Resource Type | Cell Mass Gain | Player Score Gain |
|---|---|---|
regular |
1 | 0.1 |
silver |
2 | 1 |
gold |
0 | 10 |
-
regular: List of positions (Vec2objects) for regular resources -
silver: List of positions (Vec2objects) for silver resources -
gold: List of positions (Vec2objects) for gold resources -
allResources: List of positions (Vec2objects) for all resources (regular, silver and gold)
Dangerous stationary cell on the map that, when eaten, causes the eating cell
to explode (split and lose mass). It will remove 40% of the cell's mass and force
it to split once and its children to split once (resulting in 4 sub-cells).
A Cell will explode if it mostly overlaps a virus and has 10% more mass. It
is safe to hide under a virus if the cell is smaller.
-
mass: Mass of the virus. ACelleating the virus will explode if it is at least 10% bigger than this. -
position: Position (Vec2object) of the virus
A 2D vector from the victor.js Javascript
library. Refer to its documentation for
details.