bencbartlett/Overmind

Scouts stuck when there is no way to pass a room

ykozxy opened this issue · 2 comments

Issue summary

Description of issue:

When scouts try to pass a room that is impassable due to obstacles, they would be stuck and hang around at the same place. Probably due to continuously recomputing the path, CPU usage skyrockets about 25% (shard 3) during the process and eventually consumes all the bucket. (I have to kill the scouts to prevent this manually)

Steps to reproduce:

The room replay: https://screeps.com/a/#!/history/shard3/E17S38?t=8174724

The issue occurs on the upper left corner of the room when the creep cannot move to the exit at the lower right of the room
Snipaste_2019-06-30_10-39-27

Error message:

// Console output:

// Offending line:

Suggested fix (optional):

Maybe scout should stop recomputing the path and exit the room (or stand still) once it finds it cannot pass the room

Other information:

  • Overmind version: 0.5.2
    • Commit hash: {optional, but helpful: include the commit hash (if known)}

i had the same error, when i set the log level to 4 i got this:
[1:51:39 AM][shard3]DEBUG 12288587 Movement: incomplete path for [scout_4]! ([E7N19, 43, 4] ⟶ [E8N20, 25, 25])
[1:51:41 AM][shard3]DEBUG 12288588 Movement: incomplete path for [scout_0]! ([E7N19, 45, 5] ⟶ [E8N20, 25, 25])

scout error

I have bisected the problem to

if (Game.map.isRoomAvailable(roomName)) {

which it tries to travel to a room where no path could be found.
dirty hack fix this issue(temporary), but it breaks the assumption of 2D random walk, so it might not drift away from origin and have probability to reach anywhere

            if (Game.map.isRoomAvailable(roomName) && scout.room.findExitTo(roomName)>0b&& scout.creep.moveTo(new RoomPosition(25, 20, roomName))>=0,{maxOps:100}) {

p.s. it also solve high cpu usage of scouts when no path is find