Tuesday 30 July 2013

A* implemented

I've spent a few hours implementing the first parts of monster AI.

Monsters on the same screen as the player, will look for the shortest path available towards the player.


The red path is the pathfinding from the monster to the player.


From another point.

Technically, I implemented the A* algorithm on a 1D list of tiles. I used the Manhattan Distance to calculate the heuristics for remaining distance to player from monsters along the path. I only check the surrounding tiles, which greatly reduces the time it takes to calculate the path. It's still quite basic compared to many A* possible additions, but works for now.

No comments:

Post a Comment