• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Pathfinding for enemys (a* pathfinding)

S

Simulacron

Guest
I want to set up an enemy ai that moves to the player, when it sees the player. However, my game is grid based, so the enemy should move from gird position to grid position. My problem is to find a suiting method to calculate the path, that the enemy takes. I tried for 3 days to create an a* pathfinding algorithm, but it still doesn't work and now the game doesn't even give an error, but just freezes (It's probably an infinit while loop). Is there any other way to calculate the shortes path between two points, where I get a list of all grid coordiantes, that I then can use in my grid-moving-system? I also don't use the build in variables, like hspeed, etc. Because of that I don't want to use the normal path, because you need to input a speed value. This also wouldn't really work with my grid system. Does anybody has an idea what I can do, is there some build-in datastructur or grid system, that I missed and does the calculation for me?
 
Sure. Are you in GMS1? I like to use this DLL. He's also got a pure GML version if you'd rather not use a DLL.

It's a very full featured A* solution that I use in my projects (and I never use the built in motion planning/variables either). Take a look, or if you want me to look at your algorithm let me know, and I'll see if I can see where you went wrong.
 
S

Simulacron

Guest
Sure. Are you in GMS1? I like to use this DLL. He's also got a pure GML version if you'd rather not use a DLL.

It's a very full featured A* solution that I use in my projects (and I never use the built in motion planning/variables either). Take a look, or if you want me to look at your algorithm let me know, and I'll see if I can see where you went wrong.
Thank you so much for sharing this link with me!:) I will definitely try it out. Also thank you for your offer about looking over my code. I will let you now if I need it.
 
Top