Pathfinding #3 - Best with grid [Game Maker Studio 2 | Advanced]

Поділитися
Вставка
  • Опубліковано 27 лип 2024
  • This advanced video tutorial shows you how to create the most powerful target ai/pathfinding with mp grid in GameMaker Studio 2.
    The idea is quite simple. You need only 2 objects, one that setups the grid to be used. And the other object which can link their own path with the grid to create an optimal route to a destination. This is a very power tool that does the pathfinding for you.
    // previous videos:
    • Pathfinding #1 - One l...
    • Pathfinding #2 - Bette...
    // General video on paths in GameMaker:
    • 🔴Game Maker Studio 2 |...
    👑 Support me and get fresh game art and game maker projects every month:
    / 1upindie
    Follow me on:
    📸 Instangram: / 1upindie
    🐦 Twitter: / 1upindie
    💬 Discord: / discord
    📜 Udemy: www.udemy.com/course/become-a... (See youtube about page for discount)
    0:00 Introduction to the pathfinding series part 3
    0:49 Subscribe
    1:07 The setup object
    8:05 The ai/enemy
    14:48 Game shown: Astalon: Tears Of The Earth

КОМЕНТАРІ • 177

  • @carsonskjerdal473
    @carsonskjerdal473 6 місяців тому +10

    This is like when Harry learned he was a wizard. I can't believe how easy this was, I feel so powerful. 15 minutes to implement a massive improvement to my game. Absolute legend, thanks for making these videos.

    • @1upIndie
      @1upIndie  5 місяців тому +4

      If you can start flying on a broom give me a call. I would like to do that too and then I can call you legend for real :D. But besides banter, glad I could be of service.

  • @Mk2kRaven
    @Mk2kRaven 2 роки тому +6

    Just found this 3 part series and holy crap it is amazing. I am making a zombie game with a maze, and couldn't figure out how to make path finding work. I was using mp_potential_step_object, but I realized it wasn't working correctly because I had a maze. I couldn't figure it out until I found this 3 part series! Thank you!

    • @1upIndie
      @1upIndie  2 роки тому +1

      Sweet, good to know my stuff helps some people out.

  • @TheTulunka
    @TheTulunka 9 місяців тому +3

    Truly the best tutorials. Straight to the point, very well explained. Thanks so much!

    • @1upIndie
      @1upIndie  9 місяців тому +2

      Thanks for the trust (and actually subscribing!) and watching my content.

  • @fullym5484
    @fullym5484 Рік тому +2

    You do not know how much this helped me
    I used a different tutorial and for some reason it was really broken
    Thanks

    • @1upIndie
      @1upIndie  Рік тому +1

      Glad to know I could help a fellow developer out!

  • @linkpalmer
    @linkpalmer 2 роки тому +2

    your vids deserve way more views than they have dude. super informative!

    • @1upIndie
      @1upIndie  2 роки тому +1

      Thanks, that would be great.

    • @hothead1546
      @hothead1546 Рік тому +2

      I agree with you, he is one of the best teachers on UA-cam. No unnecessary info, just straight to the point, effective code!

  • @Zapzel24
    @Zapzel24 2 роки тому +11

    Awesome tutorial, I’m going to see if I can reverse engineer this to create a patrol , chase, and return to initial point function. Wish me luck.

    • @1upIndie
      @1upIndie  2 роки тому +4

      Well, you can use it for all. For partrol I would manually set a path, I guess this one would be cleaner.

    • @Zapzel24
      @Zapzel24 2 роки тому +2

      I’ll keep that in mind. Thank you.

    • @khatdragon7694
      @khatdragon7694 2 роки тому +1

      Patrol is a good idea.

    • @stardreamix786
      @stardreamix786 2 роки тому +1

      Good luck! :)

  • @sithusoe8797
    @sithusoe8797 Рік тому +1

    That was awesome !! love it

  • @jeancristian7880
    @jeancristian7880 11 місяців тому +2

    I'm creating the game Corpsenia. If it works, know that you helped me a lot! The pathfinding mechanic was essential. Thanks! If I succeed I will teach everything I know I learned too!

    • @1upIndie
      @1upIndie  11 місяців тому +1

      Glad to hear I could help you out here and thanks for watching! If you got a demo or something to share plus you want to see cloud drop me link or key, so my community can have a look at your game.

  • @ManuelPaulucci
    @ManuelPaulucci 4 місяці тому +1

    you are a boss, greetings from Argentina

    • @1upIndie
      @1upIndie  4 місяці тому

      Thanks a lot! How is your country doing right now if I may ask? Argentina was once 3rd richest country in the world and could go back to that.

  • @cthulhu_1
    @cthulhu_1 2 роки тому +3

    Muy bueno, aprendí algo que de chico siempre quise hacer en mis juegos. Ya quiero ver el Hotline Series

    • @1upIndie
      @1upIndie  2 роки тому +2

      Pues diviértete con la serie hotline

  • @beanandbunstudios1800
    @beanandbunstudios1800 2 роки тому +1

    I love your content, you are much apprecitated!

    • @1upIndie
      @1upIndie  2 роки тому

      Thanks, hope that stuff helps.

  • @lloyd011721
    @lloyd011721 21 день тому +1

    this is really cool

  • @eunit08
    @eunit08 Рік тому +1

    Great tutorial my guy!!!

    • @1upIndie
      @1upIndie  Рік тому

      You are as always welcome mate!

  • @buffectomorph9657
    @buffectomorph9657 Рік тому +1

    You are the best 1up!!!

  • @fireball3588
    @fireball3588 2 роки тому +1

    Very helpful Video! Thanks

    • @1upIndie
      @1upIndie  2 роки тому +1

      Thanks, always glad I can be of service.

  • @Tormentadeplomo
    @Tormentadeplomo Рік тому +1

    Thank you, very helpful.

    • @1upIndie
      @1upIndie  Рік тому +1

      Ah, thanks for the trust that my content is useful to you.

  • @Sillymonkeies
    @Sillymonkeies Рік тому +2

    You rock man!! God Bless

  • @heikkiaho6605
    @heikkiaho6605 2 роки тому +1

    Thank you very much!

  • @jairosantos6062
    @jairosantos6062 2 роки тому +1

    Thankx professor.

    • @1upIndie
      @1upIndie  2 роки тому

      Hone your skills my pupil and you will also become one with bug report, haiiiisa.

    • @jairosantos6062
      @jairosantos6062 2 роки тому +1

      @@1upIndie Yeah, I'm makinga a bug with a little game in it. ha ha ha ha

  • @smokeback
    @smokeback 2 роки тому +2

    this is aweosme

    • @1upIndie
      @1upIndie  2 роки тому

      Yes it is sir!

    • @smokeback
      @smokeback 2 роки тому

      @@1upIndie working on a roguelike so was doing som research on enemy tracking that's a bit complex.this will.be so useful to expand on

  • @totleo
    @totleo 4 місяці тому +1

    thx!

  • @tomlivingstone5520
    @tomlivingstone5520 7 місяців тому +1

    Hello, i was just wondering on how you did the animations for your enemies? I've been trying to figure out how to turn my enemies as they move along the paths and i can't figure it out.

    • @1upIndie
      @1upIndie  7 місяців тому

      You mean the actual sprites inside the object? Or the state machine (idle/walk). I guess you are refering to the flipping towards left or right? In that case I simple invert the image_xscale, 1 for going right and -1 for going left. So you need to check the xprevious and x (current value), this decides how the image is flipped. Was that what you were looking for?

  • @SpringDavid
    @SpringDavid Рік тому +2

    hey man, do you know how to make the sprite change to fit its direction?

    • @1upIndie
      @1upIndie  Рік тому +3

      Yes, in that case you check what kind of direction the enemy/instances go. So you read it out and flip the image_xscale accordingly.
      Something like that:
      if (direction >0 and direction < 90){ image_xscale = 1; }
      if (direction >= 90 and direction < 270){ image_xscale = -1; }
      if (direction >270 and direction < 360){ image_xscale = 1; }
      Hope that helped!

    • @SpringDavid
      @SpringDavid Рік тому

      @@1upIndie i asked the question wrong, im trying to do a pac man clone and ive been trying to find a way to check for the closest next point on the path
      They wont do diagonal movement, my logic is if the next point in the path is postive X, they will still look at that direction until it changes to another closest point
      problem is i have only 3 brain cells and cant figure a way to do that

  • @abesses6630
    @abesses6630 2 роки тому +3

    Hello, ty for this good tutorial!
    I'm looking for how to use it with bigger monster but same wall size. (Exemple: enemy size 64x64 but wall 32x32)
    If you have any advice for the collision to avoid that a part of the enemy cross the wall.

    • @1upIndie
      @1upIndie  2 роки тому +1

      Acually yes, you simply assign a different collision mask (below where you assing the sprite) that is small enough instead of the default one that is being used when you assing a sprite to the instance of the enemy.

    • @abesses6630
      @abesses6630 2 роки тому +1

      @@1upIndie Maybe I didn't understand something. But it doesn't seem to work :/

    • @1upIndie
      @1upIndie  2 роки тому +1

      @@abesses6630 Hm, if you need some help, maybe go into my discord under the "help" section, there are always some guys that do help out new developers.

  • @tasharules
    @tasharules 4 місяці тому +1

    This is a longshot, but is there a function in gamemaker that lets you use the path system with tilemaps instead of a collision object? I just switched to using tilemap collisions with my player but quickly realised that mp_grid_add_instances doesn't support tilemap id's, I'm hoping there might be a fix out there that supports this kind of system?

    • @1upIndie
      @1upIndie  4 місяці тому +1

      Hm, interesting. I would need to check if that is possible since they (as you stated correctly) added tilemaps aswell to the mix or they will add that in the future.

  • @RYTHETRO
    @RYTHETRO 8 місяців тому +1

    This is really good and exactly what I needed for my game. I had a question though, the thing I'm trying to go around moves which causes the character to sometimes go through the wall instead of around it. I tried making it run every step of the game but it still seems to go inside the walls. Was wondering if you know how to fix this. Just additional info the thing I'm trying to get around is a big sprite that needs to be precise but moves extremely slowly.

    • @1upIndie
      @1upIndie  8 місяців тому

      I assume you are talking about moving platforms, which causes the enemies/npc/player to glitch into walls? Well, in that case you would need to refresh (the whole wall instance setup, not recommended) quite a lot which is taking a lot of computation. This method works pretty good if you have a static (one time set setup) which stores one in memory where walls and free space is. And by moving a platform you create glitchíng.
      To remedy this you would need to create your own A* algorythm that takes moving things into account which, is not easy to do.

  • @Waliente
    @Waliente Рік тому +1

    Thank you for this i video! It's really helpfully :) .
    i want to ask you a question: if we have more than fifty "enemy" how can we improve the code? Simply by changing path alarm time to 1 or 2 seconds?

    • @1upIndie
      @1upIndie  Рік тому

      Well, you can marginally improve the code, so things like things like update lowering or doing a lot of code from one source (instead of all of them) can help this. But if you really want large numbers of enemies on the screen, then this system is not what you are looking for. It is meant for lower counts (50-100) enemies where they can go complext paths.

  • @heftykat
    @heftykat 6 місяців тому +1

    @1upIndie Did you ever make a path 4? I want to learn how to make them not collide when chasing

    • @1upIndie
      @1upIndie  6 місяців тому

      Ehm, I didn't do a 4th video because that pathway system is pretty cool out of the box but it has limitations. So that is the most you can get out of it.
      You mean like flying towards you? Then you can simply have a Vampire Survivors style gameplay. I did a video series on that: ua-cam.com/video/QxL9jjNSz98/v-deo.html
      Or if you have not many enemy flying then you can simply put in their step event (your player coordinates and theirs) -> direction = point_direction(x,y, obj_Player.x, obj_Player.y); speed = 1; or move_towards_point(obj_Player.x, obj_Player.y, 1);
      What that what you were looking for?

  • @azuli4440
    @azuli4440 2 місяці тому +1

    im having trouble trying to figure out how do i make it follow you through the rooms, do you have any tips?

    • @1upIndie
      @1upIndie  2 місяці тому

      Not sure what you mean by room. If you swap through rooms (aka, another level) you simply repeat the process like shown here. Or do you want to have enemies go from one room to the other with the player?

  • @user-pl5oj1hr8n
    @user-pl5oj1hr8n 2 роки тому +1

    Liked, subscribed. Question. In my game if enemy has less than 10% hp, it is supposed to run away from the player, and i want to make it so that it runs using pathfinding, but I dont know how to do it. If you can pls give me some advice.

    • @user-pl5oj1hr8n
      @user-pl5oj1hr8n 2 роки тому

      I tried to make enemy follow the furthest (from the player) point of the map, but sometimes the path to this point just does not exist.

    • @1upIndie
      @1upIndie  2 роки тому +1

      Hm, what you can do is to go radially around the player (or rather a cone).
      1st You would need to get the direction from the player to the enemy (aways from him).
      2nd I would make a random difference from that direction (this is then a cone of possible directions where to go). I would say around +- 25 degrees
      3rd so use lengh_dir from the player to get the specific new direction
      4th check if if that spot is free (no wall there), if all good apply this new positon for the enemy to flee, if not start again with the 2nd step.
      Hope that helps!

  • @nothesearechickens4203
    @nothesearechickens4203 5 місяців тому +1

    I have a problem. My nemies get stuck on blocks moving to the player and I don't know why. please help!

    • @1upIndie
      @1upIndie  5 місяців тому

      Hm, not sure I can help you out without seeing your project (I cannot, I get too many requests for help). Did you try my discord help section? Maybe somebody has the same issue or knows how to fix your problem.

  • @gchd1232
    @gchd1232 Рік тому +1

    what if i want the objectto go around multiple objects? I have my normal solids but i also have a moving solid, and i dont want the enemy to go through that either. what do i have to do to prevent that from happening?
    also: im trying to use a random spawning system with the solids and now it doesnt work anymore. why?

    • @1upIndie
      @1upIndie  Рік тому +1

      Well, that is a bit more tricky since you "map" with the setup once where solids are and the inbuild A* search algorythm does create possible routes for each enemy via paths. But now you want to go from a once setup static setup to a dynamically updated one. So, you can do the setup phase each step which will take a toll on performance or you can create your own custom collision/route system which is possible but not an easy solution.

    • @gchd1232
      @gchd1232 Рік тому

      @@1upIndie Thanks

  • @ultimateforestgaming1895
    @ultimateforestgaming1895 2 роки тому +1

    im making a topdown game and the enemies dont go completely round the walls and go through it on many occasions any way to fix this

    • @1upIndie
      @1upIndie  2 роки тому

      Have you tried my discord the "help" section? I cannot really do anything for you with these sparse informations.

  • @ryanabner4040
    @ryanabner4040 2 роки тому +1

    idk where but ive also purchased this tileset/asset pack before with the zombies, character icons, buildings, cards, roads, etc. if you remember/know what its called please let me know cause i would buy it again in a heartbeat

    • @1upIndie
      @1upIndie  2 роки тому

      That asset packs are from Malibu Darby, malibudarby.itch.io/

  • @superzilla784
    @superzilla784 Рік тому +1

    My only problem with this code is that all the NPCs are rubbing against the walls when trying to follow me. it looks very weird. any ideas on how to fix this?

    • @1upIndie
      @1upIndie  Рік тому

      Not with this system to be honest. You would need to create your own anit cluster algo with your own custom pathfinding algo.

  • @porucznikananas2600
    @porucznikananas2600 2 роки тому +1

    I have a question when I run the game my enemies start moving but once the path gets updated they stop in one place and don't move at all do you have any idea how to fix it?

    • @1upIndie
      @1upIndie  2 роки тому +1

      Dunno, check the "speed" variable ( i would draw_text it above the enemy). I guess your issue is that they are not running in a new path (so you are maybe not updating or something is missing to "kickstart" the new movement).

    • @porucznikananas2600
      @porucznikananas2600 2 роки тому +1

      @@1upIndie Yeah speed was the problem I don't know why but in the path_start event when I was typing the built speed variable as speed it wasn't working but when I typed the exact value it worked, so thanks a lot

    • @1upIndie
      @1upIndie  2 роки тому

      @@porucznikananas2600 Sweet!

  • @gchd1232
    @gchd1232 Рік тому +1

    How can I make my Enemy go around the solids in a certain radius? my Enemy always clips through the wall and i dont know how else to prevent it.

    • @1upIndie
      @1upIndie  Рік тому +1

      Sorry, but I have no idea how to help you here. To have an allround system you would need to swap between the pathfinding and an additional instance control system of your own.

    • @gchd1232
      @gchd1232 Рік тому

      @@1upIndie Thank you

  • @angelosouza2821
    @angelosouza2821 4 місяці тому +1

    Man, this video helped me a lot, I cannot thank you enough. However I hava a doubt about a thing I want to make a little different of whats on the video, but I don't know how to do it. I want the "x" and "y" of the path to be random number from the created grid. Do you have any idea how can I do that, if its possible?

    • @1upIndie
      @1upIndie  4 місяці тому +1

      Not sure I can follow your thought pattern. What do you mean by random x,y of the path?

    • @angelosouza2821
      @angelosouza2821 4 місяці тому

      @@1upIndie I want the code to return me a random x and y position, based on the grid. The grid covers my entire room and it's size is divisible by 16, wich is the cell width and height that I set up on the grid. I'm a begginer in programing so I apologize for my cofused logic, but I thought that obtaining a random position from the grid area would be better because the grid area already excludes any position of placed instances of "obj_walls" in my room.

    • @angelosouza2821
      @angelosouza2821 4 місяці тому

      I was worried that if I use a random function to get random coordinates from the room itself instead of the grid, if I try to use a path that is grid based is possible that the random coordinate can't be reached by the grid movement.

  • @boxedgamedev9462
    @boxedgamedev9462 2 роки тому +1

    One question how can i use this when i have no room size defined?
    Like my room is 1 by 1 pixel big but due to a custom camera i can go anywhere i dont thik its a good idear to make a grid that is 100s of thousands of sqares big.

    • @1upIndie
      @1upIndie  2 роки тому

      Technically you can have a grid of one pixel, but will become memory intensive. So it maybe would be better to have "bigger" squares so that the algorythm is less taxing and set the grid only on the area where you want it it be (video goes for the full room).

    • @boxedgamedev9462
      @boxedgamedev9462 2 роки тому

      @@1upIndie its as of now a room without boorders so you can move as far as coordinats go to the 32bit integer limit

    • @boxedgamedev9462
      @boxedgamedev9462 2 роки тому

      could it be possible to always update the grid possition so that it is always at your screen possition

    • @1upIndie
      @1upIndie  2 роки тому

      @@boxedgamedev9462 You could update it, but the more you do that the more it will tax your performance. Just play around with values and condition until you find a good solution to your current project.

  • @gdiris4481
    @gdiris4481 9 місяців тому +1

    pathing works but my enemy goes halfway through the walls, somethings weird with the collision mask

    • @1upIndie
      @1upIndie  9 місяців тому

      Hm, did you try drawing you collision masks and see if that is the root of your issues?
      In your draw event: draw_rectangle(bbox_left, bbox_top, bbox_right, bbox_bottom,1);
      Was that helpful?

    • @gdiris4481
      @gdiris4481 9 місяців тому

      @@1upIndie i did draw the collision masks for both my enemy and collision blocks, both are working as intended but my enemy's collision mask is clearly going into into the block

  • @studentesso
    @studentesso 7 місяців тому +1

    I just tried your code, but it's not working, the whole path part. It's not drawing a path and the instances aren't moving at all (but the mp_grid seems to be working just fine), I wonder if these funcitons got broken by some GM update?

    • @1upIndie
      @1upIndie  7 місяців тому +1

      Hm, GameMaker updates have a tendency do break things, so it is not out of the possible realm.
      Sometimes flushing the cache (clean symbol next to start icon) may solve your issue. If not, try the offical yoyo or my discord server and ask for help there. I cannot really help you in such a situation.

    • @studentesso
      @studentesso 7 місяців тому +1

      @@1upIndie okay I found help on the forum, looks like that if I make the enemies child of the collision object they just get stuck

  • @TonzuuJaya
    @TonzuuJaya Рік тому +1

    Tengo un problema , y es que la room , las paredes , etc , estan de color verde y rojo , como hago para quitar eso?

    • @1upIndie
      @1upIndie  Рік тому +1

      No estoy seguro de cuál es tu problema. Pones todas las cosas en la habitación. Si desea hacer que las paredes u otras cosas sean invisibles, puede hacer clic en el objeto "visible" o en el evento "crear" visible = false; escribir
      ¿Fue útil?

    • @TonzuuJaya
      @TonzuuJaya Рік тому

      @@1upIndie si , muchas gracias :]

  • @adrienchalono3287
    @adrienchalono3287 Рік тому +1

    I don't get it you create the purple enemy grid but it moves the ennemy don't understand why , when I try to do it, it lag so much it doesn't work and nothing happen.

    • @adrienchalono3287
      @adrienchalono3287 Рік тому

      When I reduce the size of the room it lags less but evrything disepear

    • @1upIndie
      @1upIndie  Рік тому +1

      I am not sure how to help you out here mate. In my discord you can try the help section, since you ask about basics.

  • @Artue0
    @Artue0 Рік тому +2

    How did you set enemy animation? How did you know when enemy is moving up,down,left,right? I cant figure it out, can you help me?

    • @1upIndie
      @1upIndie  Рік тому +1

      This method changed the direction where you are goind and I set therefor the sprite according to the newly set direction. But that would look somestimes a bit twichy, so I update that sprite swap with an alarm event that updates around each 30 steps (half a second). Was that what you were looking for?

    • @Artue0
      @Artue0 Рік тому

      @@1upIndie How do you check in what direction enemy is going?

    • @1upIndie
      @1upIndie  Рік тому

      @@Artue0You know what, that could be a neat small video because I have seen that question being asked a few times. That will be done a few hours.

    • @Artue0
      @Artue0 Рік тому

      @@1upIndie Great! Thank you.

    • @Artue0
      @Artue0 Рік тому

      @@1upIndie Coudl you also include in this video how to check if enemy is seeing player please? Im making a game where enemies are shooting, and i want them to not shoot if they dont see player.

  • @jordanferrazza8700
    @jordanferrazza8700 2 роки тому +1

    What if you want the walls to be the only path, like in a citybuilder?

    • @1upIndie
      @1upIndie  2 роки тому

      Hm, then this is maybe not what you are looking for. This is system is for dynamically guiding instances (heavier on cpu) around tricky obsticles. For a linear/fixed apporach/ways/road I would use the path system.

    • @jordanferrazza8700
      @jordanferrazza8700 2 роки тому +1

      @@1upIndie Just wondering

  • @hothead1546
    @hothead1546 Рік тому +1

    Thank you for the amazing tutorial as always!
    So, this is a specific question but, I am making a game that has randomly generated maps, including obsticals. Will it matter where I put the NPC's? The whole gimmick of my game is randomization

    • @1upIndie
      @1upIndie  Рік тому

      Sure, if you do randomization you need to have a spawn controller where you spawn enemies. After the random maps are finished and check if on that random spot you can place an enemy with a collision check. If no collision is there this spot is free and you can save this in an array or instantly spawn an enemy there. Was that helpful?

    • @hothead1546
      @hothead1546 Рік тому

      @@1upIndie I understand yeah! So I'd just have to make the enemy AI check the map after it generates, right? I was thinking I could also create a clear area where the enemies spawn with no obsticals, then have them calculate from there

    • @hothead1546
      @hothead1546 Рік тому

      @@1upIndie just to insure I do it right, would you mind writing the first bits of the code? I'm not familiar with arrays, other than that they are essentially a list of information

    • @1upIndie
      @1upIndie  Рік тому

      ​@@hothead1546 That is possible also, to have "free" spots where all your generated maps don't place obsticles/walls etc. .
      The video here does have one start assigment part where your obsticles are being marked as unpassable so that the enemies can create paths around them. So it makes sense to have an order or creation:
      1. generate map with walls/obsticles
      2. do the grid setup like in the video once
      3. create enemies where they can be placed

    • @1upIndie
      @1upIndie  Рік тому

      @@hothead1546 I assume you are new to programming (which is totally fine, you get quickly lost in the vast amount of tutorials etc.), so familiarise yourself with the boring basics, because you try to do out of the box advanced coding which will very likly frustrate you.
      I write that because this cannot be simply achieved with a few lines of code. Come in my discord and let's see what we can do here.

  • @game-dev1782
    @game-dev1782 Рік тому +1

    nice video but get this I found out on certain dimensions the boxes are not equal l.(in different sizes))
    grid = mp_grid_create(0,0,room_width/32,room_height/32,32,32)
    and so like some dimensions work so what's the issue

    • @1upIndie
      @1upIndie  Рік тому

      Not sure what you mean to be honest.

    • @aaronmaldonado6562
      @aaronmaldonado6562 Рік тому

      When you add the instances with the function "mp_grid_add_instances(id, obj, prec)" you must set the third parameter as true.

    • @game-dev1782
      @game-dev1782 Рік тому

      @@aaronmaldonado6562 oh thanks man..😁 let me try that

  • @Breloomgames71
    @Breloomgames71 2 роки тому +1

    And when he can't get to the player, instead of standing still, how do I tell him to do something else?

    • @1upIndie
      @1upIndie  2 роки тому +2

      Well, you then do this with a state machine. One is state = "following" other to be ide or even roam randomly.

    • @Breloomgames71
      @Breloomgames71 2 роки тому

      @@1upIndie From my honest opinion watching your videos I do not understand how you do not have more subscribers, thank you for answering me 👍

  • @jeorge5024
    @jeorge5024 Рік тому +1

    how do i make the enemy collide with other enemies?

    • @1upIndie
      @1upIndie  Рік тому

      That doesn't work with this system (it is boxed and not meant for this), you need a your own custom A* search algo with anti cluster algo, which is not beginner friendly.

  • @kaspinator5265
    @kaspinator5265 Рік тому +1

    Does this work with mp_grid_add_cell? My enemies get stuck in the walls:/

    • @kaspinator5265
      @kaspinator5265 Рік тому

      (from a tileset)

    • @1upIndie
      @1upIndie  Рік тому

      Hm, if you do that during runtime, you would need to update the path of all entities walking around since you add a (mutliple) new cell(s).

  • @DynoStorm
    @DynoStorm Рік тому +1

    Can't get it to work. Everytime a path is created the game crashes and gets a checksum error. Wondering it might conflict w the rollback multiplayer features. hm

    • @DynoStorm
      @DynoStorm Рік тому

      Checksum for frame 120 does not match saved (-2144494780 != 823548680)

    • @1upIndie
      @1upIndie  Рік тому +1

      I am not sure how I can help you here plus I haven't done anything network related (checksum is a not readable/not closed network data) with GameMaker.

    • @DynoStorm
      @DynoStorm Рік тому

      @@1upIndie Thanks anyways ^^, I'll have to make do w method #2 and design maps carefully around that.

  • @jordanferrazza8700
    @jordanferrazza8700 2 роки тому +1

    How do I make it so that the sprites don't phase through walls while using the path?

    • @1upIndie
      @1upIndie  2 роки тому

      Well, you have the bounding box the instance to be bigger or same size as the Sprite or you draw the walls over the image (walls layer is on top of your sprites layer.

    • @jordanferrazza8700
      @jordanferrazza8700 2 роки тому

      @@1upIndie I found the action that changes the origin of the object

  • @victorsikkim
    @victorsikkim Рік тому +3

    This video was very helpful to me, but I have one question: how to avoid stacking enemies in each other?

    • @1upIndie
      @1upIndie  Рік тому +3

      Well, that is much more complicated. You would need to ditch this "ready to use" system shown in the video and create your own pathfinding A* algo plus an anti clustering vector collission system.

    • @zarc677
      @zarc677 4 місяці тому +1

      @@1upIndie and do you know of any videos on this subject? I don't know how to do what you suggest. Thx

    • @1upIndie
      @1upIndie  4 місяці тому

      @@zarc677 I have not found any to be honest. All the vampire survivor games use build in collision systems (Godot, Unity, Unreal) which take care of that. GameMaker has none and so you have to build your own. I haven't found a solution that doesn't tank performance.

    • @zarc677
      @zarc677 4 місяці тому

      @@1upIndie Okay I see, thank you for your prompt reply.

  • @vocenaoentendeunada2505
    @vocenaoentendeunada2505 Рік тому +1

    To it to work I need to watch Pathfinding #1 & Pathfinding #2?

    • @1upIndie
      @1upIndie  Рік тому +1

      Not necessary but it gives a programmer that is new in GameMaker context what is possible. The method in this 3rd video of this series is the most "complex" one and maybe not what is needed for your game.

  • @e_buffturtle2037
    @e_buffturtle2037 2 роки тому

    Can you do it so they don’t follow the exact same path? Like they don’t essentially line up and group up together when moving to you

    • @1upIndie
      @1upIndie  2 роки тому +2

      That will be fixed in the Hotline Series video.

    • @0ADNewbieRush
      @0ADNewbieRush 2 роки тому +1

      @@1upIndie Hi mate - just watched the HL Miami vids on pathfinding AI, I didn't spot your solution to it in there. Did I miss it?

    • @1upIndie
      @1upIndie  2 роки тому +1

      @@0ADNewbieRush Hm, it starts in Video "Hotline Miami Remake in GameMaker Studio #26" and is implemented there.

    • @0ADNewbieRush
      @0ADNewbieRush 2 роки тому

      @@1upIndie Hi, I've gone through the vids again from 26 to 30. All of your examples involve a single player and enemy, so the lining up/grouping behaviour is never actually seen, and subsequently I don't see anything in the code that would negate it. You certainly don't draw any attention to it. It's got more mechanics, like the line of sight, etc, but I'm not seeing anything that specifically would prevent multiple enemies converging. I do have a solution that I'm trying to impliment in my own game, but I was really interested to see what yours would be, mostly to see if it was a more elegant sotution.

    • @1upIndie
      @1upIndie  2 роки тому +2

      @@0ADNewbieRush I didn't implement any grouping/clustering code because the series was ended. There were a few more systems I originally wanted (patrolling, grouping, calling for reinforcements, stunlocks from the player etc.) to do but since view counts and watch time were abysmal I had to cancel in the end.
      26-30 Were "only" doing a state machine that goes, follows and shoots. All necessary basic moves. I don't intend to futher the series or add more mechanics, so in that regard that is pretty much the end.
      There is a good video on that, maybe that helps you out: ua-cam.com/video/OmnUZM4-B6o/v-deo.html

  • @mendfi5427
    @mendfi5427 2 роки тому +1

    Hey, so i followed this tutorial but i don't really know why, my enemies dosen't appear, i am the only one? did i do something wrong?

    • @1upIndie
      @1upIndie  2 роки тому

      Hm, not sure how I can help you mate.

    • @mendfi5427
      @mendfi5427 2 роки тому

      @@1upIndie No problem, thanks for your answer !

    • @Infernoplex
      @Infernoplex Рік тому +1

      Did you do draw_self(); in the draw event of your enemy?

    • @1upIndie
      @1upIndie  Рік тому

      @@Infernoplex Yes, that but you see my enemies are those red/pink rectangles (sprite index). Here I simple do a "fake" draw event above the draw self, so that you can the see the box/rectangle which does the collisions/pathfinding and then the good looking sprite above it.

  • @fredxvi
    @fredxvi 2 роки тому +1

    If you make it so the enemies trail the pathfinder object loosley, you can get some very cool effects where it isn't as clustered. anyone have any good tips for getting them to avoid one another?

    • @1upIndie
      @1upIndie  2 роки тому

      You can flag the enemies as walls also and give them a round bounding box. That is not the best way but works for small groups of enemies.

    • @fredxvi
      @fredxvi 2 роки тому

      @@1upIndie I ran some updates as well to make it so that every update, it updates the navigation mesh to include pathfinder, so they have more boyd like behavior

    • @wyattputman1461
      @wyattputman1461 2 роки тому +1

      @@fredxvi how did you make the objects loosely follow the path? Could you also share the code you used to make the enemies less uniform?

    • @fredxvi
      @fredxvi 2 роки тому

      @@wyattputman1461 sure thing

    • @wyattputman1461
      @wyattputman1461 2 роки тому

      @@fredxvi thanks!

  • @smidy3
    @smidy3 2 роки тому +1

    Just a note, when 1up indie says it takes alot of perfomance, hes not joking. With my game the rooms are huge, 50,000 by 50,000 and i get a game crash error where gamemaker runs out of memory, when trying to draw the grid!

  • @deltanuub9755
    @deltanuub9755 5 місяців тому +1

    Can you give me the source code by anychance? Thank you!

    • @1upIndie
      @1upIndie  5 місяців тому

      Sure why not. Drop in my discord and I send you the project file.

  • @Norhiree2137
    @Norhiree2137 Рік тому +1

    Hi. I have an error, really weird one. U see, im using grid = mp_grid_create(0,0,room_height/64,room_width/64,64,64); (because i operate on 64x64 sprites) but this makes my grid draw... only half on the screen, left to be specific. But when i change room_height and width to room_height/32,room_width/32, grid draws normally (but works not as i intended) what the hell actually?
    ibb co/KF7Q3kX (this is how it looks like when i changed room size to x2
    ibb co/0tVwZ41 this is oryginal room size
    put a dot between ibb and co cuz youtube deletes links ._.

    • @1upIndie
      @1upIndie  Рік тому

      Hm, that bug is super weird to be honest. No idea how to help you out mate.