Creeps got stuck - what can i do ?



  • Some of my creeps got stuck at a small corridor.

    What can i do to move them further.

    Seems like they are blocking each other.



  • Link/picture? Hard to tell what you mean. In general, you can have creeps swap locations by having them move at each other.



  • Creeps can move past each other, but Creep.moveTo will not try to by default. The simplest solution is adding the ignoreCreeps option, but that has other other disadvantages. Traveler.js is a good example of improving on moveTo. You can use it as is, fork it as a starting point for your own movement code, or as inspiration for your own.



  • 0_1560475642689_af385e96-4981-4727-b5cc-9bd88145b4d8-image.png I suspect this is him here. Creeps cannot be on the same tile at the same time. That's really their only rule in this regard.

    Your first problem is the creeps that got energy from the source aren't trying to move away from the source. Make them move! If you don't use same variant of move (Like 'moveTo(destination);') it won't try to continue it's journey.

    your second problem is you have way too many creeps in there. Make less creeps! With less creeps, it will be more clear why they aren't moving away from the source.

    Creeps swapping places: What actually happens is each creep jumps from tile to tile, like a chess piece.They don't have a 'collision radius' and propagate from place to place. If the move was probably legit when the creep.move(dir); (It always distills down to that call.) call was made, it returns '0' and registers the 'intent' to jump to that tile. If the simulation can move the creeps when it runs, the creeps jump to the next tile. On the client, they are moved smoothly around, so it looks like they go through each other.