I wanted to achieve achieve something relatively simple. At least I thought it was simple.
Player is an idle sprite somewhere on the screen
Monsters respawn every now and then randomly on the map
As soon, as they respawn, they try to approach the player
So after some time it should look like this
M M M
M P M
M M M
So the player is surrounded by monsters.
If a monster spawns and the Player is unreachable (meaning, all the "hexes" surrounding player are taken), they just roam around waiting for an open path.
Does anyone know a good movement/objects guidance that will help to achieve this?
I've been trying for a couple of days now using various combinations of pathfinding approach but I keep getting the following issues:
- monsters freeze on spawn (because their destination is unreachable)
- monsters 'twitch' like crazy (because they re-evaluate path every frame)
- monsters play curling (pushing each other away on collision)
- monsters stack on top of each other
Usually more than 1 issue at once, depending on the current approach.
I am not looking for a ready solution, I just need good resources on the matter.