maxresdefault

Sharding: How did we reach this?

For years the devs have advertised Screeps as being a single world. This has been a major selling point for us as players knowing there is not some unfair advantage but that each players code is running using the same rules and parameters. However it has been decided that the world will change to include a second “shard.” How did we arrive at this point?

There are multiple interconnected worlds in the marvel universe as explained in Thor.

The Screeps world will be similarly fragmented although the worlds will still remain interconnected. How did we arrive here? Well lets take a look at how the developers describe the server architecture.

Key facts – (From Server Architecture Page)
The techs used on the server side are Node.js 6.6.0, MongoDB 3, Redis 3.
20k lines of server side JavaScript code.
Run-time computations are done in parallel on 27 quad-core dedicated servers on OVH using 108 x Intel Xeon CPU E3-1231 v3 processor cores (with respective number of node instances).
MongoDB runs on 24-core machine with 128 GB of RAM and handles 30k update requests per second.
Player run-time code is optimized to work in memory and does not make any hard drive or database requests.

So what does that mean? Well with the world now expanding in each direction 100 rooms we have almost 40,000 rooms. This means that there are thousands of requests every tick to the databases of which is increasing the tick each tick takes thus slowing down the speed of the game. In order to allow the Screeps community to continue to grow without continuous slowing of the game engine (And with it the satisfaction of the players) the devs are going to create the multiverse from Thor.

I hope that the Shards will allow the Screeps community to continue to grow and thrive. With the performance issues to some degree dealt with there will be more time for new features which we are all looking forward to.

Shard Mechanics and Info – (Forum Post)

Every shard is isolated from each other on the following terms:

Your script is executed on each shard individually and independently.
Your GCL and CPU limit will be allocated to each shard using the special section in the Overview UI (still in development; currently you have full GCL and CPU at every shard).
Console contents is broadcasted from every shard with the corresponding note in the console UI.
Memory is isolated; you have separate 2 MB of Memory and 10 MB of Memory Segments on each shard.
There is special RawMemory.interShardSegment that can be used for passing messages between shards.
Markets are separate. However, credits balance and history are shared between shards.
Terrain for each shard will be generated individually, but currently shard1 re-uses the original shard0 terrain for testing purposes.

Creeps can use special inter-shard portals in highway crossroad rooms to travel between shards in the same way as inter-room portals.
These portals are permanent and may be regenerated only when the world is expanded. Every creep loses time to live when using inter-shard portals:

  • 800 ticks for creeps without CLAIM parts;
  • 200 ticks for creeps with CLAIM parts.
  • This rule eliminates an abuse of using inter-shard portals to quickly travel in the same shard.

    Other Resources

    Optimizations Roadmap Post from Devs

    Share this post

    Share on facebook
    Share on google
    Share on twitter
    Share on linkedin
    Share on pinterest
    Share on print
    Share on email