Good news screepers!
We have redesigned some architectural solutions in the engine that executes your scripts inside the game. Here are some of the improvements you can notice starting from now.
Non-blocking exceptions. Many of you have asked that the console output be visible even when the script throws an exception. This is convenient for debugging and tracking the moment the error occurs during the execution of a script. It is possible now - script execution errors don't block either the console output or the game commands execution! In other words, all the commands that were fixed before the occurrence of an error will be executed:
Game.creeps.John.move(LEFT); Game.creeps.Michael.move(LEFT); throw new Error('error!'); Game.creeps.Bob.move(LEFT);
Creeps John and Michael will successfully move to the left in this tick despite the thrown error.
Note that this even refers to the error of CPU limit exceeding. Thanks to it, you can now arrange priorities of your creeps logic so that the most important actions perform in the beginning of the script and don't risk being unexecuted due to the lack of CPU resources.
Persistent global scope. Previously, the sandbox scope for your scripts execution was created from scratch every tick. It allowed safe isolation of the script but wasted some CPU per tick. We found a way to circumvent this. Now the scope is recreated only from time to time, while the majority of ticks of your game script execution use the same global scope. According to our estimates, it will save about 10-40 CPU for each player. Besides, there is a keyword
global now available in a script which affects some outside scripts and compilers.