Code doesn't necessarily run on other shards after creeps enter inter-shard portal



  • Maybe I did a bad:

    Sent creeps to a shard where I have no CPU? Allocate CPU to shard where I have no creeps? Broke the RawMemory.interShardSegment on shard where I have no CPU?

    I was refactoring at the time all this happened, but it also, as far as I can tell, caused a major oopsie with my RawMemory.interShardSegment



  • @SBense has experienced the same thing and it seems that if you upload your code after a creep has been through a portal, that is enough to get the code running on the other shard.


  • AYCE

    Right, I found that if I have CPU dedicated to a shard, but no assets currently present on the shard, the code would not run until a creep had arrived and I re-uploaded the code. After that, as long as assets remained on the shard, the code would run as expected. If the assets were lost on the shard, the code would shut down and I'd have to jump start the process again with the next arrival. Otherwise, I think you'd be at the mercy of random code resets to get the code running again. I also had to delay creep memory writes from the intershard segment by a tick after the jump start or the memory write would get lost, but that could just be poor implementation.



  • Is there a minimum amount of CPU you need to have allocated to a shard in order for the code to start running when a creep goes through the portal?



  • @wtfrank Even with zero CPU allocated to a shard, you should still have a CPU bucket that you can draw from. However, if you have zero CPU allocated to that shard, the bucket will never grow it will only deplete.



  • I had the same issue. I am based on shard2 and decided to use the portal to shard1 to have fun. I relocated 10CPUs to shard1 and transported a creep there. However, I could not call the creep by its name Game.creeps.xxx, neither was I able to get any responses from the game's console. Whatever I typed in the console would not give any feedback. Later on, someone told me to go back to shard1 (the new shard for me) and save my code again. By doing this, my codes got executed in the new shard. So it seems that you need to save your code on the new shard in order to activate it.


  • Dev Team

    The hotfix has been just deployed addressing this issue. Now your code on the other shard should be activated immediately after the creep is moved. Please report if you still experience any problems with this.

    👍


  • My code started running on shard1 within 11 seconds of a creep going through a shard2 portal. And yesterday one went through and the code took 8 seconds to start running. It's looking good!

    Only 569 creeps were harmed in the testing of this feature 🙂

    2018-08-22 15:39:02 shard2: Inmate-806945-exp explorer [room E40S30 pos 43,26] 951ttl About to enter inter-shard portal to shard1 E40S30

    2018-08-22 15:39:06 shard2: Inmate-806945-exp explorer left this shard for another: shard1 with ttl 951

    2018-08-22 15:39:06 shard2: ISM sent message 569 to shard1

    2018-08-22 15:39:17 shard1: New code uplodated

    2018-08-22 15:39:17 shard1: tick skipped - we went from 11076763 to 11089474 a jump of 12711. bucket is 9347


  • Dev Team

    @wtfrank Could you please specify, it was 11 seconds after a creep went into the portal, or after it appeared on the other side?



  • @artch creep gave intent to enter the shard2 portal at 15:39:02. The following tick 15:39:06 it was gone from shard2.

    The first evidence I have of my code running on shard1 is at 15:39:17. However I wasn't watching the room when this happened, so I don't know the timing of when the creep appeared on the other side.

    (The bucket was at 9347 on the first tick that my code ran, but the bucket was at 9350 on the final tick that it ran several hours before - I have only 1 CPU assigned to the shard, so the bucket is recharging slowly).

    I will have a look out next time a creep goes through so I can give you an accurate answer of when the creep appears and when the code runs.



  • OK I sent a creep through another portal. The code started running the tick after the creep appeared on the other side.

    The creep sends the intent to move into the portal at tick 8875926 at 23:51:41. The creep disppears on tick 8875926 and shows TTL 1351 https://screeps.com/a/#!/history/shard2/E30S30?t=8875926

    The creep shows on the other side at tick 11097888 with TTL 548, but the code doesn't run until tick 11097889 at 23:51:56 https://screeps.com/a/#!/history/shard1/E30S30?t=11097888

    So in my opinion, the creep goes into the portal on one side, takes about 10 seconds to travel through the ether, which is no big deal. During this 10 second period, 3 ticks of it's life tick down (which correlates with either the shard1 or shard2 tick rate). It then appears on the other side and is inactive for one tick, before the code starts running the following tick.


  • Dev Team

    @wtfrank This is exactly per design. Transporting the creep may take time, but code should be executed immediately when it is transported.



  • good so it's all working well 👍