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 singleglobal
. 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
IMPORTANT: Lab reaction cooldown now varies depending on a reaction according to this table (also see the new
REACTION_TIME
constant).Added new option
directions
toStructureSpawn.spawnCreep
and newStructureSpawn.Spawning
class which allows to set directions during spawning or cancel it immediately. (#61, #68 by sparr).Added new parameter
name
toRoom.createConstructionSite
andRoomPosition.createConstructionSite
(#50 by tedivm).Creep.name
andStructureSpawn.name
properties can now be accessed by other players.Added options
plainCost
andswampCost
toRoom.findPath
(#62 by tedivm).Increased
CLAIM
creeps life time from 500 to 600.Creep.attackController
on reserved controllers decreases reservation timer by 1 tick perCLAIM
body part.Other fixes:
These changes are supported in private server v2.13.0.
Have comments or feedback? You can discuss this post here.