findPath from a border adjacent to a swamp returns an empty path



  • Game.rooms.E27S3.findPath((new RoomPosition(28,0,'E27S3')),(new RoomPosition(24,15,'E27S3')),{maxRooms:2,maxOps:500000}) == []

    Game.rooms.E27S3.findPath((new RoomPosition(28,0,'E27S3')),(new RoomPosition(24,15,'E27S3')),{maxRooms:1}) == a valid but inefficient path through the swamp

    Game.rooms.E27S3.findPath((new RoomPosition(29,1,'E27S3')),(new RoomPosition(24,15,'E27S3')),{maxRooms:2,maxOps:500000}) == a valid efficient one-step path northwest towards E27S2
     

    When there is a border adjacent to a swamp, something is going wrong in findPath, causing it to return an empty path rather than a path through the swamp or along the border. I have raised maxOps to a ridiculous number just to be sure that every tile in both rooms can be checked. Game.cpu.getUsed tells me that these attempts take about 0.5CPU, which the docs say is about 5000 ops, which is the right amount to consider every possible space in two rooms. The first example above should return a one-step path with a westward move, I think.

    This is probably the same problem reported in these previous threads:

    http://screeps.com/forum/topic/1045/strange-pathfinding-result-?flash_digest=c60298f7567590a9007389926b168715f949edcd

    http://screeps.com/forum/topic/751/ERR-NO-PATH-when-changing-rooms



  • confirmative. 

    Unbelievable it's still not fixed 😞 


  • Dev Team

    The Room.findPath method only returns the path segment which corresponds to the current room. If it has an intention to change the room, then it will end on the room border. If you are already on the border, it will return an empty path. It is why you see an empty path with maxRooms:2 or a valid path with maxRooms:1.

    If you want to see the full path spanning all rooms, use PathFinder.search instead.



  • @Artem in the given example, the creep should move along the border, not stand still, even in the destination room. Also, in the other room, the creep should find a path west or northwest. It does neither, getting an empty path there, too.



  • If more thorough examples and test cases would help get this bug fixed, I would be willing to put them together.


  • Dev Team

    If more thorough examples and test cases would help get this bug fixed, I would be willing to put them together.

    Sure, this always helps.