I gave this topic aswell a thought:
if you need pathfinding (the could be valid reason if for example you want to let the bot go to a certain spot as quick as possible, or spawning obstacles/ enemies as nasty as possible [always on the shortest path],...) i´d be smart to first analyze your environment.
imagine given this map
there are already some dead ends,- finding those should be an easy task (fields that have only 1 accessble neighbour- or that have a dead end)
the conventional way finding a path would be solving this with a grid as way points
to decrease however the loops you need to perform within the finding algorithm you can already exclude those fields who have only 2 openings (I still included edges in this illustration but you could leave them as well)
like I said you can even leave out the edges wich would give you ~ 4 nodes on that path to check [all the fields who have at least 3 accessable neighbours]. This way you can simplify and reduce the needed way points/ fields alot and the pathfinding should already run a lot better
a little sidewalk:
like others already mentioned I would make the enemies all knowledgeable on where you are,- just like human beeings they only should know where the pacman went if they saw him passing them. If pacman for example hides behind a wall...
... all the enemy then knows is that pacman is somwhere behind that corner- nothing more- so after the enemy reached the backside of that corner he still needs to search (look) again for pacman.









Reply With Quote