bencbartlett / Overmind

AI for Screeps, a multiplayer programming strategy game
MIT License
545 stars 155 forks source link

fillers of "BootstrappingOverlord" get stuck at filled extension #196

Open YukkuriC opened 3 years ago

YukkuriC commented 3 years ago

Issue summary

Description of issue:

When a colony of around RCL4 enters a bootstrap mode, the filler generated will only fill 1-2 extensions once the whole AI module is rebuilt.
I've met this twice: at RCL6 (died at last), and RCL4) (made some changes, including "say something when calling set Zerg.task", and was saved with the quick fix)
In the files (master & dev), the arrays of valid energy sources/destinations only get filtered once the BootstrappingOverlord object gets constructed, and is assigned to the fillers according to the distance. Therefore, once an extension is filled, the filler will be kept in a loop:

  1. get the same full extension by filler.pos.findClosestByRange
  2. get a new Tasks.transfer(target)
  3. the task is invalid because the target is full
  4. filler zerg isIdle again
  5. go back to step 1 until global reset

Steps to reproduce:

Just go into emergency recovery mode, and watch the filler step once for several ticks - maybe keeping spawning invaders or making all creeps suicide will work? Once a filler carries some energy and try to fill a filled extension, it won't move again.

Error message:

Nope, everything goes exactly what the code says. It's an issue of code logic.

// Offending lines:
// src/overlords/situational/bootstrap.ts

Suggested fix (optional):

I've made a quick fix about this bug: only fetch all possible structures in constructor(), and call the filters at the tick which one of the fillers is idle. the PR is on the way.

Other information:

YukkuriC commented 3 years ago

Maybe a more severe issue is "what caused these emergency bootstraping situations" - maybe some deadlocks in logistic network? have no idea how to reproduce this, though.