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

  Рет қаралды 20,927

1up Indie

1up Indie

Күн бұрын

Пікірлер: 188
@carsonskjerdal473
@carsonskjerdal473 9 ай бұрын
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 9 ай бұрын
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.
@TheTulunka
@TheTulunka Жыл бұрын
Truly the best tutorials. Straight to the point, very well explained. Thanks so much!
@1upIndie
@1upIndie Жыл бұрын
Thanks for the trust (and actually subscribing!) and watching my content.
@Mk2kRaven
@Mk2kRaven 2 жыл бұрын
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 жыл бұрын
Sweet, good to know my stuff helps some people out.
@fullym5484
@fullym5484 Жыл бұрын
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 Жыл бұрын
Glad to know I could help a fellow developer out!
@jeancristian7880
@jeancristian7880 Жыл бұрын
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 Жыл бұрын
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.
@Zapzel24
@Zapzel24 3 жыл бұрын
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 3 жыл бұрын
Well, you can use it for all. For partrol I would manually set a path, I guess this one would be cleaner.
@Zapzel24
@Zapzel24 3 жыл бұрын
I’ll keep that in mind. Thank you.
@khatdragon7694
@khatdragon7694 3 жыл бұрын
Patrol is a good idea.
@stardreamix786
@stardreamix786 3 жыл бұрын
Good luck! :)
@Sucundrule
@Sucundrule 18 күн бұрын
amazing tutorial, thanks
@1upIndie
@1upIndie 17 күн бұрын
Thanks for watching!
@cthulhu_1
@cthulhu_1 2 жыл бұрын
Muy bueno, aprendí algo que de chico siempre quise hacer en mis juegos. Ya quiero ver el Hotline Series
@1upIndie
@1upIndie 2 жыл бұрын
Pues diviértete con la serie hotline
@linkpalmer
@linkpalmer 2 жыл бұрын
your vids deserve way more views than they have dude. super informative!
@1upIndie
@1upIndie 2 жыл бұрын
Thanks, that would be great.
@hothead1546
@hothead1546 Жыл бұрын
I agree with you, he is one of the best teachers on KZbin. No unnecessary info, just straight to the point, effective code!
@ManuelPaulucci
@ManuelPaulucci 8 ай бұрын
you are a boss, greetings from Argentina
@1upIndie
@1upIndie 8 ай бұрын
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.
@lloyd011721
@lloyd011721 4 ай бұрын
this is really cool
@buffectomorph9657
@buffectomorph9657 2 жыл бұрын
You are the best 1up!!!
@sithusoe8797
@sithusoe8797 Жыл бұрын
That was awesome !! love it
@1upIndie
@1upIndie Жыл бұрын
Thanks for watching!
@Sillymonkeies
@Sillymonkeies 2 жыл бұрын
You rock man!! God Bless
@1upIndie
@1upIndie 2 жыл бұрын
You are welcome mate!
@eunit08
@eunit08 2 жыл бұрын
Great tutorial my guy!!!
@1upIndie
@1upIndie 2 жыл бұрын
You are as always welcome mate!
@fireball3588
@fireball3588 2 жыл бұрын
Very helpful Video! Thanks
@1upIndie
@1upIndie 2 жыл бұрын
Thanks, always glad I can be of service.
@Tormentadeplomo
@Tormentadeplomo Жыл бұрын
Thank you, very helpful.
@1upIndie
@1upIndie Жыл бұрын
Ah, thanks for the trust that my content is useful to you.
@beanandbunstudios1800
@beanandbunstudios1800 2 жыл бұрын
I love your content, you are much apprecitated!
@1upIndie
@1upIndie 2 жыл бұрын
Thanks, hope that stuff helps.
@AdamBarkerThe
@AdamBarkerThe 3 ай бұрын
Hey indie you wouldn’t happen to have a video on field of view would you? Trying to make it so when an enemy sees you they switch states to chase. I was gonna use an object cone as a fov but I don’t like the idea of it going through objects and seeing you on the other side.
@1upIndie
@1upIndie 3 ай бұрын
Well sir, you may be in luck. I did a cone of sight in my remake hotline Miami in GameMaker series. kzbin.info/www/bejne/aqLXaKh8jZ6HY5o Was that what you are looking for?
@AdamBarkerThe
@AdamBarkerThe 3 ай бұрын
@@1upIndie ooooh awesome I think that might be exactly what I am looking for thank you!
@SpringDavid
@SpringDavid Жыл бұрын
hey man, do you know how to make the sprite change to fit its direction?
@1upIndie
@1upIndie Жыл бұрын
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
@heftykat
@heftykat 10 ай бұрын
@1upIndie Did you ever make a path 4? I want to learn how to make them not collide when chasing
@1upIndie
@1upIndie 10 ай бұрын
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: kzbin.info/www/bejne/h6mvap2gg7itb5o 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?
@tomlivingstone5520
@tomlivingstone5520 11 ай бұрын
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 11 ай бұрын
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?
@FoodCartel-DEV
@FoodCartel-DEV 7 күн бұрын
These videos are cool and useful But I wanted to know can you make it so the enemies collide. I tried my hand on it for a while but couldn't get it because I'm understanding this right I would have to make the grid again every time an enemy moved. Can you help, thanks
@1upIndie
@1upIndie 7 күн бұрын
Well, what you are looking for are anti-cluster/anti-overlap algos which are called "steering behaviors", which this method does not provide. Refreshing the grid constantly is needlessly resource intensive. I have seen some A* solutions, so that may be a way to find this. Or try the solution provided in this forum (OneExalted): forum.gamemaker.io/index.php?threads/keeping-enemies-from-touching.29105/ forum.gamemaker.io/index.php?threads/steering-behaviours-the-ai-system-everyone-needs-for-their-game.23370/ Hope that helps!
@RYTHETRO
@RYTHETRO 11 ай бұрын
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 11 ай бұрын
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.
@heikkiaho6605
@heikkiaho6605 2 жыл бұрын
Thank you very much!
@tasharules
@tasharules 8 ай бұрын
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 8 ай бұрын
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.
@azuli4440
@azuli4440 6 ай бұрын
im having trouble trying to figure out how do i make it follow you through the rooms, do you have any tips?
@1upIndie
@1upIndie 6 ай бұрын
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?
@victorsikkim
@victorsikkim Жыл бұрын
This video was very helpful to me, but I have one question: how to avoid stacking enemies in each other?
@1upIndie
@1upIndie Жыл бұрын
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 7 ай бұрын
@@1upIndie and do you know of any videos on this subject? I don't know how to do what you suggest. Thx
@1upIndie
@1upIndie 7 ай бұрын
@@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 7 ай бұрын
@@1upIndie Okay I see, thank you for your prompt reply.
@Artue0
@Artue0 Жыл бұрын
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 Жыл бұрын
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.
@nothesearechickens4203
@nothesearechickens4203 9 ай бұрын
I have a problem. My nemies get stuck on blocks moving to the player and I don't know why. please help!
@1upIndie
@1upIndie 9 ай бұрын
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.
@totleo
@totleo 8 ай бұрын
thx!
@angelosouza2821
@angelosouza2821 8 ай бұрын
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 8 ай бұрын
Not sure I can follow your thought pattern. What do you mean by random x,y of the path?
@angelosouza2821
@angelosouza2821 8 ай бұрын
@@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 8 ай бұрын
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.
@ultimateforestgaming1895
@ultimateforestgaming1895 2 жыл бұрын
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.
@gchd1232
@gchd1232 Жыл бұрын
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 Жыл бұрын
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
@gdiris4481
@gdiris4481 Жыл бұрын
pathing works but my enemy goes halfway through the walls, somethings weird with the collision mask
@1upIndie
@1upIndie Жыл бұрын
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 Жыл бұрын
@@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
@superzilla784
@superzilla784 Жыл бұрын
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.
@smokeback
@smokeback 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
@Waliente
@Waliente Жыл бұрын
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.
@jairosantos6062
@jairosantos6062 3 жыл бұрын
Thankx professor.
@1upIndie
@1upIndie 3 жыл бұрын
Hone your skills my pupil and you will also become one with bug report, haiiiisa.
@jairosantos6062
@jairosantos6062 3 жыл бұрын
@@1upIndie Yeah, I'm makinga a bug with a little game in it. ha ha ha ha
@studentesso
@studentesso 11 ай бұрын
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 11 ай бұрын
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 11 ай бұрын
@@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
@Tonzuurd
@Tonzuurd Жыл бұрын
Tengo un problema , y es que la room , las paredes , etc , estan de color verde y rojo , como hago para quitar eso?
@1upIndie
@1upIndie Жыл бұрын
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?
@Tonzuurd
@Tonzuurd Жыл бұрын
@@1upIndie si , muchas gracias :]
@abesses6630
@abesses6630 2 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@1upIndie Maybe I didn't understand something. But it doesn't seem to work :/
@1upIndie
@1upIndie 2 жыл бұрын
@@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.
@adrienchalono3287
@adrienchalono3287 2 жыл бұрын
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 2 жыл бұрын
When I reduce the size of the room it lags less but evrything disepear
@1upIndie
@1upIndie 2 жыл бұрын
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.
@gchd1232
@gchd1232 Жыл бұрын
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 Жыл бұрын
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
@БидонКадыкавич-х2ц
@БидонКадыкавич-х2ц 2 жыл бұрын
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.
@БидонКадыкавич-х2ц
@БидонКадыкавич-х2ц 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 жыл бұрын
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!
@jeorge5024
@jeorge5024 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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 Жыл бұрын
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.
@game-dev1782
@game-dev1782 2 жыл бұрын
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 2 жыл бұрын
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
@LuthersLounge
@LuthersLounge 2 ай бұрын
let's say for example I had obj_player run an instance_destroy command when it touches the zombies. When I do this, the game crashes for me. I even made sure to put in a "if instance_exists" statement and it still crashes. I think it's because they're seeking the player's position rather than the exact coordinates. I'm not too sure, though. Any help would be appreciated. Very helpful video, though. You have my thanks!
@1upIndie
@1upIndie 2 ай бұрын
You are correct in your assement here, the code looped in the alarm is getting the x,y value of the player instance, if it is not there (gamemaker cannot get values out of no existent references/data) the game crashes. Technically it makes no difference if you give some fixed x,y coordinates to search for or current player one's (it should not crash) and check if it exists. What you could is to create a player_Parent object and have 2 children (check out inheritance if you are not sure about it). The obj_player itself and a obj_dummy. The dummy is being spawned when you destroy the player on the same spot (when you destroy it). So you have in the search code then target_x = obj_Player_parent.x; target_y = obj_Player_parent.y; instead of the "old" code. You always have then a target coordinate That should fix the issue. Hope that helps! Video on inheritance/parent child objects: kzbin.info/www/bejne/r6XSiKtmbZaKjc0
@LuthersLounge
@LuthersLounge 2 ай бұрын
@@1upIndie Thank you sir. That's helps a lot with the player issue. You have my subscription. However, I have allies in the game that shoot at obj_enemy_parent and use the same path-finding scripts to get to them. This creates a similar, if not the same, issue, when they shoot the enemy and the enemy instance is destroyed. Even though there are other instances of obj_enemy_parent for them to seek out. It seems that the instance they're following get's destroyed before the path can update and seek another instance. I assume this is true, because the game randomly works fine and randomly crashes with a similar error message. Edit: For some reason the game didn't like me using variables. Now instead of target_x = target.x and setting target.x to an instance_nearest command, I just set it as target_x = instance_nearest(x,y,obj).x. Idk why I couldn't have just used a simple variable. It crashes a lot less now for some reason. And congrats to you for keeping up with a 2 year old video. Someone with as much dedication at that deserves more subs.
@1upIndie
@1upIndie 2 ай бұрын
@@LuthersLounge Thanks for the trust in subbing. Hm, I wonder why the game is being unstable because normally it works or it instantly crashes (normal experience for the last 5 years with GameMaker). Variables are pretty set in stone, either you declare them in the create even for further use or have temporary ones (var keyword) and can use them only in that event where thery are being declared. So it can be the engine (contact the offical YoYo help desk, it always has been not good on mac devices in the past) or code that does work wonky at times. If you are unsure, maybe use the offical GameMaker or my personal discord channel and ask for help there. You can better answers there then me doing guess work (which sometime does help though).
@jordanferrazza8700
@jordanferrazza8700 2 жыл бұрын
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
@ryanabner4040
@ryanabner4040 2 жыл бұрын
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/
@porucznikananas2600
@porucznikananas2600 2 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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!
@vocenaoentendeunada2505
@vocenaoentendeunada2505 Жыл бұрын
To it to work I need to watch Pathfinding #1 & Pathfinding #2?
@1upIndie
@1upIndie Жыл бұрын
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.
@mendfi5427
@mendfi5427 2 жыл бұрын
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 2 жыл бұрын
Did you do draw_self(); in the draw event of your enemy?
@1upIndie
@1upIndie 2 жыл бұрын
@@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.
@jordanferrazza8700
@jordanferrazza8700 2 жыл бұрын
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 жыл бұрын
@@1upIndie Just wondering
@Breloomgames71
@Breloomgames71 3 жыл бұрын
And when he can't get to the player, instead of standing still, how do I tell him to do something else?
@1upIndie
@1upIndie 3 жыл бұрын
Well, you then do this with a state machine. One is state = "following" other to be ide or even roam randomly.
@Breloomgames71
@Breloomgames71 3 жыл бұрын
@@1upIndie From my honest opinion watching your videos I do not understand how you do not have more subscribers, thank you for answering me 👍
@boxedgamedev9462
@boxedgamedev9462 2 жыл бұрын
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.
@hothead1546
@hothead1546 Жыл бұрын
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.
@smidy3
@smidy3 3 жыл бұрын
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!
@1upIndie
@1upIndie 3 жыл бұрын
Holy! :DD
@deltanuub9755
@deltanuub9755 9 ай бұрын
Can you give me the source code by anychance? Thank you!
@1upIndie
@1upIndie 9 ай бұрын
Sure why not. Drop in my discord and I send you the project file.
@e_buffturtle
@e_buffturtle 3 жыл бұрын
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 3 жыл бұрын
That will be fixed in the Hotline Series video.
@0ADNewbieRush
@0ADNewbieRush 2 жыл бұрын
@@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 жыл бұрын
@@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 жыл бұрын
@@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: kzbin.info/www/bejne/hZ7Rho2DaZJ1bNE
@fredxvi
@fredxvi 2 жыл бұрын
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 жыл бұрын
@@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!
@Norhiree2137
@Norhiree2137 Жыл бұрын
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.
Optimisation Tips | GameMaker Studio 2
19:10
FriendlyCosmonaut
Рет қаралды 51 М.
RESOLUTION guide for game devs & GameMaker
8:50
Sara Spalding
Рет қаралды 66 М.
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 46 МЛН
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 128 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 40 МЛН
Top Down DnD & GML Tutorial in Gamemaker #4 Enemy A.I.
36:19
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,2 МЛН
Making a VIRUS for a Game Jam (and almost winning)
9:36
Deynum Studio
Рет қаралды 333 М.
Making the Ultimate Platformer Game in 30 Days | Devlog 1
10:58
🔴Game Maker Studio 2 | Advanced - Earthbound npc follow
15:25
Object States | Game Maker Studio 2
22:21
FriendlyCosmonaut
Рет қаралды 138 М.
Simple Lighting System in GameMaker Studio 2
16:18
GameMaker Casts
Рет қаралды 20 М.
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 46 МЛН