Screeps AI: State of the world at the beginning of 2023

Posted by Argha Sen on January 15, 2023

The Screeps OS I had been writing has been writing in the previous part was good enough to deploy at the beginning of October. The nascent AI began with a new spawn and slowly started to gather energy. Quite a few bugs in the OS came up and as fixes rolled in, the stability improved. The OS doesnt add much benifit to the AI yet, which is something I hope to improve in future.

The AI itself is fairly autonomous till RCL3. Its not efficient but does a decent job till RCL3. Beyond that it is dependent on manual input for all buildings. Once the construction sites are laid though it manages to build them and use them.

Logic overview

General Economy

The AI logic is very simple at the moment. It starts off with generic moving harvesters at the beginning and then moves to Continuous harvesting. The harvesters are using drop mining at the moment so the maximum efficiency of energy mining can be 90%. In practice it is about 78%. After drop mining starts, haulers, builders and upgraders are created and they just are the same creep structure but run different role code. Each Room runs about 8 upgraders, 4 haulers, 4 builders and 2 harvesters with a creep count of 18. This takes about 6 CPU per room so the AI is almost using 17-18 CPU for the 3 rooms. There is not much potential for growth in this AI.

Defense

We are using a passive defense at the moment. We have towers which shoot the enemy as soon as they are in the room. Again not the most efficient but keeps the creeps safe. A few creeps die though everyday if they are close to the enemy.

Storage

Storage is not very efficiently used. The only good use is a container near the upgraders who pick energy from it reducing movement. There is a lot of potential for improvement in this part of the AI.

Claiming New Rooms

I had reached GCL3 in the previous iterations of the AI so claiming rooms was something I could do. Claiming is a manual process with a flag called “claimThisRoom” and the spawns creates a claimer. The claimer than walks over and claims the controller. After that Spawn is created with a builder being sent from the nearby rooms. There are a few bugs in this but works well enough that I was able to claim 2 new rooms by mid november.

Performance

The 3 rooms are fairly stable and at the time of writing in mid January all of them are at RCL7. Our GCL is up to 6 so we can pick 3 more rooms when our AI improves.

The results of the last 3 months in the leaderboard are below:

Leaderboard

December 2022, was the best month so far for us, with the rank of 388 with 18.5m control points. The code upto this point is here.

Future Plans

In the next iteration, we would love to work on the following parts of the AI:

  1. Get room CPU usage down to 5 so we can pick up our next room.
  2. Use of specialised creep body structures for efficent energy usage
  3. Improve towers to be able to repair.
  4. Improve to Container Minining and if possible to link mining.