Screeps game.rooms
Once they reach the exit and are in the next room I just switch the 'role' and 'task' stored in their memory. They start with the second room as target hardcoded and will then move to the exit. Especially in the beginning I found it very helpful to have a permanent stream of creeps moving from room 1 to room 2 and helping with harvesting energy, since without extensions you can only build very small creep that do not fully harvest energy fast enough. The only type of creep that needs special attention are those that move from one room to the next. Finding targets to get or drop energy for haulers, finding construction sites for builder or whatever, just use those room/position based finders and your code will run the same in all rooms. I use something like (FIND_STRUCTURES.Ī lot. Just make sure when you calculate any task targets based on the creeps position and room. Since by now I have only one spawn in my rooms (and all my rooms have a single energy source) that works good enough. They will then take their current room object and make all decisions based on that (eg instead of moving energy to they will use (FIND_MY_SPAWNS) RunTask() is a method I added to the Creeps.prototype. The creeps themselves are just looped like this: There are more such values in this data structure. That way I just adjust the level once a day.
#Screeps game.rooms upgrade#
That prevents that creeps upgrade one wall to a super high value before going on with the next wall. Maintenance area is the area in which the creeps should upgrade walls (a bit specific to my rooms) and min_wall is the level to which they should upgrade (My older room with better walls is at a higher level). As a total beginner myself I found the following things helpful (mostly because that was what I had to change when I invaded the first room):Īvoid using anything like 圜ontroller, instead loop over the rooms like: for(var room_it in Game.rooms) ,