I’ve decided to give Screeps a try. Strategy games are one of my favorite types of games and I needed a fun way of keeping up on my programming. Screeps seems like the perfect answer.

Of course, I spent a couple hours procrastinating preparing by looking up the best ways to use Git to have a history of my scripts while making deploying them easy. It’s not very straightforward since the Screeps community is relatively small and some of the search results are pretty dated on how to install extensions.

Screeps has its own editor that you can use on the web or through the Steam version and it’s not bad. The real pro of it is that it comes with a world view so you can monitor your creeps. For the basics though, the world view is not very important; the tutorial game scripts for harvesting energy can be used without any worry about where the creeps are going. I’d imagine this is mostly how development would be: if your code is running smoothly, you’d only need to pop into your browser every once in a while in order to verify your creep behavior.

I tried out a few development workflows and decided to give my thoughts on them. Hopefully they benefit the productivity of a future Screeps player.

Github Integration

Probably the most straightforward option. Using your favorite editor, just edit and push your code to a Github repo. That repo will then be used to update your scripts in the Screeps server. It works if you prefer anything over Atom. I imagine that the refresh rate on the repo is not very bad.

Official Atom IDE

If you prefer Atom, then you’re in luck. Screeps released their official Atom package last August. Even though I prefer VS Code, I came back to Atom just for this. It provides auto-deployment and a live console display which is great to minimize the use of the browser version. Thus came my great idea: develop using Atom and use the Git/Github integration to easily commit and push from whatever directory Atom uses. Unfortunately, I’ve run into some problems.

At times, it seems that the package pulls the scripts from the server and creates its local version every time it starts. I tested it by trying to change directories into the Atom directory when Atom was not open. The directory is deleted on Atom termination, so there goes the .git directory too. I’m not sure how often this actually happens because sometimes the local directory is not wiped.

Local Steam Files

Steam does indeed keep its own local copy of your scripts. They’re never deleted but they are only updated when the game starts (obvious enough). Which means my desired workflow of developing via Atom while jumping into the terminal for incremental commits is not to be. This defeats the purpose of not having to keep opening the game (even worse, having to open the Steam app).

Grunt

Screeps has an official page for using Grunt. At first I thought it was too much of a hassle to try to learn and start using Grunt, but the Screeps page was very straightforward. Now, it’s become my preferred way of working on Screeps.

I can use VS Code and deploy to the Screeps servers to test my code. If I was clever, I could even setup a test branch that it deploys to before deploying to the main branch (that is documented in the Screeps tutorial). Then, when I verify correct behavior, I push from the same terminal window. Very convenient.

Conclusion

I think using Grunt is a much better solution than using the Github integration. It would be bad practice to push changes to a repo that would initiate incorrect behavior or exceptions. Your commit history would be littered with “fix” comments.

The Atom IDE is also pretty good, but even if I wasn’t using git, I prefer VS Code.

One thought as I wrote this: Github integration with Grunt. Grunt requires manually pushing production code to the Screeps servers. If, instead, you use Grunt to push test code and then, once verified, used the Github integration to integrate code you just pushed to Github, it might lead to a cleaner test workflow. Might try that out.