When A* Mobile Pathing Fails

When A* Mobile Pathing Fails

Recently implementing a super easy JS library for A* pathfinding called easystar, I discovered an interesting issue: All the mobiles would collide in certain locations or "hotspots" on the maps.

There are two main reasons I can see for this:
1. The map itself is most easily traversed through certain spots.
2. The map is ONLY traversable from one side to another through certain locations.

What's likely exacerbating the issue is I'm allowing a mobile to pick a random spot on the map (apparently they know all things,) and then A* pathfind to that location (yep, they're super smart like that.) It may be more realistic to give them a field of view and then A* pathfind to a random location within that FOV. They will also find a new location if there is an obstruction so the mobiles try not to clump together and get stuck. In the game it is not possible for the mobiles to pass through each other, but this would easily fix all of the issues.

If none of those changes fix it, it may be that I have to constrain mobiles to certain locales so the map isn't completely sparse other than one dense location of mobiles.

About Nathaniel Inman

I'm a gamer, graphic designer, musician and software engineer. C++ and Javascript are my favorite two programming languages for which I develop exclusively in vim, tmux and zsh on Arch Linux.

Kansas City, Missouri http://www.theoestudio.com