Over the last few weeks, I’ve spent a lot of time thinking about what I like and what I don’t like in my Screeps AI. Slowly but surely, I think I’m beginning to decide on a concrete direction to take the next rewrite. In the current version of the AI, I haven’t made any radical changes yet, but I’ve began experimenting with some new features, such as Directives, which represent a more advanced method of behavior modification, and automatic room planning.(For example, only the hatchery attendants should refill the hatchery extensions.) To more finely control which creeps can do what actions, allowing for dedicated creeps to attend to certain clusters, I added ObjectiveGroups and ResourceRequestGroups, which allow you to group together some subset of the operations that need to be done within a colony, so that only certain creeps will access them. I also added Objectives, which dispense tasks when assigned to a creep.
Although colonies greatly simplified the process of programming just about everything (instead of finding sources across multiple rooms filtered rooms, you can just say colony.sources), it added significant CPU overhead, so I added a more advanced preprocessing system to avoid doing duplicate searches in the same tick. So, I introduced Colonies to group together outposts operated by a single owned room and Hive Clusters to group creeps and structures with a similar purpose (for example, spawning structures in a Hatchery).
As I was expanding quickly, I needed a stronger and more flexible way to deal with objects across multiple rooms.
It also added Task objects to more concisely tell creeps what to do and when to stop doing it, and it added the first instances of behavior modifications and military capabilities, with flags functioning as injectable code snippets to modify the standard behavior.