Screeps - A Game for Programmers

May 19, 2022


A while back I discovered this game called Screeps — a real-time strategy game for programmers.

I was immediately intrigued by the concept, but it took me a while to find the time and courage to play. When I finally started playing it properly, I lost myself in the game for several days on end.

Screeps means “scripting creeps.”

It's an open-source game for programmers, wherein the core mechanic is programming your units' AI. You control your colony by writing JavaScript.

Game-play trailer

About the game

In essence, screeps is a simple game.

Top-down view. You start with in a randomly generated area, with nothing more than some basic resources and your base. Nothing fun will happen — unless you program it yourself!

As a player, it is your job to “script” your own creeps’ AI. Anything you want to have happen, you have to program.

You will need to write a program that makes your base spawn workers. Next, those workers will need to be programmed to actually work. You need to direct them to go to the resources, mine the resources, stop mining when their inventories are full, and return their mined resources to your base.

You will probably also want some soldiers and some other defenses, so those need to be spawned with their own special guard and/or attack instructions as well.

Everything needs to be scripted well, as the game — and thus, your Screeps — runs online, 24/7, i.e. also when you are not playing yourself. Truly your personal, virtual, mini-AI colony.

The programming mostly occurs in JavaScript. This can be difficult for those who do not know JavaScript, but the game has a pretty extensive tutorial included, that should direct you towards setting up the basics in a matter of hours. Step by step, you will learn (read: be forced) to create different worker types; harvesters, builders, repairmen, and even some stupid soldiers, and even some basic colony management scripts; spawning workers, spending resources, upgrading stuff.

In the meantime, you will silently learn JavaScript and programming concepts while you are playing. As I was putting in more and more hours, I could see how to improve on my earlier scripts. I was able to make a lot of improvements, and with the help of other open-source libraries, I ended up feeling pretty happy about my code foundation.

The above experience makes Screeps a uniquely fun and rewarding gaming & learning experience.

Do expect to run into frustrations though! If you’re no JavaScript expert you will personally create a lot of bugs. Of which the game by default send you messages, as your colony will get stuck overnight. Moreover, you will likely need to Google every single thing you want to do at the start. I found great help in YouTube tutorials to get me started. Finally, you are only under artificial protection for the first so-many hours, after which there's a big chance you will get slaughtered by all the advanced multi-CPU players on the servers.

If you end up getting inspired to try it out, just be aware that Screeps is a time-consuming game.

Feel free to find inspiration in my Screeps Github repository: mortenbroesby/screeps-typescript

Screeps Explained

Closing notes

When the urge strikes, I love sitting down and playing around with the game. Figuring out what strategy to use, architecting, and everything else that comes with it. Thinking about how to make it better, more memory-efficient, more readable - and better at dealing with opponents.

I don't know many games that entertain my brain on this level. Truly a game for programmers.

Thanks for reading!