Remove parsing of Memory per tick



  • Back when we had shared instances, we needed to parse the Memory every tick, because our script could have ran in another global context the last tick. But now we have IVM. The Memory doesn't need to be parsed every tick anymore. It would be enough to parse it only when after the IVM resets and keep it in global memory. Some of us have some code like this to do the same on shared instances and ivm:

        if (global.lastTick && global.LastMemory && Game.time === (global.lastTick + 1)) {
          delete global.Memory;
          global.Memory = global.LastMemory;
          RawMemory._parsed = global.LastMemory;
        } else {
          Memory;
          global.LastMemory = RawMemory._parsed;
        }
        global.lastTick = Game.time;
    

    But this shouldn't be necessary. A player shouldn't need to overwrite Memory and RawMemory._parsed anyways.

    So my request is: if using IVM then the Memory should not be parsed every tick anymore. It should only be parsed after an IVM reset. Of course it still needs to be serialized every tick, that doesn't need to be changed yet. As a result, there should be no advantage by using above code anymore.



  • I agree with this.

    I originally thought this would break the Memory tab, but after looking at the backend code, I think it would still work. When changing memory through the Memory tab, it actually just runs a console command that would still have access to the global.Memory object set in the code.


  • Dev Team

    This is a part of the 'persistent game' feature which already planned.



  • Awesome!


  • YP

    @o4kapuk any news on that ? last I heared from you was that it is much more complicated then expected, so I thought it was given up for now 😉


  • Dev Team

    @w4rl0ck still much more complicated than expected 😉 But it's in our todo list.