New feature: code branches

One of the most often related inconveniences with the game and the editor has been the lack of various debugging tools. We plan to release the Screeps game engine as a standalone npm package so that everyone could launch a game sim locally in a console and thus perform any debugging needed, from unit testing of separate modules to modelling parallel development of game worlds with different settings. However, these are just mid-term plans, while in the short-term we plan to launch two important updates which will greatly simplify development:

  1. Branching of your scripts in a way that you can edit your code in the Simulation without affecting the code from the World, and then commit it to the World after the debugging.
  2. Better Custom Mode: import/export to JSON, saving game situation from any individual room in a game, repeating one tick in a loop, API for creating game objects in Custom Mode.

The second option will be introduced later, but we are happy to announce the first one right now!

In the scripts editor you can see a current branch selection list. One default branch is available initially. The clone function allows you to create a new branch based on it. All code from all the modules belongs to the branch cooperatively, you cannot take individual modules into a separate branch and use them from another branch.

The branch being edited at the moment is the one active in the game. However, the World may have one active branch, the Simulation another one. For example, you may clone the default branch and call the newly-created one, say, develop, then select it as active in the sim mode, and freely edit your code in it without fear of breaking something in the World game process while developing. After you are fully satisfied with the develop branch changes, you can again clone it under default name, thus replacing the basic branch and taking your changes into effect in the actual game.

If you use grunt-screeps for commiting your scripts from a local machine, you will have to update the package to have the ability to specify a branch to commit.

We hope this update will simplify testing and debugging of your game scripts.