Skip to content
Warren Earle edited this page Jun 23, 2016 · 1 revision

This will be notes about how optimisations can be made. I will try to expand them later

the cpu ticks can be monitored during the game

Each API method that changes the game object state (like move, transferEnergy, createCreep etc.) will consume exactly 0.2 CPU rather than zero usage before. The CPU cost of such methods will be marked as CONST in the documentation. I. e., it will look the following way:

var startCpu = Game.getUsedCpu(); 
creep.move(LEFT); 
console.log( Game.getUsedCpu() - startCpu ); // 0.2 
creep.transferEnergy(spawn); 
console.log( Game.getUsedCpu() - startCpu ); // 0.4 

Adaptive Algorithms can be used to make decisions about what CONST cpu tasks for example: whether to spawn new creeps.

The algorithm making the decision should only use LOW CPU methods the methods used based on the algorithms' decisions can use CONST cpu methods

Clone this wiki locally