raise the 1mb limit on code



  • I'm entirely with you on the stack trace part. I don't minify my code either and have an eslint rule to have all functions named just for clear traces. I suppose I'm just surprised.

    To be honest, I don't have anything comparable to your AI's structure/behavior. My old AI (Andromeda) was built on different principles and had 12k lines (400kb) in production. The new AI (Hydra) is still quite young and only has 7k lines (250kb). It will probably grow to some 20k lines, but I don't expect something above that.

    Your AI is one of the most advanced I've seen. You're probably the first to hit the memory limit "naturally". If you check this thread, you'll see that when people were getting to 1mb it was by importing external dependencies such as newer lodash.

    A few years ago we were doing polls for code sizes and the most advanced code bases were still only around 20k.

    I must admit, I'm glad to see AIs like yours that have reached such level of complexity that they actually touch the memory limit.



  • I think, a bit like Tigga, that the code limit of 2MB is really low, particularly with the feature set (power creeps, event logs, tunnels) getting bigger and bigger. With my workflow atm (sometimes when not at home is use browser access), it would be a pain for coding to minify the code (shortest variable names etc.) I try do automate everything too (code runs bot-like), and - while way behind Tiggas bot abilitys - i am already at 1.2MB and i have nearly no combat code (enemy tracking/some calculation and some simple operation, but nothing like automated room attacks) and many things need to be looked at/optimized as i coded them in a hurry, cause my rooms grew quicker than my understanding of the gamemechanics. Additionally, i use no libs or likewise (all kBs are just code). My base layout - for beeing flexible - is alone 2000 lines (which takes100kB Code-space) without some extern functions for min-cut /wall rampart finding). I am "only" playing screeps since about 9 months, but as i have also a family etc, i have not always that much time for it; still i see my code getting nearer to the limit of 2MB. I do not think that i can get every missing feature (long to do list still) and all new ones into that limit. As far as i see, advanced military will need tons of lines.



  • Right. I'm probably going to be fine on 2MB for a little while longer. As soon as power creeps drop, however, it's just not going to work for me. I'd probably have to give up on stacktraces and run minified, which kinda sucks 😞



  • Some people were poking through the open source driver code and it seems that the user code is sent to the runners every tick: https://github.com/screeps/driver/blob/master/lib/runtime/data.js#L113

    I don't know what the full pipeline for user code is, but if this was changed to only send on code update this seems like it may save a lot of resources and allow for larger codebases.

    ☝


  • yeah, the runners should know whether they will need to perform a global reset on the next tick before pushing their updates to the DB. if it were to add a REQ_PLAYER_CODE flag or something, then the DB would only need to push the code to the runners once per global reset, not every tick, reducing a crap ton of the bandwidth which was one of the initial arguments against raising it 2 years ago. If the DBs are the limiting factor for tick times, then not requesting and sending code for every player every tick should be a major boon to tick times too...



  • Bumpity bump. Is this something that can be improved in the engine code?