![screeps cpu screeps cpu](https://cdn.akamai.steamstatic.com/steam/apps/883940/capsule_616x353.jpg)
#SCREEPS CPU HOW TO#
And then i don't know how to go further in order to know where exactly a big amount of certain calls come from. It sounds less efficient to me, but i'll give it a I have Screeps-Profiler, but i just know how to (xxx). Load energy from nearest container or storageĪs you suggested, i'll try yo rewrite as many code as i can to have my creeps choosing a task and not wondering about anything until they finished it. If i can't and i still have room available if i carry 0 energy -> i'm emptyĮlse if i carry all energy i can -> i'm full
![screeps cpu screeps cpu](https://i.ytimg.com/vi/LkXuGcrCZtU/hqdefault.jpg)
Consider looking for a way to save the "task" they choose so that after starting to do something, they can keep working every tick without as much CPU usage.Īs an example, my "refillers" (which purpose is to transport energy while other creeps dropmine) do. Good a lot of new players have their creeps "reconsider" what to do every tick. All my creeps now use if((source, 1)) creep.harvest(source) instead of the error checking it did before that would call the command everytime. Carts would attempt to transfer if they weren't in range. Harvesters would try to harvest if there was no energy or it wasn't in range. My Creeps were taking up the mass majority of my CPU though. I also would fill up a spawnQueue with everything I needed, but my spawns could only do one at a time, so now my spawnQueue calculations end as soon as I've found one creep that needs to be spawned and it can be spawned. What I did is I went and put () everywhere.I would get the amount before the command or method and then get the CPU afterwords to find out where all my CPU was going.įor instance, I found out that _.filter commands took more cpu than just room.find() commands.
![screeps cpu screeps cpu](https://www.jonwinsley.com/assets/screeps-9-27.png)
My rooms do about 3-5 CPU per, with remote harvesting about 1 CPU per room. I tried looking through the code, but with no comments I honestly don't know much about what's going on.