enemy pathfinding

so sort of like a fitness system that is used for AI’s? the closer they get the higher the score and the further the lower, where the enemy is wanting to have the score increase therefore being closer to the destination?

Not quite. What you’re aiming for is the lowest score, because that means the fewest number of tile iterations to get there, which in turn means the shortest path.

I read through a bunch of articles before building my own implementation, but I THINK this was the one that made everything ‘click’ for me: https://old-homepages.abdn.ac.uk/f.guerin/pages/teaching/CS1013/practicals/aStarTutorial.htm

Your exact implementation might differ slightly to other peoples when you come to building, because optimisation is subject to usage. I think that’s what I liked about this one - it explains the fundamentals but leaves you to decide how best to code those fundementals in, how to tweak for your own needs (again you might for example want to score diagonals differently, or not allow diagonal movement at all, etc), and how to keep it running efficiently.

What’s actually really interesting is that once you’ve built A* in to a conventional grid based game and understand it from a conceptual level, you actually realise how it can be used for more complicated systems, which don’t follow a traditional grid. Road networks for example, to plan routes from a GPS co-ordinate to a destination. The roads might not be a conventional grid but they connect up in just the same way - look at all of the junctions as your grid and factor road length/speed between each junction into your scoring and the same path-finding code could be used for a real-world route planner. Read this paragraph again once you’ve built your first path finder and you’ll see what I mean :blush:

just a caveat to the OP that A* is only as good as its hueristic (ie, how well it can estimate remaining distance to goal), otherwise a simpler algorithm (fe Djikstra or BFS) might perform just as well (or even better).

some problems are hard, not because of having to find an A* implementation (because there are many out there), but because of having to then define its hueristic for your particular use case (which might be trivially simple, like simple movement on a regular grid, or incredibly difficult like ‘what’s the best next chess move’)