Creeps Unwanted Suicide



  • My creeps keep committing suicide when trying to destroy walls in enemy territory. Game.time = 11501703 in the middle of the time it was happening in room W19S38. Here is the script for my brutes(the creeps in question) http://pastebin.com/rX04sQtm and here is my "main" script http://pastebin.com/Nq8v3jx7. I have no idea why this is happening, and I have discussed it with others on slack who also had no idea as to why this is happening.

    Look forward to hearing from you,

    James



  • Sorry, need to correct that to teleporting not suicide.



  • Another observation, only happens if creep is near to an exit.



  • it's hard to guess without seeing your log, but it looks like some sort of pathfinding issue in combination with a race condition. Whatever the target is that creep found, apparently the fastest path towards that target would be by leaving the room and reentering it somewhere else (probably because of all the swamps), hence why the creep steps outside; but the moment he is outside the room, your first few lines kick in - he won't find a target anymore, and without a target he'll move to the rally flag instead, which I'm assuming is inside that room. So he steps back in there, only to find the same target again, stepping out trying to reach it, ....

    You might wanna store target's id in memory instead of looking for it every tick - it'll not only solve this issue, but also help a lot with CPU usage, cause finding stuff with paths, and pathfinding in general, is extremely expensive.

     



  • I know about the pathfinding and constantly looking for targets issues but I have not had a problem with CPU yet, so it's on my todo list but not a pressing concern(also not the same logically so that will need some thought). Also my creep does move towards the target(which for debugging I set by ID so it does not solve this issue) but when it is in range for dismantling it does not move towards the exit and leave, it goes instantly(maybe that is correct behavior but it is worrying). Also there are no swamps between it and the target.



  • Update: It is not using the flag to get back into the room.



  • Fixed the issue, was not ordering walls by range. But I get a lot of problems with inter room travel, like my creeps will try to go through a room with protection, have you got any advice?