Click on the applet to focus it, then use the arrow keys to move about. The applet resets when you - the green square, get intercepted by a red square.
This is a demonstration of tracking the player by scent. Agents move towards the player, then track the freshest scent.
It's overhead is almost non-existant compared to A* or Dijkstra. This makes this form of pathfinding suitable for action games, where A* would otherwise choke the machine. It also works for platform games too, because the player's navigation of the scenery, teaches the tracking agent how to navigate obstacles.
The player of course can outwit the agents (due to the Conga Line Effect), but there is enough of a challenge to make outwitting the scent tracker fun, without the situation becoming unfair. After all, there are no walls or dead ends to get trapped in in this demo, though the scope for it is in there because the monsters will not walk over each other.
Things to consider:
- You might want to ignore old scents. There's no benefit in tracking for it because as soon as a trail touches a fresh trail, the agent follows that instead, but you might be interested in more accurately simulating scent.
- I found that in Final Ninja Zero, using this had the problem that the player could travel diagonally to a new square, leaving an Agent stranded. You need to make sure that in plaform games that the player is leaving a consistent path.
- There's no reason the scent could not be deployed over a greater area. All that would be needed is to deploy the scent only on fresh tiles and only with a stronger scent nearer the player. This leaves the last square stepped on smelling strongly, and the surrounding squares still giving agents an idea where to go.
- Different smells is tricky. That would suggest a different map for each smell. But then the scent map would be better made up of objects with different properties.
- Wind. A vector field on top of the scent map could pose some very interesting possibilities.
Source code: scent_map
Built with Processing