[quote:1myzoiiz]so it is any better way to regenerate pathfinding obstacle map?
Unfortunately there aint
Which make games like the one you want to make kind of useless with the path find behaviour, its simply not fast or effective enough to handle such thing without lagging. However there might be some work arounds. However I haven't tried them, so they are just ideas.
One way would be to try to use a tracker so you actually only update the obstacle map for this single object and then you use its data to control the monsters. Assume that you don't use tilemaps?
It would go something like this:
1. Regenerate obstacle map for tracker.
2. Move tracker to each monster and find path to where it should go and then copy the path to the monster.
3. Let monster move the path.
Whether that will solve the problem or not im not sure.
Another way which also uses a tracker object, but would be the only one with path finding behaviour and it should then "paint" the path for the monsters to follow. So the monsters themselves doesn't have path finding but simply react to whatever direction they encounter painted by the tracker.
It would be something like this.
So each of the small arrows are the nodes that the tracker have found when it calculated the path. So for each of these nodes you spawn a Sprite which have a direction (Left, Right, Up, Down) and when the monsters hit them they change direction, So it will look like they are finding a path. However it might sound easier than it is, because if you block the path you have to recreate it from the blocked path etc. But think it could work ok when it comes to at least solving the lag from doing path finding on all monsters.
But again I haven't actually tried any of the solutions my self, so they might not work at all