Top Down DnD & GML Tutorial in Gamemaker #4 Enemy A.I.

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 132

  • @chrishodgkinson322
    @chrishodgkinson322 3 роки тому +28

    I just love the way you explain things in such a way that it makes potentially difficult things easy to understand. Also, kudos for the amount of effort that you must put in each episode having to film it twice and then edit it all together for GML and DnD at the same time. Much, much respect.

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

    You, Sir, are more than just a hero.
    Without that i would struggle with hsp and vsp and collisions for ages!

  • @Jerementor
    @Jerementor 3 роки тому +11

    Respect! Great tutorial, and unbelievably cool that you include both the DnD and GML. Great job :)

  • @joshbutler2563
    @joshbutler2563 3 роки тому +5

    Phenomenal, top-tier quality work as always. I appreciate everything you put out. You deserve WAY more attention than you get.

  • @WGY_Games
    @WGY_Games Рік тому +6

    Although I didn't use this tutorial for a dungeon crawler, I did use it for a horror game monster. Great tutorial either way!

    • @sveninspace
      @sveninspace 11 місяців тому

      what's your game?

    • @WGY_Games
      @WGY_Games 11 місяців тому

      @@sveninspace Haven't done any public things regarding it yet. I wanna keep it under wraps until I'm content with how it looks. But it's a different take on the "mascot horror" trend that has become so stale as of late. (Minus Shipwrecked 64, that game slapped)

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

    Thank you very much for this video. Just starting out in Gamemaker and this video helped teach me a lot of the simpler concepts of making a game.

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

    For those of you wondering how Slyddar put down multiple enemies holding 'Alt', it's actually 'Right Alt', not 'Left Alt'. Just found out about it today

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

      Actually I was using left Alt, but both left and right work the same.

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

      @@Slyddar I'm not sure if that is true back then or that they've updated using Alt's, but currently using Windows and making something right now, you can only use 'Right Alt' to put down multiple objects. 'Left Alt' now acts like a dragging of the camera/room around

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

      I'm using the latest stable version, 2022.3.0.625. That's normally what middle mouse does. In my Preferences, Redefine Keys, 'Paint with Resource' is set to Alt. No left or right alt, so maybe your one is different.

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

      @@Slyddar Yeah honestly quite interesting and weird, my middle mouse also does same thing, but so does my alt when I have that button and left mouse clicked for the object I want to place both at same time.

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

      @@machan6635 you most likely have the laptop mode turned on at the top of the panel, next to the zoom buttons.

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

    Hey great to see you making another tutorial.

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

    Just want to say im loving the series! And that im patiently waiting for part 5 🙂

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

      Hey, that's nice to know, I appreciate the comment. I'm editing part 5 now, so shouldn't be too much longer. Hopefully you are subscribed so you can see when it drops.

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

    bro you do GML and DND! thats a good tutorial!

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

    Thanks!❤

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

      Wow, thank you!. You're my first donation through UA-cam, so it really warms my heart you've done something like that. I very much appreciate your generosity, and really hope the content helps you make a cool game! ❤

  • @devinblack606
    @devinblack606 Місяць тому

    Just in case anyone runs into the same problem I did. If you have a create event in the child enemy it will override the one in the parent enemy. This caused an error telling me I had not defined the variable "path". I ran into this problem around the 23:30 minute mark of this tutorial. The solution was simple, delete the create event in the child enemy.

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

    This is a cool series

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

    This is fantastic, thank you so much.

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

    This video was really really useful, thanks!! Do you have any advice on how I would basically take this movement/collision and put it on a grid? So a character moves say 50 flat pixels every second, instead of continously moving?

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

      There are answers for this on yoyo's gamemaker forum. Look for grid movement examples.

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

    amazing video! how did move you move everything in the brackets along at 30:42, been looking for the shortcut everywhere but can't find it!

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

      In GML when you select multiple lines you can just press Tab to move text right or Shift Tab to move it left.

    • @DEEP0
      @DEEP0 2 місяці тому

      @@Slyddar that's gonna save me an accumulation of at least...15 minutes over the span of a year! thanks buddy 😸

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

    so amazing! i wait so long but its always a good tutorial! I rather 1 GREAT tutorial a month then 1 bad tutorial a week

  • @elizabethkawinski1721
    @elizabethkawinski1721 2 роки тому +5

    These tutorials are great! I'm having an error pop up in my Room Start event. My variables "_w" and "_h" are not defining, and so lower under "create motion planning grid" , the program is saying "Assignment operator expected". I've skipped back and can't seem to find the issue. Please help!

  • @duckyy3129
    @duckyy3129 3 роки тому +3

    Another tutorial would be awesome your content is the best your sooooo underrated your the best

    • @duckyy3129
      @duckyy3129 3 роки тому +1

      By another tutorial I mean part 5

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

    what an amazing tutorial - thanks so much mate. Learned so much.

  • @specialx9856
    @specialx9856 3 роки тому +1

    high quality as always thanks.

  • @killerkartoffl
    @killerkartoffl 3 роки тому +6

    Hey im working on a game and your tutorials are helping me alot. could you please make a tutorial about how to make an inventory and how characters can equip items?

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

      Can't promise anything, but thanks for the suggestions.

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

    Thanks for your tutorial, so cool !!!

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

    In this tutorial seiries, can we get a video on an inventory and different weapons?

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

    cant wait for the next one

  • @djeka415
    @djeka415 3 роки тому +1

    Thanks for tutorials 🙏

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

    hello, this is a very good tutorial, I'm waiting for the next one please

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

    Awesome tutorial!! I was wondering if you can provide a method for preventing enemy overlapping?

  • @VernorsDoctor
    @VernorsDoctor 3 роки тому

    Please make this a big and extensive series

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

    Is there a way you can make the enemies avoid a tile set (tile collision) instead of solid objects? I have both a solid tiles and objects that have a variable making them “solid”

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

      Yes. Use a height and a width for loop at a game room_start event and loop through each tile, checking for a collision_rectangle the size of the tile. When you find a collision, add that tile to the planning grid with mp_grid_add_cell().

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

    Thanks for tutorial man, it really helped me with my game

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

      Great to know, maybe you can sub to show your appreciation :D

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

    At 17:52 my grid is drawing, but it is drawing to the right and to the bottom of the walls instead of on top of them. I am not sure what is going on, I couldn't find anything different in my code.
    Edit: In mp_grid_add_instances, I changed false to true. Now it correctly highlights the walls, I'm not sure why this is. For some reason it seems like it was rounding causing the grid to be drawn offset to the walls.

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

      I had the same problem and your fix helped me, thank you.

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

      Thank you!

  • @matt.137
    @matt.137 2 роки тому +3

    have a question about the motion planning set up
    when i set up the code following the video using DND and tested it, the red boxes that the function draws ends up being way bigger than the actual size of my wall tiles. how do i fix this?

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

      having the same issue:(

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

      Yeah, same here.

    • @stickbug-grenade
      @stickbug-grenade 2 роки тому

      i solved it by changing the TS macro to 1

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

      @@stickbug-grenade When i did that the enemies were able to walk through the top of the Solid

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

      same issue here... if I set precision to true, it works. Not sure why this is necessary for me.

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

    "im not gonna be dumb this time" proceedes to make it be the price of 1 blood instead of 0

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

    i love ur lesson, plz more

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

    great tutorial!

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

    It works really good, I just have to figure out a small bug, very rarely I am crashing getting an error saying "Trying to assign to a non-existing path." When setting the player_found boolean. I can't quite figure it out yet, but I do know that the player is still alive when it happens.

  • @hypn0man
    @hypn0man 3 роки тому

    Great tutoril, it was very useful

    • @hypn0man
      @hypn0man 3 роки тому

      When is the next one though?😅

  • @theonewhoasked9834
    @theonewhoasked9834 7 днів тому

    hello so im working on a game with similar enemy ai however im having trouble with the path finding collisions, basically when the enemy walks next to walls or near walls parts of the sprite is just in the wall it can also walk thro spaces much smaller than its sprite size

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

    I Don't know if this is just me but it seems like this does not work as of right now where game maker is at, this is because i keep running into issue after issue even after rewatching the video a total of 4 times it just wont work even when I copy the code to a T.

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

      Sorry to hear, but alas, it still works perfectly, with many others implementing the code and having it work for them. This may not help you, but the source code is available to Patreon members. If that doesn't help you, I hope you found a solution anyway. Good luck, don't give up!

  • @serdar-bayram
    @serdar-bayram Рік тому

    hi, the enemies are shaking when in idle position. When my character moves closer to the enemy, the problem is fixed, but when the character moves away, they flicker when they go into idle position. How can i solve this problem.

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

    no idea whats going on but it works so you dont hear me complain

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

    im trying to create a hotline miami alike game, so the enemy shall look at the character whilst moving to the character. but while it is doing that, it goes straight into solid objects. how may i fix that?

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

      I have figured it out until then XD

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

    Amazing video, but can you make an tutorial entirely for dnd? I've seen you started that series, but I cannot find any episode from 2. Thanks!

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

      Episode 2, 3 and 4 are dual DnD and GML videos.

  • @CoyoteArcade-182
    @CoyoteArcade-182 7 днів тому

    how did you set up a collision layer ?

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

    Hey I’m trying to do the move toward poin function and when I put the 1 for the speed it won’t work can you plz help me

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

    how to avoid stacking enemies in each other?

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

    I got “runtime error variable not set” after adding “execute script check_for_player” everything works if I remove that piece of code

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

      Hard to tell, as you haven't provided the whole error. Can you copy and paste the whole error, and maybe I can help then.

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

      @@Slyddar i have the same error heres what its says ___________________________________________
      ############################################################################################
      ERROR in
      action number 1
      of Create Event
      for object :
      Unable to find instance for object index 6
      at gml_GlobalScript_Check_for_player (line 24) - move_towards_point(Obj_Player.x, Obj_Player.y, 2);
      ############################################################################################
      gml_GlobalScript_Check_for_player (line 24)

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

    Oh my goodness I need help I want to do this but I can’t read what you write I can’t tell what you put in it’s too blurry please help

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

    I have an issues with the ai, for some reason when im stopped the enemies will be put a ways away like the code says it should, but then for some unknown reason will inch forward toward me.

  • @R.P.G.G
    @R.P.G.G 6 місяців тому

    none of my variable are set before reading in the check_for_player script even tho i have them in the "create" on enemy_par, any ideas why this is or how to fix it?

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

    Hi, my enemy is not moving. I dod everything right. But it is still not moving

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

      Nevermind. I set the enemy as the parent instead of a child

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

    idk why but my enemies will just stop moving altogether if I stick close to my obj_wall. they will refuse to pathfind to walls that make a thin corridor-like space for my character to move to but the enemies wont enter it. idk what to dooo ;(

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

    hey this is working very well so far but im trying to get it to work for a platformer and having a few issues

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

      first issue is i cant get them to move towards the x position of the player if i start on their left side unless ive jumped over them. i also want them to be able to jump after the player but only if they detect the player and the player is above them (i learned about the choose event because of this tutorial so i know how to set it to be random now, thanks) second i have multiple player characters in the game how can i set it so they properly chase the closest player to them or the one who hit them last and finally im having trouble setting the speed to something that works i can send code if needed thank you to anyone who can help
      Edit*
      ive kinda figured it out, the problem was i needed to place the script in my horizontal Collison code, idk why that worked but now im having an issue where if they walk off a ledge they stay in mid air until they meet my x position while im not moving only then does gravity work. fixed trhe speed with what i did above. the only thing i need now is for them to jump over my solid_obj to get to me if necessary, to detect the all players available and to pick which one to follow.

  • @e_buffturtle
    @e_buffturtle 3 роки тому

    Is there a way to implement a minimum and maximum distance that enemies have between each other? I don’t want enemies to be too crowded up

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

      It's a tough problem to solve. You can run a collision event with the enemies, and compare their id's, so you can decrease the path speed of the lowest id. You also set an alarm to irandom_random(30, 60), which has code to increase it again if not in a collision with another enemy.

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

    im confused, when did the global.mp_grid receive a value? line 27 on the check for player script seems too request the value of it and now it won't launch? im lost

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

      I'm not sure what time stamp you are referring to. Come to the Discord if you need help, as it's easy to post code/screenshots there and get help.

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

    still here from the first video.

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

    Am I supposed to watch this in a series or something because i dont have check for player script. ik its 4# of a series but i thought it'd work on its own.

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

      You probably worked this out already but they all build on from the previous episode i.e. it's a series. You can't just pick and choose which ones to follow, you have to do them all in sequence.

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

      @@Slyddar oh so thats why my build is not starting! 😅I am just trying to have an enemy that chases you from left to right (it's not a top down) and I did everything you did in this video, but when I try to start it just says this (MainGuy is Player):
      ERROR in
      action number 1
      of Create Event
      for object :
      Unable to find instance for object index 1
      at gml_GlobalScript_CheckForPlayer (line 26) - move_towards_point(O_MainGuy.x, O_MainGuy.y, 1);
      ############################################################################################
      gml_GlobalScript_CheckForPlayer (line 26)

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

    hey anyone see at 17;42 when he puts in the game object how the grid convert to like 64 or something or 32. that jumping back and forth has caught my eye but seems not to matter so far.

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

      Each layer has it's own grid size, which you can set up the top right. We were on the Collisions layer, which is 32x32 and then I click on the Instances layer which has a 64x64 size.

  • @BSS2151
    @BSS2151 3 місяці тому

    Where did you get the enemy sprites from?

    • @Slyddar
      @Slyddar  6 днів тому

      The link to the sprites is in the description

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

    Very good video, good details and information. But gott damn you put more ads in this video than a TV channel ad break 😭

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

      Glad you like the video, but sorry about the Ads. I have no control over them. Even if I choose to put no ads and not monetize the video, UA-cam will put them on there anyway.

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

    If I wanted to add more than 1 type of enemy, how would I go about this

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

    ❤❤

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

    Teacher, can I repeat these codes in my commercial project?

  • @Lemonade-ip1jf
    @Lemonade-ip1jf 4 місяці тому

    Hi, I followed everything you said but when checking for player in the enemy check for player part it keep saying that my "path" variable is not defined. Can anyone help me with why this is?

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

      At 19:08 we add the path variable to the parent object. Make sure you have done that.

    • @Lemonade-ip1jf
      @Lemonade-ip1jf 4 місяці тому

      @@Slyddar Thanks, I checked, turns out I accidentally overwritten the create event in the parent object by adding a create event in o_enemy as well.

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

      @@Lemonade-ip1jf that was going to be my next suggestion. You can add event_inherited() to the top of the enemy create event to ensure it gets any parent code.

  • @Yamatoetlafindumonde
    @Yamatoetlafindumonde 11 місяців тому

    I got a problem with the room start event , at line 9 it says : GM1020 - the function mp_grid_create takes no less than 6 argument but 5 are provided.
    if someone can help me ! thanks

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

    hello slyddar you ever want to get a lot of views just show how to replace art at the end of an already made series. it will go crazy and just add it to your old videos.

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

    Can anyone help me? I’m having a problem when I get to the Clean Up event but I think my comment keeps getting hidden or something because I commented 2 times and it’s not showing up.

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

    i love you

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

    i cant download the sprites bc of the stupid winzip thing that i have to buy to open it

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

      Windows 10 comes with 7zip, so just right click and extract it. If that fails, go get 7zip.

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

      @@Slyddar thank you it really helped

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

      use winrar

  • @فلورنت
    @فلورنت 2 роки тому +1

    We are you

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

    make a lot of GML :)

  • @posthuman2716
    @posthuman2716 3 роки тому

    Where is GML ?

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

    My enemies are not even appereaing on the game

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

    i got
    3 errors

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

      If you're boasting, congrats, that's impressive! If you're after help, you'll need to post what the errors actually are.

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

      @@Slyddar thy dk what obj_player x and obj_player y is

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

      If you have an error, post the actual error so we can help you.

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

      lmao bro, be specific. show some love lmao

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

    Don't wanna be the negative nelly but there is almost no difference in regular code and D&D. Without knowing what to pull over, func var or whatever, its pretty much its just copying what someone is doing who is know what he is doing.

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

    you should focus on GML - its easier to understand

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

      That's easy to say if you use GML only, but for people who like using DnD, your opinion is to just leave them be and give them no resources to learn from? Being considerate to all is in my nature, and while I prefer to develop on GML, it doesn't mean I should ignore a whole bunch of people who choose to learn the same language a different way. Under the hood DnD is still GML, it just has a layer above allowing others to appreciate it in a different way. Just like life, be tolerable of other points of view, as it can be different to how you see things, but their learning goal may still be the same.

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

      You should create 2 different video - one with only gml and other with drag&drop, because in this approwach no one will be happy (or very happy).

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

    It didn't work

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

    Да вот единственное что хорошо в Game marker это свет, а остальное все говно. Там ни текстур нормальных не вставить ни менюшки сделать нормальной нельзя 😁