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

  Рет қаралды 46,981

Slyddar

Slyddar

Күн бұрын

Ensure you Like and Subscribe for more exciting Gamemaker content, or check out slyddar.com/ for more info.
At the end of this series the player will shoot enemies with his bow, and even throw bombs to deal area of effect damage. The enemies will have path finding algorithms, and we'll add visual effects to make a cool game you can show your friends.
** What will I learn? **
In this tutorial we continue our top down journey towards Gauntlet as we create an enemy which detects the player, and then uses path finding to follow them, while avoiding walls. We also add code to destroy the enemy with our arrows.
NOTE: Patreon supporters can download the source code for this tutorial, and also watch any bonus content, over on the Patreon site - / slyddar
Also I am offering my Moving Platform Engine for free, if you have donated at least $20 through Patreon. Contact me if you qualify for this offer.
Keepers of Pyrite is currently a work in progress. To get the latest information, follow at / keepersofpyrite
The asset pack for this tutorial can be downloaded here -
** IMPORTANT! ** You don't need to request access to download this. Find the download button up the top right and just download the zip file.
drive.google.c...
Some sprites shown are from this collection - 0x72.itch.io/d...
If you want to learn more GML, check out my Udemy course using the coupon code from the Facebook post, which will give almost 90% off.
How to make Tile Based Platform Games with Gamemaker Sudio 2 - Discounted Coupon Code - slyddar.com/20...
The trial version of Gamemaker Studio 2 can be used, and is available here -
www.yoyogames....
Join our community Discord - / discord
Follow me on Twitter for more Gamemaker content
Twitter - / slyddar
Facebook - / slyddar
If you want to be notified of my new content, or things related to Gamemaker, sign up to my newsletter - eepurl.com/dHBHyn
Gamemaker Studio 2 is made by Yoyo Games.

Пікірлер: 128
@chrishodgkinson322
@chrishodgkinson322 2 жыл бұрын
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.
@Jerementor
@Jerementor 2 жыл бұрын
Respect! Great tutorial, and unbelievably cool that you include both the DnD and GML. Great job :)
@AquosFrost
@AquosFrost Жыл бұрын
bro you do GML and DND! thats a good tutorial!
@elizabethkawinski1721
@elizabethkawinski1721 2 жыл бұрын
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!
@killerkartoffl
@killerkartoffl 2 жыл бұрын
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 жыл бұрын
Can't promise anything, but thanks for the suggestions.
@lordekko7277
@lordekko7277 Жыл бұрын
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!
@darkhunter777
@darkhunter777 2 жыл бұрын
Да вот единственное что хорошо в Game marker это свет, а остальное все говно. Там ни текстур нормальных не вставить ни менюшки сделать нормальной нельзя 😁
@e_buffturtle
@e_buffturtle 2 жыл бұрын
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 жыл бұрын
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().
@joshbutler2563
@joshbutler2563 2 жыл бұрын
Phenomenal, top-tier quality work as always. I appreciate everything you put out. You deserve WAY more attention than you get.
@yes3714
@yes3714 2 жыл бұрын
In this tutorial seiries, can we get a video on an inventory and different weapons?
@matt.137
@matt.137 2 жыл бұрын
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
@willgamer101dondon7
@willgamer101dondon7 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.
@TabbedOutRat
@TabbedOutRat 6 ай бұрын
still here from the first video.
@victorsikkim
@victorsikkim Жыл бұрын
how to avoid stacking enemies in each other?
@Tancanvin
@Tancanvin 6 ай бұрын
Hi, my enemy is not moving. I dod everything right. But it is still not moving
@Tancanvin
@Tancanvin 6 ай бұрын
Nevermind. I set the enemy as the parent instead of a child
@LaserGadgets
@LaserGadgets 6 ай бұрын
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.
@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.
@WGY_Games
@WGY_Games Жыл бұрын
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 8 ай бұрын
what's your game?
@WGY_Games
@WGY_Games 8 ай бұрын
@@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)
@derDeydrihmOrcsTale
@derDeydrihmOrcsTale 3 ай бұрын
You, Sir, are more than just a hero. Without that i would struggle with hsp and vsp and collisions for ages!
@ShaneTheCreep
@ShaneTheCreep 6 ай бұрын
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.
@lando1296
@lando1296 4 ай бұрын
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.
@duckyy3129
@duckyy3129 2 жыл бұрын
Another tutorial would be awesome your content is the best your sooooo underrated your the best
@duckyy3129
@duckyy3129 2 жыл бұрын
By another tutorial I mean part 5
@Yamatoetlafindumonde
@Yamatoetlafindumonde 8 ай бұрын
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
@IMPOSTERPEELY
@IMPOSTERPEELY 5 ай бұрын
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
@Quaffyson
@Quaffyson 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
@Teedubzzz
@Teedubzzz 4 ай бұрын
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?
@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
@tjj1171
@tjj1171 2 жыл бұрын
Hey great to see you making another tutorial.
@فلورنت
@فلورنت 2 жыл бұрын
We are you
@deathincarnatesplace
@deathincarnatesplace 5 ай бұрын
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.
@bvmgerb6357
@bvmgerb6357 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 11 ай бұрын
Thank you!
@Niandra
@Niandra Жыл бұрын
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 Жыл бұрын
There are answers for this on yoyo's gamemaker forum. Look for grid movement examples.
@facundobrandi1116
@facundobrandi1116 2 жыл бұрын
hello, this is a very good tutorial, I'm waiting for the next one please
@RPAS1
@RPAS1 11 ай бұрын
Teacher, can I repeat these codes in my commercial project?
@gristlycrown6459
@gristlycrown6459 Ай бұрын
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 Ай бұрын
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.
@drawfull
@drawfull 4 ай бұрын
This is fantastic, thank you so much.
@BSS2151
@BSS2151 17 күн бұрын
Where did you get the enemy sprites from?
@machan6635
@machan6635 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.
@anthonypacitto3958
@anthonypacitto3958 2 жыл бұрын
Awesome tutorial!! I was wondering if you can provide a method for preventing enemy overlapping?
@happy_run
@happy_run 2 жыл бұрын
This is a cool series
@Littlemik15
@Littlemik15 2 жыл бұрын
Just want to say im loving the series! And that im patiently waiting for part 5 🙂
@Slyddar
@Slyddar 2 жыл бұрын
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.
@Qwerka
@Qwerka Жыл бұрын
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 7 ай бұрын
I have figured it out until then XD
@deathincarnatesplace
@deathincarnatesplace 5 ай бұрын
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 5 ай бұрын
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.
@thisguy3444
@thisguy3444 Жыл бұрын
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 11 ай бұрын
@@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)
@drawfull
@drawfull 4 ай бұрын
Thanks!❤
@Slyddar
@Slyddar 4 ай бұрын
Wow, thank you!. You're my first donation through KZbin, 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! ❤
@t90gamemakervietnam8
@t90gamemakervietnam8 2 жыл бұрын
Thanks for your tutorial, so cool !!!
@me.3some2024
@me.3some2024 4 ай бұрын
i love ur lesson, plz more
@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 ;(
@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.
@djeka415
@djeka415 2 жыл бұрын
Thanks for tutorials 🙏
@bunnyqueen20XX
@bunnyqueen20XX 10 ай бұрын
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.
@DEEP0
@DEEP0 3 ай бұрын
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 Ай бұрын
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 5 күн бұрын
@@Slyddar that's gonna save me an accumulation of at least...15 minutes over the span of a year! thanks buddy 😸
@vohuuthang7217
@vohuuthang7217 10 ай бұрын
i love you
@Lemonade-ip1jf
@Lemonade-ip1jf 2 ай бұрын
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 Ай бұрын
At 19:08 we add the path variable to the parent object. Make sure you have done that.
@Lemonade-ip1jf
@Lemonade-ip1jf Ай бұрын
@@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 Ай бұрын
@@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.
@specialx9856
@specialx9856 2 жыл бұрын
high quality as always thanks.
@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)
@n1ght_v1be
@n1ght_v1be Жыл бұрын
"im not gonna be dumb this time" proceedes to make it be the price of 1 blood instead of 0
@TheSpooker9000
@TheSpooker9000 Жыл бұрын
no idea whats going on but it works so you dont hear me complain
@felupan
@felupan 2 жыл бұрын
My enemies are not even appereaing on the game
@zackwellgans5265
@zackwellgans5265 3 ай бұрын
Mine too
@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 жыл бұрын
Episode 2, 3 and 4 are dual DnD and GML videos.
@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, KZbin 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
@xrqton
@xrqton Жыл бұрын
what an amazing tutorial - thanks so much mate. Learned so much.
@walkanadavih
@walkanadavih Жыл бұрын
❤❤
@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.
@thegamingbean953
@thegamingbean953 Жыл бұрын
Thanks for tutorial man, it really helped me with my game
@Slyddar
@Slyddar 10 ай бұрын
Great to know, maybe you can sub to show your appreciation :D
@babybear7586
@babybear7586 2 жыл бұрын
It didn't work
@e_buffturtle
@e_buffturtle 2 жыл бұрын
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.
@Kukatoo
@Kukatoo 2 жыл бұрын
great tutorial!
@yusufmuhamet973
@yusufmuhamet973 2 жыл бұрын
make a lot of GML :)
@VernorsDoctor
@VernorsDoctor 2 жыл бұрын
Please make this a big and extensive series
@posthuman2716
@posthuman2716 2 жыл бұрын
Where is GML ?
@Quaffyson
@Quaffyson 2 жыл бұрын
cant wait for the next one
@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 Жыл бұрын
use winrar
@marcindomanski5654
@marcindomanski5654 2 жыл бұрын
you should focus on GML - its easier to understand
@Slyddar
@Slyddar 2 жыл бұрын
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).
@hypn0man
@hypn0man 2 жыл бұрын
Great tutoril, it was very useful
@hypn0man
@hypn0man 2 жыл бұрын
When is the next one though?😅
@Gamemode_10000
@Gamemode_10000 Жыл бұрын
i got 3 errors
@Slyddar
@Slyddar Жыл бұрын
If you're boasting, congrats, that's impressive! If you're after help, you'll need to post what the errors actually are.
@Gamemode_10000
@Gamemode_10000 Жыл бұрын
@@Slyddar thy dk what obj_player x and obj_player y is
@Slyddar
@Slyddar Жыл бұрын
If you have an error, post the actual error so we can help you.
@BannedAccountofnsofublanvpam
@BannedAccountofnsofublanvpam Жыл бұрын
lmao bro, be specific. show some love lmao
Top Down DnD & GML Tutorial in Gamemaker #5 State Machines
24:18
Beginner GameDev Mistakes - Ep 1
6:40
Sara Spalding
Рет қаралды 164 М.
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 12 МЛН
Do you choose Inside Out 2 or The Amazing World of Gumball? 🤔
00:19
Officer Rabbit is so bad. He made Luffy deaf. #funny #supersiblings #comedy
00:18
Funny superhero siblings
Рет қаралды 13 МЛН
Creating SMART enemies from scratch! | Devlog
5:40
Challacade
Рет қаралды 332 М.
How I Learned to Create GAMES (No School Required)
9:47
Goodgis
Рет қаралды 573 М.
Top Down DnD & GML Tutorial in Gamemaker #3 Projectiles
20:47
How To Make Enemies Smarter: AI Weighted Decision-Making
11:37
Gamemaker Top Down DnD #1 - Can We Make Gauntlet?
27:08
Slyddar
Рет қаралды 97 М.
I redesigned my game
23:32
jdh
Рет қаралды 86 М.
RESOLUTION guide for game devs & GameMaker
8:50
Sara Spalding
Рет қаралды 62 М.
Top Down Tutorial in Gamemaker #6 Damaging Entities
28:31
Slyddar
Рет қаралды 13 М.
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 12 МЛН