Mechanics
Buildings are critical to help you progress through the technology tree. If you lose all your buildings, it's game over.
Units are an important part of extending your influence. Units are used for economy and military purposes.
Harvest Ore with workers and return it to your Hub.
Process Ore into Metal.
Use Metal to build basic units like workers and soldiers to expand your economy and military.
Gather more advanced resources and use them to build custom modular units to adapt to any situation.
Your population limit is determined by the number of hubs and other personnel buildings you have.
Your units and buildings provide vision around them in a moderate area. There may be some delay due to satellite uplink.
For precise control over units and buildings, you should establish a websocket connection.
Handle the following events for a complete experience
For one-off or rare commands like key building construction, a simple HTTP request may be sufficient.
For interactive debugging or analysis, a CLI may be useful.
Here's how you can code
All of the below is probably too complicated for now.
The code editor is a simple JavaScript editor with a few features to help you.
Your code should take the following shape:
// To make your code run, return an object with `start`, `step`, and `stop` that the Future Terminal client can call
function myCode() {
var api;
var tick = function () {
// Your code goes here!
};
var codeVersion = new Date().toLocaleString();
return {
start: function () {
var now = new Date().toLocaleString();
console.log("User code ".concat(codeVersion, " is starting at ").concat(now));
if (!api) {
api = window.api;
}
},
step: function () {
return tick();
},
stop: function () {
var now = new Date().toLocaleString();
console.log( "User code ".concat(codeVersion, " is stopping at ").concat(now));
}
};
}
Here's what you're coding with
When you're using the client editor, the main object to code against is found at window.api
.
Some functions run locally and have no costs. Other functions are sent to the server and so have a cost or delay associated with them. Any function that is a server command might silently fail: your code will continue to run, but the command will not be accepted by the server.
Make sure your code handles this gracefully.
These functions run locally and have no costs. But their data might be a little bit out of date.
Function | Description |
---|---|
getOres() |
Get all ores |
getUnits() |
Get all your units |
getBuildingsByType(buildingType) |
Get your buildings by type |
getUnitsByType(unitType) |
Get your units by type |
getEnemyUnits() |
Get enemy units |
getEnemyBuildings() |
Get enemy buildings |
distanceBetweenEntities(a, b)
|
Get the distance between two entities |
distanceBetween(x1, y1, x2, y2)
|
Get the distance between two entities within a range |
getNearest(entities, x1, y1)
|
Get the nearest entity to a point |
getNearestWithinRange(entities, x1, y1, range)
|
Get the nearest entity to a point within a range |
These functions are sent to the server as requests and have a cost or delay associated with them. They might silently fail.
Function | Description |
---|---|
move(a, x, y)
|
Try to move a unit to a point |
mine(a, ore) |
Try to mine an ore |
load(a, hub) |
Try to load ore into a building |
spawnBuilding(buildingType, x, y)
|
Try to spawn a building |
spawnWorker(x, y) |
Try to spawn a worker |
spawnSoldier(x, y) |
Try to spawn a soldier |
getOres()
Returns a list of Ore
objects.
getUnits()
Returns a list of Unit
objects that are yours.
getBuildingsByType(buildingType)
Returns a list of Building
objects filtered by
buildingType
that are yours.
buildingType
is the value of a BuildingType.
getUnitsByType(unitType)
Returns a list of Unit
objects filtered by unitType
.
unitType
is the value of a UnitType
getEnemyUnits()
Returns a list of Unit
objects that are enemies.
getEnemyBuildings()
Returns a list of Building
objects that are enemies.
distanceBetweenEntities(a, b)
Returns the distance between two entities as a number.
a
is the first entity, b
is the second entity
distanceBetween(x1, y1, x2, y2)
Returns the distance between two points as a number.
getNearest(entities, x1, y1)
Returns the nearest entity to a point.
entities
is a list of entities
getNearestWithinRange(entities, x1, y1, range)
Returns the nearest entity to a point within a range.
entities
is a list of entities. x1
, y1
, and range
are
numbers
move(a, x, y)
Moves a unit to a point.
mine(a, ore)
Mines an ore.
a
is the entity mining. ore
is the ore to be mined.
load(a, hub)
Loads ore into a building.
a
is the entity loading. ore
is the hub to be loaded.
spawnBuilding(buildingType, x, y)
Create a building.
spawnWorker(x, y)
Create a worker.
spawnSoldier(x, y)
Create a soldier.
Name | Value | Description |
---|---|---|
Hub |
1 | The Hub building |
House |
2 | The House building |
Name | Value | Description |
---|---|---|
Worker |
1 | The Worker unit |
Soldier |
2 | The Soldier unit |
Each faction ultimately strives to field its customisable mech units, which are the mainstay of any ground-based main battle force.
Simple (Primary) mechs are comprised of a Base, Body, and Primary Armament.
Complex (Secondary) mechs are comprised of a Base, Body, Right arm (primary), Left arm (secondary).
Advanced (Tertiary) modular mechs are comprised of a Base, Body, and composable Segments. Segments may be connectors with various Endpoints. Endpoints can have Armaments attached.
Body types are the core of a mech. They determine the mech's size and shape.
Base types are the foundation of a mech. They determine the mech's movement and power.
Armament types are the weapons of a mech. They determine the mech's offensive capabilities.
Segment types are the modular components of a mech. They determine the mech's flexibility and adaptability.
In code:
const simpleMech = buildMech({
base: "BaseType",
body: "BodyType",
armament: "ArmamentType",
});
Base type should be one of the following:
Bipedal (Scout Legs)
Reverse-Jointed (Strider Legs)
Treads (Siege Treads)
Quad (Fortress Legs)
Body type should be one of the following:
Light (Recon, Specter Frame)
Medium (Combat, Vanguard Chassis)
Heavy (Assault, Titan Hull)
Superheavy (Fortress, Bastion Core)
Weapons come in three major categories:
Projectile (Kinetic)
Missile (Explosive)
Laser (Energy)
Future weapon classes may include e.g., Indirect Fire (Artillery), Support (e.g,. Repair), and Melee (???).
Armament (weapon) type should be one of the following:
Kinetic - Light - Machine Guns
Kinetic - Light - Shotguns
Kinetic - Medium - Autocannons
Kinetic - Medium - Railguns
Kinetic - Heavy - Gauss Cannons
Energy - Light - Laser Pointers
Energy - Medium - Plasma Rifles
Energy - Medium - Beam Lasers
Energy - Heavy - Particle Cannons
Explosive - Light - Grenade Launchers
Explosive - Medium - Missile Racks
Explosive - Heavy - Artillery Cannons
Explosive - Heavy - Rocket Pods
Support - Light - EMP Launchers
Support - Medium - Smoke Launchers
Support - Heavy - Repair Tools
Each faction has unique buildings, units, and tactics
Information about known factions has been removed.
Here's how your commands compete
All commands received by the server are queued and run in order, after a little bit of grouping. The server will run as many commands as it can. If you send too many commands, only the first few will run. The rest will be ignored.
In more technical terms, the server runs commands in batches. Each batch is a set of commands that were received within a certain time period. The size of each batch varies according to server performance.