I am a student that is learning how to program and I started to develop my first platform game using C. However, I’m struggling with the pathfinding algorithm for the enemies.

My levels are basically a 30x45 array with numbers that have a 1 where there is a block, 2 ladders and 0 an empty space. I don’t know which path finding algorithm to use, mainly, because I have no idea how to create the graph.

Being a grid-based level, using an adjacency list or matrix, I guess that it would be quite complex if I had every walkable cell as a node. I was thinking of using BFS or Dijkstra’s, but I don’t even know where to start. I already know how the algorithms work, but I can’t figure out how to implement any of those.

I would appreciate if anyone could help me.



You must log in to answer this question.

Browse other questions tagged .