Optimizations roadmap


  • Dev Team


  • Culture

    I'm a bit concerned over the sharding plan, particularly with the different tick times and separate code running on each shard.

    Have you guys considered sharding based off of data types instead of rooms or worlds? Put creeps on one database, structures on another, user data (code, memory) on a third? This would split load without having to split worlds.

    Another thing is sharding off of primary key. you're already using UUIDs for game objects, so distributing in that way should be possible.



  • This could be very exciting. I may even go back into, "Here just take my money" mode. If the new VM changes actually give me control over my own CPU usage and the tick rate becomes "normal" again.


  • YP

    All this stuff sounds very interesting 😉

    Will the isolated vm module made available for private servers ? 

    I can't say much about the shard and database stuff because I can't really think about how that will work out with top lists for example .. and how different tick rates might affect the balance... 

    I'm not really a fan of mongodb .. it has been a while that I used it and it might have changed.. but as far as I remember it was not really the fastest database mit many unnecessary network trips for error handling for exampel.

    I have seen benchmarks of postgres jsonb storage beeing faster in storing and manipulating json objects then mongo and some data would also fit to be stored in relational tables.



  • Last time I used mongoDB (ditched for the same reason) it was really good as storing text gibberish, and rubbish for anything else. Maybe mongo is good because of the serialized memory and the code storage. But it was really quite slow on normal stuff back when I used it last.


  • Dev Team

    Have you guys considered sharding based off of data types instead of rooms or worlds?
    Another thing is sharding off of primary key.

    Not only considered, but even tried and benchmarked in production.

    Will the isolated vm module made available for private servers ?

    I hope so.

    I have seen benchmarks of postgres jsonb storage beeing faster in storing and manipulating json objects then mongo and some data would also fit to be stored in relational tables.

    We did benchmarks of Postgres JSON and JSONB storage on our workload profile - it doesn’t provide any significant performance increase in multi-threaded environment compared to WiredTiger in MongoDB 3.2+ with document-level locks.


  • Culture

    > Not only considered, but even tried and benchmarked in production.

    What happened, why was this abandoned?

    I just feel that there are ways to shard the database without requiring complete different worlds with their own separate tick times. Divergent tick times make things a lot more complicated, and not in a good way.


  • CoPS

    I am concerned with sharding for a few balance reasons, e.g.;

    • Depending on accessibility, players on a faster shard get an advantage over players on a slower shard. If a portal is open, the player on the fast shard can mine more power, harvest more energy and spawn more creeps than a player on the other side, giving a serious advantage. 
    • It adds another player of complexity for smaller players to overcome when setting up multiple rooms / spread rooms.
    • Presumably respawn zones will often be in shards, to drive players off the main shard to decrease tick times - how much will this stagnate the main map? 

     

    Otherwise seems cool. 

     


  • int_max

    I'm not so keen on the shards system, how will subscription work between them you said they could have differing CPU limits. It could split up the game.

     


  • AYCE

    One of the aspects that makes Screeps such an interesting game in the single world. Much like Eve online it creates a political environment that is exciting. I'm concerned sharding the game will fracture this, and lessen the overall political scene in the game.

    I'm interested to see how this idea develops, but really I hope you figure out a way to shard the game without separate worlds.


  • Culture

    Since it's gotten lost in the discussion about the shards I did want to jump in and say that that the other items look absolutely fantastic.

    I think the new VM solution is great, and I can't want to no longer have to deal with bad nodes and other performance issues (with the added bonuses of our state moving around from node to node).

    WebGL is also super exciting. I've seen some great demos that looked fantastic and performed beautifully. This upgrade is going to be great.


  • Culture

    The new VM ideas are amazing! One single global will surely lower the tick times as well.

    For example:

    • It could save the CPU used on the Memory serialization, which is about 4% of my overal script times (higher in global reset ticks)
    • It can easily terminate misbehaving players, or
      • Omit them if they don’t finish in a certain amount of time
    • Keep static game objects the same every tick evading
    • Avoid having to do register.wrapFn for every method declaration

    I think there are a lot of other things that would make life easier if we get t keep the exact same global across ticks.

    World shards are quite an interesting idea. I imagine them being a building which can transport creeps to another planet. The success of it depends gravely on it’s implementation. We could be able to build “portal hubs” but only 1 per player (globally owned structure). I don’t think “random portals to another shard” is a good idea.

    It could also heighten the CPU-cap per player again!
    We would only be able to user 300 CPU per shard, if your GCL is above 27 you have no choice but to expand to a different zone.

    The CPU limit for each shard can be set on a special page

    If we’re going this way, allowing script access to these things is vital. I’d love to see a more thought-out plan quite soon. No need to speculate on how the memory will be saved in different shards.


  • SUN

    What are your plans for the existing world should 'shards' be implemented?

    I understand it will depend on the implementation, but is the world going to divided up or reset? (Or neither? (Side by side with a mass migration? that'd be cool))


  • Dev Team

    What happened, why was this abandoned?

    I just feel that there are ways to shard the database without requiring complete different worlds with their own separate tick times. Divergent tick times make things a lot more complicated, and not in a good way.

    Believe me, we tried all kinds of good and black magic regarding classic database sharding. It just doesn’t provide the desired level of scalability in comparison to this architecture shift. We are quite positive that world sharding is more correct way to implement horizontal scalability than database sharding.

    Depending on accessibility, players on a faster shard get an advantage over players on a slower shard. If a portal is open, the player on the fast shard can mine more power, harvest more energy and spawn more creeps than a player on the other side, giving a serious advantage.

    This is a temporary issue. Eventually shards will become self-balanced, when more and more players would want to benefit from the faster shard, making it slower and the old shard faster.

    It adds another player of complexity for smaller players to overcome when setting up multiple rooms / spread rooms.

    We predict that only a few percent of players will be up to establishing cross-shard colonies.

    Presumably respawn zones will often be in shards, to drive players off the main shard to decrease tick times - how much will this stagnate the main map?

    Both respawn and novice areas will still be created at every shard.

    One of the aspects that makes Screeps such an interesting game in the single world. Much like Eve online it creates a political environment that is exciting. I’m concerned sharding the game will fracture this, and lessen the overall political scene in the game.

    I’m interested to see how this idea develops, but really I hope you figure out a way to shard the game without separate worlds.

    The world is still single, just consists of connected shards. Eve Online is actually a great example of this, since they implemented the same idea of different game speed in different regions of space - so called “time dilation” mechanic.

    We would only be able to user 300 CPU per shard, if your GCL is above 27 you have no choice but to expand to a different zone.

    CPU limit is per account, not per shard. Say, if you have GCL 28, and 100 CPU allocated to Shard1, then you have only 200 CPU in Shard2.

    What are your plans for the existing world should ‘shards’ be implemented?

    The existing world will become the first shard. Nothing else will happen to it.


  • Culture

    > I imagine them being a building which can transport creeps to another planet. The success of it depends gravely on it’s implementation. We could be able to build “portal hubs” but only 1 per player (globally owned structure). I don’t think “random portals to another shard” is a good idea.

    I actually think that the new shard should be easier to get to than that, and that the entry/exit points should be in neutral rooms (perhaps in the same rooms as the NPC terminals). If the other world is going to have higher tick rates then people on the old world are already being punished- making it harder to access the faster world is just salt in the wound. 

    I really think the shard idea would be easier to deal with if the tick rates and time were kept close together, even if it does mean throttling the new shard when it gets too far ahead.


  • Culture

    > We predict that only a few percent of players will be up to establishing cross-shard colonies.

    > The world is still single, just consists of connected shards.

    What it sounds like is that the world will in theory be a unified world but in practice will actually be separate worlds.

    > This is a temporary issue. Eventually shards will become self-balanced, when more and more players would want to benefit from the faster shard, making it slower and the old shard faster.

    The old world has a lot of baggage- zombie players on 10cpu, or just somewhat inactive players who don't mind paying but also don't do anything. I don't think relying on it eventually balancing it out is the best way to handle it. New players will naturally spawn to the new server but older players (the ones who have supported the game the most) have established themselves and many of them will not make likely make the jump. I don't think the shards are likely to balance out soon.

    I think the sharding idea can be a good mechanic, but I really think that the "single world" concept needs to be embraced. To me that means tick speeds mostly synchronized (there can be variation, but it should average out to about the same) and easy travel between worlds. In my mental model of the screeps world I'm viewing shards as another dimension- a Z axis to go with the X and Y (or in this case north and south) and would like to see "elevators" in all the highway intersection rooms for going between levels.


  • int_max

    So, how shall the market work between shards?


  • Dev Team

    The old world has a lot of baggage- zombie players on 10cpu, or just somewhat inactive players who don’t mind paying but also don’t do anything.

    Scripts of players without subscription stop working after 30 days of inactivity (no log into the game during 30 days).

    I don’t think relying on it eventually balancing it out is the best way to handle it.

    If it doesn’t balance itself, then we’ll start to balance it manually. Eventually our goal is to provide lower tick rates for all shards.

    In my mental model of the screeps world I’m viewing shards as another dimension- a Z axis to go with the X and Y (or in this case north and south) and would like to see “elevators” in all the highway intersection rooms for going between levels.

    Exactly, you got the idea of it. I can’t tell for now where those portals will be located, but what I can tell is that they will be neutral, and there will be plenty of them so that everyone can access. Inter-shard portals can be considered just another type of inter-room exit tiles. As long as all interested players can easily move back and forth, it remains the same idea of a single world consisting of isolated game zones (rooms/shards).


  • YP

    > So, how shall the market work between shards?

    They would be seperated... otherwise the economy of a new shard would already broken from the beginning 😉

    > I really think the shard idea would be easier to deal with if the tick rates and time were kept close together, even if it does mean throttling the new shard when it gets too far ahead.

    But the lower tick rate on the new shard is one of the only things I can think of why you would want to spawn on a new shard.

    > The world is still single, just consists of connected shards. Eve Online is actually a great example of this, since they implemented the same idea of different game speed in different regions of space - so called “time dilation” mechanic.

    It's a bit like apples and pears ... the time in eve online is only slowered in the star systems where currently a big combat is happening ... it has no impact on the econoly... and it is one of the most hated systems in eve online 😉

    It more reminds me on a mmog I played several years ago .. I currently don't remember the name. players and guilds could create villages and build cities and one of the features was that you can move your guild to other servers. Later there were guilds that were not interested in building cities but to only move from server to server and destroy others stuff 😉


  • Dev Team

    So, how shall the market work between shards?

    They will be fully isolated. But you can start doing some import/export shenanigans between them, might be quite interesting way to raise some credits 😉