Changelog 2018-03-05

It’s been a while since you’ve heard from us, but all in good reason. We’ve been working hard on some exciting new features that we’re now happy to announce.

Isolated virtual machine

The chances are that this major improvement will become historical. Nobody did that in the Node.js world before, we’re proud to be pioneers here. Marcel Laverdet, our open-source contributor, has implemented an excellent isolated-vm native module that finally brings full-featured VM isolation to Node.js. With the integration of this library, Screeps can now provide truly separated sandboxes to players that don’t affect each other in any way. It is highly recommended to try now, since it will be our default VM in a few months.

  • You can opt-in for an isolated VM in the new account settings UI called Runtime. This will move the execution of your script to another pool of server nodes with this experimental feature enabled.

  • The isolated VM takes you to your very own JavaScript environment, including heap memory and garbage collector.

  • Since isolated VMs can be transferred between threads within the same Node.js process, it is no longer neccessary to maintain multiple global instances, and you always have one single global. Moreover, your global environment is very stable and can persist for several days without resets (unless you reset it with your own actions).

  • You can use the new API method Game.cpu.getHeapStatistics() to know how much heap memory you’re using in runtime. The maximum effective limit is 256 MB for each player. If you exceed this limit, your VM may be reset.

Although this feature is still considered experimental, it is well tested on our PTR server and shows good results.

Private server support

An isolated VM is also available for private servers in our beta branch that you can install this way:

npm install screeps@beta

It is recommended to set runners_cnt to 1 in your .screepsrc file, since otherwise it will create multiple global environments for each player. There is a new option runner_threads instead which should be set to the number of your CPU cores.

Also, you may want to launch Node.js with --harmony_sharedarraybuffer flag in order to enable some memory optimizations.

Tombstones

Introduced new major feature: creep Tombstones. When your creep dies for any reason, there is now a special object left that contains information about the deceased creep and any resources it carried. Tombstones slowly decay over time, the decay period depends on the creep body size. After it is decayed, all resources contained are dropped on the ground. A tombstone provides room visibility to its owner.

  • New Tombstone global prototype.
  • New constants FIND_TOMBSTONES, LOOK_TOMBSTONES, TOMBSTONE_DECAY_PER_PART.

Thanks to davaned for this idea (see discussion on forum) and ags131 for implementation (PR #74).

Other changes

These changes are supported in private server v2.13.0.


Have comments or feedback? You can discuss this post here.