Over a million developers have joined DZone.

Screeps: The MMO Sandbox Game for Programmers

DZone 's Guide to

Screeps: The MMO Sandbox Game for Programmers

In this article, we explore a video game that requires players to code in JavaScript in order to make any progress in the game and interact with other players.

· Web Dev Zone ·
Free Resource

I recently attended the wonderful Pioneers conference in Vienna (more interviews to follow) and among the many interviews I conducted was Artem Chivchalov, the Russian founder of Screeps, a massively multi-player online (MMO) game with something of a difference.

In most MMO games you choose a character with a variety of traits and set it loose into a world full of other human controlled characters and characters controlled by an artificial intelligence. In Screeps, there is something of both, but it’s up to the players to create it. Yes, you need to code your own characters to play.

There are two parts to the Screeps service, a closed source cross-platform client, and that you need to buy from Steam, and an open-source server, which can be Screep’s public server or your own.

The game helps and encourages you to learn to code (JavaScript) as you will need to know basic logical operators and loops to accomplish anything, and then graphics rendering and basic ‘intelligence’ to take your game further. The added beauty of the concept is that your creations continue to live on any active servers, you can code them, leave them, and revisit later to see what they’ve been up to.

The Game

Launch the client and it will ask if you want to play the game or start a server, I’ll return to servers later in the article, so select the game. After setting a username and customizing your ‘creep’ icon, you’re ready to start and I’ll quickly walk through the tutorial.

Image title

Screeps is a game of interconnected rooms and ‘creeps’ that live in them. You write the code to bring them to life in the ‘console’ area of the game for immediate actions, and the ‘scripts’ area for the long-running code.

Image title

For example, to create a creep with a name and 3 abilities:


Or to set a creep to an automated task to find an energy resource in the current room and fetch it:

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) {
    else {
        if( creep.transfer(Game.spawns['Spawn1'], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE ) {

Image title

You get the idea, and there’s extensive documentation to find out more about what you can do in the game world. Artem told me about gamers who create vast worlds of creatures who they leave running autonomously for days scurrying about and performing tasks. But this in an MMO, and the real pain/pleasure comes from playing with other players and competing with them. Open up the left menu bar and select world to select rooms and players.

Image title

Here’s one I entered.

Image title


If you want to create your own internal world for friends or workmates then that’s also easy, you have two options. You can use the client from Steam to start a server, but this will mean you can’t then play the game from that same machine. Or, you can use the npm module.

npm install -g screeps
screeps init # You will need a steam key from https://steamcommunity.com/dev/apikey
screeps start

From there you can change the server and enter your own world and the interface and interactions are much the same. Whilst you can’t do much to change the client, there’s reasonable explanation of how to change and add to the server code, and lots of forks exist to add functionality.

More Than Fun

Beyond good old fashioned gaming, Screeps is great for inter-company coding challenges, hiring, and education, and this is what attracted me to it in the first place. I love novel and fun ways to teach people how to code and it’s a great example of this. I’d love to know your thoughts and ideas for similar projects or your experiences trying Screeps.

javascript ,web dev ,coding challenges ,coding exercise

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}