The best PC games ever The best PC games of 2018 so far Best graphics card 2018 Best free games Rainbow Six Siege operators guide Monster Hunter: World guide

11

Screeps is an MMO that turns JavaScript into RTS commands

Every once in a while, I encounter a game that just doesn’t fit any established genre. Screeps [official site] is a real-time strategy game, and it’s an MMO, but not in the vein of any I’ve ever seen before. You see, unlike StarCraft or Age of Empires, your units in Screeps don’t come with an AI or fancy control interface. Instead, you have to code each unit’s behavior in JavaScript. After a few months in early access, this week the game properly launched.Your units, called “Creeps” in-game, all have to be built from a line of JavaScript, for example:

Game.spawns['Spawn1'].createCreep( [WORK, CARRY, MOVE], 'Harvester1' );

This line of code executed in the console will spawn a creep mode up of one “WORK,” “CARRY,” and “MOVE,” module each and the designation of “Harvester1.”

Once you’ve built a unit, you must tell it how to execute the task you’ve designed it for. One of the most simple loops is:

module.exports.loop = function () {
var creep = Game.creeps['Harvester1'];
if(creep.carry.energy < creep.carryCapacity) {
var sources = creep.room.find(FIND_SOURCES);
if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) {
creep.moveTo(sources[0]);
}
}
else {
if( creep.transfer(Game.spawns['Spawn1'], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE ) {
creep.moveTo(Game.spawns['Spawn1']);
}
}
}

This code snippet sets the variable “creep” to represent our Harvester1. It then states that if Harvester1 has any empty energy carriers that it should search the “room” a.k.a. the current map for an energy source. If it is not next to a discovered energy source, the next line tells Harvester one to move to one. The ELSE case is if the creep has a full energy carrier it should move back to your base (Spawn1), and transfer the energy to your main stores.

If this was confusing to your, don’t worry. The Screeps tutorial is fairly helpful, at least enough to get you started, and the game’s various variables are well documented. Screeps might not be for the faint at heart and seems like it would take quite a bit of a time investment to get good at. However, imagining a whole server of people doing the same programming and interacting with each other is an awesome thought. Screeps also allows you to host private servers, which don’t have an additional subscription fee.

Right now you can get Screeps on Steam for £9.89/13,49€/$13.49, which is 10% off the normal price, or you can try it for free online. If you buy Screeps on Steam, you get lifetime MMO access, but you’ll only have limited CPU resources unless you subscribe for £6.29/8,99€/$8.99 per month.

Tagged with , .

If you click our links to online stores and make a purchase we may receive a few pennies. Find more information here.

Who am I?

Brittany Vincent

Contributor

More by me

Support RPS and get an ad-free site, extra articles, and free stuff! Tell me more
Please enable Javascript to view comments.

Comments are now closed. Go have a lie down, Internet.

Advertisement

Latest videos