Used CPU gets rounded up to whole numbers, which penalises cross-shard bots and makes bucket-regen impossible at 1 CPU assigned



  • It seems as if at the end of a tick, the used CPU is rounded up to a whole number. So in practice we get up to 1 less CPU per tick than expected (average 0.5). If your code is spread across multiple shards, you suffer more from this effect than someone who exists only on a single shard.

    This means that running on a single shard becomes the optimal and most efficient way of running a bot, which I would suggest is not in the best interests of the game/community.

    Additionally, this makes it impossible to assign 1 CPU to a shard, because even if you do almost nothing on a tick, your CPU will be rounded up to 0 and your bucket will never be able to recharge after a global initialisation (which always takes a relatively large amount of CPU).

    https://github.com/screeps/driver/blob/ecb3f12e20e120ea9845e00c385367e4fc704354/lib/runtime/runtime.js#L244

    Because of this, I think the remaining CPU should be stored as a float not an integer.



  • It's a pretty simple change, but I fail to see how this really has an effect.

    A player on all 4 shards is loosing an extra 1.5 cpu per tick. For a GCL28 player this is 0.5% of their cpu.

    For a more reasonable 10GCL players this is 1.25% of their total CPU.

    For a 20 CPU player the loss is more problematic at 7.5%. But a 20 CPU player spread across all 4 shards is pretty extreme. 2 shards seems more reasonable 2.5%.

    I suspect the great majority of players aren't at the optimization level where 1 or 2 % either way is game changing.



  • This is a game about optimisation. 0.5% is massive! I'm sure you can imagine how having 6 more creeps at once could benefit your bot.

    👍


  • Talking in absolutes losing 0.5 CPU per tick in theory could be translated to 2 intents with the rest of the cpu lost to script/creep overhead. So not 6 more creeps but 2.

    I suppose looking from the point of view of squeezing out as many intents as possible loosing 2 could be enough to care.



  • 0.5 CPU (on average) per shard.

    So best case you're on one shard and lose 0.5 CPU. Worse case you're on 4 shards and you lose 2 CPU, which gives you the 1.5 CPU penalty, enough to run 6 ish creeps across the 3 extra shards.



  • The other major problem with this is that it means you can't assign 1 CPU to a shard, as the bucket can never regenerate even if you do almost nothing in your tick.