Something's wrong Something's wrong

We don’t want your email. Just bear in mind that if you forget your password, you’ll need to create a new account

Something's wrong

yare.io

Intro & Gameplay Spirit Base Outpost Energy Credits

yare.io is a real-time 2-player (1v1) strategy game where you control your units (spirits) via JavaScript. You win by destroying the opponent’s base.

If you are new to yare.io, try out the Interactive Tutorial

placeholder for trailer video

Game board

Yare.io is played on a board sized 4400 × 2700 units. It’s an Euclidian plane starting [0, 0] at the top left and [4400, 2700] at the bottom right. Star and player base positions shown below.

Game's global variables

Variable Type Description
memory object Empty object. Use it to store values across ticks
base object Your base
enemy_base object Enemy base
star_zxq object Top-left corner star
star_a1c object Bottom-right corner star
star_p89 object Star in the middle
outpost object Outpost
my_spirits array Contains only your spirits
spirits object Contains all spirits. Access them by their id – spirits[‘jane_7’]
tick number Current game tick (e.g. 75). 1 tick = 600ms

Spirit

Spirits are the game’s units. They are JavaScript objects with various properties and methods listed below.

2 ways to access the spirit object

spirits[id]

object

The spirits object contains all of the game’s spirits. E.g. spirits[‘jane2’] returns the spirit with id = ‘jane2’

my_spirits[index]

array

my_spirits array contains only your spirits. E.g. my_spirits[0] is your oldest spirit.

You can also access your own spirits by their id. E.g. jane2.position, but that’s highly impractical in the real game outside of the tutorial.

Properties

Property Type Value
id string username + #. E.g. jane7
position array spirit’s [x, y] coordinates, e.g. [750, 900]
size number 1–100 10 3 ?
energy_capacity number 10–1000 100 30 ?
energy number spirit’s current energy – more about energy
hp number 1 when spirit is alive, 0 when it’s dead
mark string Custom string assignable via set_mark() method.
last_energized string id of most recently energized object
sight object show example ?

Methods

Method Argument Can be used by
energize(target) target is an object Circles Squares Triangles

Transfers (1 × spirit's size) energy unit from itself into target. Max distance of the energy transfer is 200 units.

If target is an enemy spirit or a base, the target takes damage (loses energy) equivalent to (2 × attacking spirit's size)

If target is the same spirit as origin, the spirit will attempt harvesting energy from a star.

my_spirits[0].energize(my_spirits[1]);
var enemy = spirits['jane7']; 
my_spirits[0].energize(enemy);
my_spirits[1].energize(enemy);

If a spirit or base has negative energy at the end of a tick, it will die.

move(target) target is an [x, y] array Circles Squares Triangles

Moves spirit to target with a speed of 20 units per tick

my_spirits[0].move([800, 900]);
merge(target) target is a friendly spirit Circles Squares Triangles

Merges a spirit into another friendly spirit. Target needs to be within 10 units radius.

for (i = 0; i < 5; i++){ 
  my_spirits[i].move(my_spirits[6].position);
  my_spirits[i].merge(my_spirits[6]);
}
divide() no argument Circles Squares Triangles

Divides spirit back into all the spirits that were merged into it.

my_spirits[9].divide()
jump(target) target is an [x, y] array Circles Squares Triangles

Teleports a spirit into a new location. Energy cost of the jump is equal to distance/5. Target can not be within a 50 unit distance from any base or outpost (in both x and y direction, not radius), or 100 unit distance from a star. If target is not a valid location, the jump will land in the nearest valid location from target

explode() no argument Circles Squares Triangles

Spirit explodes, killing itself and dealing 10 damage to all enemy spirits within 160 radius.

shout(message) max. 20 char string Circles Squares Triangles

Shows a message above the spirit as a light-weight in-game communication. Useful for some debugging as well.

set_mark(label) label is a string (max. 60 char) Circles Squares Triangles

Updates the mark property of the spirit. That can be useful for e.g. marking which spirit is doing what

All instances of a method are executed together for both players every tick on the server in the same order as the table above.

First, all energize() methods are calculated, then all movements, then all merge() and so on. Except for explode() that happens together with energize().

E.g. if two spirits of the same size and with the same amount of energy are attacking each other, they will die at the same moment.

Base

Base is the birth-place for new spirits, automatically generating new spirits when it has enough energy. If there is an enemy in its sight, the base stops producing new spirits, keeping all energy to defend itself.

Energy needed to generate a new spirit (happens automatically once per tick)

25-400 360–800 90–300 ?

The base won’t generate new spirits if there is an enemy in its sight (400 radius). It will keep all incoming energy from friendly spirits (until it reaches its energy_capacity) to defend itself.

Properties

Property Type Value
id string “base_“ + username, e.g. base_jane
structure_type string “base“
position array [1500, 600] player1 base, [2300, 1400] player2 base
size number 40
energy_capacity number 400 1000 600
energy number base’s current energy – more about energy
hp number 5
sight object show example ?

The base's hp decreases by 1 every tick it doesn't have enough energy to defend itself while being attacked. The game ends when the base's hp reaches 0

Outpost

Neutral structure in the middle of the map that provides strategic advantage for whoever controls it by automatically shooting at enemy targets within its range.

Who controls the outpost

The player that first sends energy into the outpost takes over its control. The outpost then automatically uses this energy to energize a random target within its range. Enemy can energize the outpost — e.g. my_spirits[0].energize(outpost) — to reduce its current energy (same way as if it was a spirit).

Once the outpost’s energy reaches 0 (either by using up all of its energy to attack or by the enemy damaging it), it becomes neutral again, available for any player to take control over it.

If both players are trying to take over the outpost’s control at the same time, the player that sends more energy takes over it.

Properties

Property Type Value
id string "outpost_mdo"
structure_type string “outpost“
position array [2200, 1100]
size number 20
energy_capacity number 1000
energy number outpost’s current energy
range number 400 (600 if outpost's energy >= 500)
control string player's id (e.g. "jane")
sight object show example ?

Outpost deals 2 damage (costing 1 energy, same as a spirit) when it has less then 500 energy and 8 damage (costing 4 energy) when it has over 500 energy.

Energy

Energy is the only resource in the game. Spirits harvest it from the stars, use it to create new spirits, transfer energy between themselves and attack with it.

Stars are the source of energy. Every tick (1 tick = 600ms), a star generates 3 energy + 1% of its current energy (rounded to a nearest integer)

The star in the middle of the map – star_p89 – starts generating energy after the 100th tick.

Star properties

Property Type Value
id string “star_zxq“, “star_a1c” and "star_p89" game board
structure_type string “star“
energy number star's current energy
energy_capacity number 1000
position array [x, y] coordinates (see game board)
active_in number Ticks until star starts generating energy (relevant only for the middle star)

All “movement” of energy in the game is done via the energize(target) method. See the Spirit methods section.

Credits

Yare.io was made by Vilem Ries, jm and Vendan. Feel free to reach out over Discord