You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I'm using this in a game I'm working on (in Crafty.js) and have it working so that enemies follow the player. The problem is that they all choose almost the same path depending on where they are, resulting in them stacking on top of each other. I've tried recalculating the graph every time an enemy movies, and in turn recalculating the paths for each enemy. That somewhat worked, but ran pretty slow.
How would you suggest going about this?
The text was updated successfully, but these errors were encountered:
Danny,
It sounds like you are already calculating the best path for each individual enemy, but the slow part is refreshing the map in between each calculation. What if instead of rebuilding the whole map, you just updated the old/new spots for the previous enemy? After each pathfinding search, if the enemy moves, then mark his old spot as now 'open' and his new spot as now 'closed' and pass this new map into the next search. Would that take care of the problem?
Oh, and if you want to share a link to your game when you finish it up, I'll post it in the project.
This isn't so much an issue as a question. D:
So, I'm using this in a game I'm working on (in Crafty.js) and have it working so that enemies follow the player. The problem is that they all choose almost the same path depending on where they are, resulting in them stacking on top of each other. I've tried recalculating the graph every time an enemy movies, and in turn recalculating the paths for each enemy. That somewhat worked, but ran pretty slow.
How would you suggest going about this?
The text was updated successfully, but these errors were encountered: