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
Module updated. Check browser console for errors.
Create module
Update module
Close

yare 2BETA

Intro Spirit Base Outpost & Pylon Energy Credits Modules

yare.io is a real-time 2-player (1v1) strategy game where you control units with any input method you want.

The default built-in methods are JavaScript/Python or a traditional Mouse/Touch interface, but you can create your own UI and modalities using the modules system.

Game mechanics

Game mechanics

There is one resource — energy. You extract energy from stars and use it to attack, defend and produce new units. The only thing you can control is the movement of your units and where they transfer the energy.

End game conditions
1

Player with 0 remaining units loses

2

Player with 0 structures (bases, pylon, outpost) under their control loses

Factions
Unique ability

Small and weak, but their power lies in numbers.

merge/divide

Combines spirits into one stronger unit

Large and strong, but expensive to produce and small in numbers.

lock/unlock

Can’t move, but increases energize range

Neither too strong, nor too weak, but most difficult to play right.

explode

Damages all enemies in surrounding area

Game's global variables

Variable Type Description
memory object Empty object. Use it to store values across ticks
base_zxq object Top-left base (Player 1 start position)
base_a2c object Bottom-right base (Player 2 start position)
base_p89 object Bottom-left base (neutral)
base_nua object top-right base (neutral)
star_zxq object Top-left star
star_a2c object Bottom-right star
star_p89 object Bottom-left star
star_nua object Top-right star
outpost_mdo and outpost object Outpost
pylon_u3p and pylon object Pylon
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 (including dead 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. jane_7
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
shape string 'circles', 'squares' or 'triangles'
player_id string username
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.

If target is a location (e.g. [450, 380]) the spirit will create an energy fragment at that point.

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]);
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, outpost or pylon, 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

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()
lock() no argument Circles Squares Triangles

Spirit locks itself — cannot move anymore, but every tick its range increases by 25 units until it reaches 300 (4 ticks).

unlock() no argument Circles Squares Triangles

Unlocks the spirit, returning its energize range back to 200. The spirit can move again.

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-150 360–700 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_zxq“, "base_a2c", "base_p89" or "base_nua"
structure_type string “base“
position array [x, y] coordinates of the base
energy_capacity number 400 1000 600
energy number base’s current energy – more about energy
current_spirit_cost number energy cost per new spirit
control string id of the player controlling the base
sight object show example ?

If a base is in a neutral state, the player that pours more energy into it in the next tick claims control.

When a non-neutral base's energy would have gone below 0 (i.e. while under attack), the base becomes neutral.

Outpost

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

Properties

Property Type Value
id string "outpost_mdo"
structure_type string “outpost“
position array [-230, 230]
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.

Pylon

Neutral structure that provides strategic advantage for whoever controls it by automatically healing all friendly spirits within its range.

Properties

Property Type Value
id string "pylon_u3p"
structure_type string “pylon“
position array [228, -228]
energy_capacity number 1000
energy number pylon’s current energy
control string player's id (e.g. "jane")
sight object show example ?

Pylon heals all friendly spirits that are inside the annulus area where the smaller circle has radius 200 and the larger one 400 units. The healing rate is 1 energy per tick per spirit.

Who controls the outpost / pylon / neutral base

The player that first sends energy into the neutral structure takes over its control. If both players are energizing neutral structure at the same time, the player who pours more energy in that tick takes control (structure remains neutral if both energize it with the same amount). Energizing a structure controlled by an enemy deals 2 damage — same as attacking a spirit.

Once the structure's energy reaches 0 (either by using up all of its energy to attack/heal or by the enemy damaging it), it becomes neutral again, available for any player to take control over it. Base remains under the player's control until its energy would have gone below 0.

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 = 500ms), a star generates 2 energy + 2% of its current energy (rounded to a nearest integer). Except for star_nua that generates 3 energy + 3%.

Star properties

Property Type Value
id string “star_zxq“, “star_a2c”, "star_p89" and "star_nua"
structure_type string “star“
energy number star's current energy
energy_capacity number 1000 (3000 for star_nua)
regeneration number Star's regeneration rate
position array [x, y] coordinates

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

Energy fragments

Energizing a location (e.g. spirit.energize([450, 500])) will create an energy fragment at that point. Fragments can then be harvested by any player in the same way as stars (spirit energizing itself). If a spirit can harvest from a star or from a fragment, it will prioritize the fragment.

Credits

Author: Vilem Ries

Key contributors: Vendan, jm and swz