Game Maker Tutorial – Path Finding Advanced AI

Brand new 2017 Game Maker Studio: 2 Course available right now

In this video I we learn how to create path finding AI that can find the player. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial






37 responses to “Game Maker Tutorial – Path Finding Advanced AI”

  1. Kaliotto Avatar

    I know this is a pretty old video, but anyway… 🙂 Is there a way to avoid red squares overlapping the corners as they turn? I mean in Gamemaker Studio 1x

  2. P3HWNiE Avatar

    how would i make the enemies avoid eachother instead of walking through eachother. if i do the add instance thingy for the enemy the wont move at all.

  3. Dukefazon Avatar

    Wow, this is really cool and simple. I remember writing my own pathfinding algorithm in Flash, it worked but it was a lot of coding. This is much easier. Thanks!

  4. blah979 Avatar

    Awesome worked first time with GM2.

  5. normal_boy Avatar

    Thank you for the tutorial, it worked very well!

  6. Nicholas Smith Avatar

    I wanted to point out that this only works if the objects doing the pathfinding are the same size or smaller than the grid cells. If your object is larger, it will partially ignore collision detection. For example, if those spr_enemy were 32×48 pixels, they would go through the wall by 16 pixels. I haven't figured out a way to account for it just yet.

  7. Triton Mosquito Avatar

    I wanted to like the video but it currently has 666 likes and that's awesome, so… I'm putting a comment instead.
    Your video really saved my life, thank you for keeping it simple and clear !

  8. Antares Avatar

    Perfect tutorial with clear instructions ! Everything worked, however, is there a way to force my obj_enemy to actually avoid obj_wall ?

  9. Michael Milburn Avatar

    This video is so good/useful. Thank you.

  10. Jori Bremer Avatar

    Hi, I have a problem, my game runs very slow (some memory issue) after I try out this code (in a test (room is 1980 width and 1080 heith it runs fine ) but in my game room (about 50000 width and 20000 height the game is very slow, is it better to change the step event to a create event ?

  11. earthpigjr Avatar

    My enemy will move towards the player, but will stop when it hits my object obj_wall and not attempt to maneuver around it. Just so you know I am making a top down zombie shooter and my obstacles use obj_wall as its parent, does anyone know what the issue is with my enemy?

  12. Matheus Carvalho Avatar

    And how can I make so the monsters don't overlap?

  13. Hand and Battlebert Avatar

    Awesome!!! Thank you so much!

  14. Jonatherin Gaming Avatar

    I need help! I made an enemy that shoots bullets (when the player is within a certain distance) that hurts the player. The problem is if I'm below the enemy he still shoots cause Im just using the "distance_to_object" script. I want it so if the enemy can see(not through walls) me and im a certain distance from him he will shoot. So this guy on another video said make a line in the direction the enemy is looking that keeps going in that direction untill it hits a wall or the player. If it hits the player and the player is within a certain distance then shoot. I have no idea how to make this line thing. Plz help

  15. crimsonBen Avatar

    Nice, but how do we prevent that object overlapping over the walls??

  16. The Blaze Avatar

    this doesnt work i followed it

  17. scroobgames Avatar

    i have like a game with grid movement so how do i make them with a grid

  18. JesseKam Avatar

    the video length, 4:20 eh?


  19. Dylan R. Avatar

    Can I get an example? Thank you!

  20. MScull Avatar

    There you have your 10 likes xD

  21. SnowInfinity Avatar

    Beautiful, you got a new sub and a like!

  22. cileth Avatar

    Is there any way to just check for solid objects without specifying obj_wall in mp_grid_add_instances? If I had multiple solid objects that needed to be pathed around that didn't have the same name?

  23. panagiotis iatrou Avatar

    As for me, the enemy sometimes stops moving and it doesnt really find the shortest path. It firstly moves horizontally and then vertically(vise versa) instead of moving diagonally

  24. Strange Hardware Avatar

    Enemies get stuck in walls or just randomly go through them, memory leakage… just plain doesn't work.

  25. DeathSwagga Avatar

    This doesn't work, if you have a large room with lots of walls, aka buildings, it lags a lot. You can't really have many obstacles without it lagging

  26. Chaotic Revenge Avatar

    path=path_add(); Every time I try to put this code in it says unknown function or script

    P.S – Its pissing me off!

  27. WolfySnackrib666 Avatar

    I shudder to think about the programming you'd have to do by hand if this wasn't an included function. Urrh. That also makes me feel shitty cause of all that programming I don't know!

  28. Andrew Jack Avatar

    Hi I am using this in my top down shooter but I have a problem. In the game the enemy goes to any sound produced by the player. This will work fine for a while but then when the object hears the sound it will just teleport to 0,0. Does anyone know why? I made a forum post and got no reply.

  29. Rhök Shifter Avatar

    you are a Script God man!!!

    could you be polite todo help me!? how can i do if i want this in a plataforma gane!?

  30. James Mueller Avatar

    im going to use this in my game! with credit of course

  31. Dr _ Nomz Avatar

    "Let's try, 4 to 10 likes?"
    has 500
    Nice. xD

  32. Carlitos Kda Avatar

    cool tutorial , you have earned a subscriber but how can i use this to do a racing game?

  33. The Lone Nub Avatar

    This works PERFECTLY!!! Now can you tell me how it make the enemy look where they're going until they see the player then they keep sights on them? Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *