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.

From this site

11 Comments

  1. Fenixp says:

    So I can give them monthly payments for JavaScript to torture me both at work and home?

    No. … No.

  2. ersetzen says:

    This is one of those games whose concept interested me but where utterly boring in practice.

    In practice your ai has to be about the macro game. Mine resources, replace miners, upgrade buildings to mine better.
    A handful of times you might be able to have more bases, ergo more mining spots. That all happens incredibly slowly, on the order of hours to days.

    And after you have a basic ai there is nothing to do except watching a really expensive and pretty boring screensaver. You could try to make it gradually more efficient but since the game is so slow you can’t really iterate or see engaging results.
    And why bother? A third of the players just pull some super optimized already finished ai from github that had thousands of man hours sunk into it so you can’t compete reasonably anyway.

    Games where you have to build the micromanagement for bots in a limited environment aka gladiabots seem much more engaging in practice.

  3. Mi-24 says:

    Ugh, poorly indented code

  4. temujin33 says:

    Very fascinating, but would require and extremely in depth tutorial/ scripting educator for me to get into it. Even so, I really like that something like this exists. It’s like thousands of mad scientists competing with each other to make the most efficient society of robots.

  5. El Mariachi says:

    Sounds like a distant descendant of RobotWar.

  6. bonuswavepilot says:

    I really like the idea of this, but I don’t go in for these monthly subscription shenanigans. I did, however, find a list of publicly-accessible private servers. Not a lot of them there just yet, but it’s early days.

Comment on this story

XHTML: Allowed code: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>