Smart Enemy AI | (Part 2: Patrolling & States) | Tutorial in Unreal Engine 5 (UE5)
Ойындар
In this Unreal Engine Game development Tutorial you will learn the following:
- Patrolling: How to make an enemy AI patrol along a spline
- States: How to switch between different states in behavior trees
- Priority: How priority works in behaviour trees and how to abort low priority tasks for higher priority ones
- Animation Montages: How to setup montages and montage notifies to trigger certain actions
Link to my Patreon (Thank you for your support)
/ alizoh
Link to part 1 of the "Smart Enemy AI" tutorial:
• Smart Enemy AI | (Part...
Link to the "Damage System" tutorial:
• How to Build a Combat ...
Link to the "Projectile System" tutorial:
• How to Shoot Projectil...
Link to my "AOE Damage & Healing" tutorial:
• How to do AOE damage a...
About me:
I've been learning game development for over a year now, I do have a background in software engineering, but I've always wanted to create my own game.
I am currently working on this 3rd person action adventure game as a hobby, but I am also trying to build a community, thus I am creating KZread tutorials to find others who are interested in game development and design.
If you are interested in learning more or if you are interested in working together, please let me know in the comments.
Join my Discord server to chat and mingle with the community
/ discord
If you would like to support me on Patreon, you will get access to all the source code from every video I post as well as any custom assets that I create. Also I would be forever thankful to my early adopters
/ alizoh
Checkout my other tutorials on my channel:
/ @alielzoheiry
Chapters:
00:00 Outcome of this part
01:07 Assets used
01:56 Creating the PatrolRoute actor
07:48 Assign the PatrolRoute to the Enemy
08:53 Creating a Task to Move Along Patrol Route
10:11 Enemy AI Interface
12:06 Implementing the task MoveAlongPatrolRoute
13:56 Updating the Behavior Tree
14:33 Testing the patrol behavior
15:27 Modify Enemy Movement
23:08 Idle when not patrolling
25:19 Switching between States
28:40 Using Blackboard decorators
30:04 Testing Switching Between States
34:18 Aborting Behavior Tree Tasks
38:01 Sheath Sword Animation Montage
43:13 Sheath Sword Task
44:24 Updating Behavior Tree
48:13 Final Outcome
48:34 Next Up in Part 3
#unrealengine #unrealengine5 #ue5 #gamedev #smart #enemy #combat #AI #blueprint #tutorial #behavior #tree #patrol #patrolling #state
Пікірлер: 427
For anyone having issues with the WieldSword functionality, it's good to know that I didn't show how to edit it to include an animation, but it is the same as the UnWieldSword, so if you want to add that animation make sure to also include an event dispatcher (Call onWieldSword) from your enemy blueprint, and update the task to only Finish Execution when OnWieldSword is dispatched (Just like we did in the SheathSword from 40:45 to 44:20)
@djtc2093
8 ай бұрын
When you say "update the task" - which task or do you mean create a new task for equiping it?
@AliElZoheiry
8 ай бұрын
@@djtc2093 here I'm referring to the wieldSword task in the behaviour tree, because a lot of people had issues with this, and almost everyone forgot to call finish task (with success true) ONLY when the onWieldSword event is dispatched
@djtc2093
8 ай бұрын
@@AliElZoheiry 100% - thank you.
@tomerhertz8502
7 ай бұрын
can you please add the files for this tutorial please? (if you still have the proj files that is)...still heaving problem with it, after i followed your instruction for debugging the WieldSword functionality
@tomerhertz8502
7 ай бұрын
BTW, the problem i had, was in the SheathSword and WieldSword tasks...i was connecting the finish execute to the bind event instead to the finish custom event respectively in both tasks
These are seriously the best tutorials I've come across. No fluff, great pacing, and even though they're over 40 minutes long each, I know they're worth watching bcz you do such a good job explaining everything, and it's not filled with useless information like modeling a character first, or animating something, straight to the point and topic of the tutorial. Thanks for all your hard work making these AI tutorials, they couldn't have come at a better time for me since I'm implementing a combat system right now. You've definitely earned a subscriber.
@AliElZoheiry
7 ай бұрын
Hey! Thank you soo much for this comment. It really keeps me motivated when I see that my content is this helpful to people, so thank you for appreciating the effort that went into this 🙏🙏
@nholmes
5 ай бұрын
@@AliElZoheiry I'm a game designer with 25+ years of experience working in various proprietary engines and I'm learning UE for the first time. I cannot thank you enough for putting this video together! Teaching this old dog some new tricks! 🤣🏆🎉
The thing I love about your videos, is that I can actually absorb the information without have to race the instructor that goes on to do a millions things before you complete what you are doing and understand it... spacing in videos like this is SOOOO important.
@AliElZoheiry
4 күн бұрын
Thank you so much for your kind words! I'm really glad to hear that you find the pacing of my videos helpful for absorbing the information. I'll definitely keep that in mind for future tutorials.
6.5k views - 222 likes - 104 comments. come on people, don't be so lazy. such minimum effort needed but it means so much to the content creator. 👍
@Hobcakes
9 ай бұрын
You're absolutely right and honestly it's a really good video.
@AliElZoheiry
3 ай бұрын
I don't know how I missed this comment 7 months ago. I really appreciate the support 🙏❤️
Your tutorials are absolutely insane and I really enjoy watching them. You really find the right balance of digging into topics, tempo and - my personal highlight - level of coding quality. Looking forward to see and learn more from you!
@AliElZoheiry
Ай бұрын
Wow! Thank you so much for the support Max. This means so much to me, I appreciate you 🙏😊
Amazing tutorials! I've been looking for a detailed tutorial on advanced AI like this for months. Thank you so much :)
@AliElZoheiry
8 ай бұрын
You're very welcome! Thank you for watching and I hope you enjoy the rest 😊🙏
Hi, Ali. I am learning so much from your tutorials. I do have one suggestion. Make sure that what you are referring to is visible on the screen. There are many instances where what you are typing is cut off. This is true whether it is in the window or full screen. Thank you for the hard work on these tutorials. This is helping me understand AI.
@AliElZoheiry
Жыл бұрын
Thank you, I indeed noticed this in a few other videos, In my latest 2 videos I started only zooming on important details which would otherwise be too small on screen, so hopefully this issue isn't happening anymore
I've only been building BluePrints for about 3 weeks and I was able to follow along easily with a few minor debugs needed for my own errors. Thanks for the great work and I look forward to watching the next one in your video list!
@AliElZoheiry
6 ай бұрын
That's great to hear! I'm very happy this was beginner friendly as well. The aim for this series is to be beginner friendly while still teaching intermediate and experts a lot of new things.
This series I by far the best taught content I've watched on Unreal here on KZread
@AliElZoheiry
5 ай бұрын
Thank you so much for your kind words! I'm glad you found the series helpful and well-taught. Appreciate your support!
Amazing tutorials! Learning a lot in here. You just got yourself a new patreon! Can't wait to continue the rest of the tutorials! Keep up the good work!
@AliElZoheiry
9 ай бұрын
Thank you so much Twidie 💖 really glad that you are finding my content helpful, and i'm really grateful that you joined my Patreon. I appreciate you 🙏😇
You have by far the best, cleanest, most to the point and easiest to follow tutorials I've seen on here. This is helping me resolve a lot of little things I wasn't quite sure about in behavior trees. Now I finally know the RIGHT way to use them.
@AliElZoheiry
3 ай бұрын
Thank you so much for your kind words! I'm really glad to hear that my tutorials are helping you out with behavior trees. Your feedback means a lot to me! If you have any more questions or need help with anything else, feel free to ask.
Best Unreal AI content I have seen. Amazing work!
@AliElZoheiry
10 ай бұрын
Thank you ❤️ really glad you found it useful
This tutorial is everything i pretty much been looking for so far. Wow
@AliElZoheiry
10 ай бұрын
Glad it was helpful! Thank you for watching 🙏
Thanks for the tutorial series. Very clear and easy to understand. I got stuck for atleast a day trying to move from the "set movement speed" to the "Move along patrol route" stage. Watched the video over and over and couldn't figure it out, added loads of print screens and got nowhere... It turned out that I used a selector instead of a sequence for the patrol state... FML :D onto Episode 3!
This has really helped me alot I was so scared to get into making ai but you have made it so clear and easy to follow I still dont understand ai but I understand more than I did so thank you so much! I'll be sure to credit you when I make my game!
@AliElZoheiry
Жыл бұрын
Really happy I could help you Gameboy, I appreciate the support, and looking forward to teaching you more.
@Clydiie
Жыл бұрын
@Ali Elzoheiry I'm currently watching and following part 3, and I'll be very excited to see what you do next!
مش شايف مصريين كتير يا بشمهندس علي بس بجد أنت فخر لينا أنت من الأخر جاااااامد شكرا ليك جدااا❤❤❤❤
@AliElZoheiry
4 күн бұрын
شكرًا جدًا لك! سعيد جدًا إنك استفدت من الفيديوهات 🙏
very well explained, without having much idea of English I understood everything! For the following videos, thank you very much! greetings from BCN
@AliElZoheiry
8 ай бұрын
Hey Sergi, thank you for the support, I'm very happy you found this useful ☺️🙏
These are so good Ali, incredibly clear and explanatory. Keep 'em coming!
@AliElZoheiry
4 күн бұрын
Thanks! I'm really happy to hear that you find the videos helpful. I'll definitely keep them coming 😉
thanks so much. I am quite a noob with unreal AI, and I followed along quite easily and had no problems getting to work.
@AliElZoheiry
7 ай бұрын
You're most welcome Supa, always happy that I could help ☺️🙏 thank you for watching
Amazing channel! I'm gonna binge-watch all your videos.
@AliElZoheiry
9 ай бұрын
Glad you like it that much. I appreciate your support 🙏
I'm loving this tutorial series so far great work keep it up
@AliElZoheiry
3 ай бұрын
Thank you so much for the positive feedback! I'm glad to hear you're enjoying the tutorials.
Awesome, thanks you Ali.这是我见过最好的AI教程
@AliElZoheiry
10 ай бұрын
You're welcome 🙏 I'm very happy that you enjoyed it 😊
Once again great stuff, completely devoured this tutorial. Love.
@AliElZoheiry
2 ай бұрын
Thank you so much for your comment! I'm thrilled to hear that you found the tutorial helpful and enjoyed it. Stay tuned for more great content! 🙏
Awesome, thanks you Ali. Been waiting for it
@AliElZoheiry
Жыл бұрын
Hope you enjoyed it Sajjad and thank you for the support. Part 3 is coming out soon as well
Amazing tutorials! Learning a lot in here. Keep up the good work!
@AliElZoheiry
5 ай бұрын
Thank you so much for your kind words! I'm thrilled to hear that you are finding the tutorials helpful. I'll definitely keep them coming. Keep up the great learning!
Amazing!! As per usual, loving this series so far, thank you!
@AliElZoheiry
Ай бұрын
So happy to hear you're enjoying the series! Thank you for your support 🙏
Starting this series after completing load and save system which was fantastic. You teaching style is amazing - problem and solution based which i found very helpful in learning process. Just leaving this comment to encourage you to produce more videos in more series especially in multiplayer system login using facebook/google, messenger style chat using dedicated server , and save and load in multiplayer system. Keep up the good work man . Cheers 🎉
@AliElZoheiry
2 ай бұрын
Hey, thank you so much for your kind words and suggestions! I really appreciate the support and I'll definitely keep your ideas in mind for future videos. Cheers! 🎉
Hey Ali! Great work with the video. Proberly the best guide in the world ngl.
@AliElZoheiry
6 ай бұрын
Thank you for the kind words! I'm really glad you found the video helpful. Your support means a lot!
Thank you soo muchhhh!! im a C++ developer and making a stealth game, sadly the ai documentation is very bad and usually i take the Bp logic and translate to c++ in a optimal way. You r awsome!
@AliElZoheiry
Жыл бұрын
Yeah the documentation for C++ is quite lacking, I will be making some C++ tutorials as well soon because some systems are only available in C++ so stay tuned ;)
Ur series is amazing and you are very appreciated
@AliElZoheiry
6 ай бұрын
Thanks so much for saying that. I appreciate you too 🙏
oh yes ,been waiting for this. Thanks
@AliElZoheiry
Жыл бұрын
Thank you Cliff! Hope it has what you need, and definitely more to come soon 🙏
Loving my journey through these tutorials... I stopped right before the end and was going to add another decorator for "IsFocused" and got hung up a bit... clicked play and 2 seconds later you went into the focus fix 🤣
@AliElZoheiry
8 ай бұрын
Hahaha awesome, glad we were on the same page there
Thank you very much sir! Your tutorials are super useful!
@AliElZoheiry
3 ай бұрын
You're very welcome! I'm glad you found the tutorials helpful. Thank you for watching and commenting 🙏
Look, I'm Brazilian and I understand very little English, but honestly what fantastic teaching, even with little understanding your content is very complete and explanatory, I would definitely buy something from you, you're very good at what you do, you deserve recognition
@AliElZoheiry
3 ай бұрын
Obrigado! Estou muito feliz que você está achando útil, a sua mensagem me motiva muito. Muito obrigado pelo seu apoio!
Learned so much from the firs episode of this series. I didn't know anything about behaviour trees and after watching the first episode and then practising on my own I am a lot more comfortable with it. Thank you Ali you are my Unreal Sensei, keep up the excellent work :)
@AliElZoheiry
10 ай бұрын
I'm very happy to hear that, you're welcome man, thank you for watching 🙏
Thank your for this series this will help me alot :) thanks so much
@AliElZoheiry
9 ай бұрын
You're very welcome! Thank you for watching :)
Great video, thats what I was looking for
@AliElZoheiry
2 ай бұрын
Hey there! Thank you for watching and commenting! I'm glad the video was able to help you out 🙏
Excelent tutorial, you are my favorite now
@AliElZoheiry
7 ай бұрын
Thank you! Glad you are enjoying them 😇🙏
really great tutorials, thank you very much
@AliElZoheiry
8 ай бұрын
You're very welcome! Thank you for watching
Great Tutorial, thanks man :)
@AliElZoheiry
25 күн бұрын
You're very welcome! I'm glad you found it helpful 🙏
These videos have been such a help! Thank you and keep it up! +SUB!
@AliElZoheiry
Жыл бұрын
Thank you for the support 🙏 I'm always happy to hear that my tutorials are helping people, I hope to continue helping you :)
Man you are the one of my the best explores in this year. Really. Bow for your efforts.
@AliElZoheiry
2 ай бұрын
Thank you so much for your kind words! I'm thrilled to hear that my content has been helpful to you. It means a lot! 🙏
I liked and subbed with all 3 of my accounts, i will be teaching these concept to my friends, thank you
@AliElZoheiry
11 ай бұрын
Thank you for the support 🙏 really glad you find it useful
These videos are really good :)
@AliElZoheiry
4 ай бұрын
Thank you so much for your kind words! I'm really glad to hear that you're enjoying the videos. If you have any specific topics or requests, feel free to let me know. Happy learning!
Hi Ali , im really excited about the series . Im just bum out that sometimes i dont understand your math, especially the Patrol Index. Im trying my best to understand it, had to crush my head. Hopefully ill knock some sense into my own brain :D
@AliElZoheiry
Жыл бұрын
Hey Danny, let me try to explain it simply. The patrol index is just the point on the spline that the enemy is currently on starting at 0 (meaning the first point) so when the enemy moves to the next point we need to add 1 to that index (so then the patrol index is equal to 1 which means the enemy is at the second point in the spline) then we need to check if we reached the end of the spline, by checking if the index is equal to the number of points in the spline (but minus 1 because we started at 0 not at 1) then if we reach the end we just start subtracting 1 from the patrol index instead of adding 1 (this we change the direction to be -1) and do the reverse once we reach point 0 on the spline again. Hope it makes more sense now
@DannyshRosli
Жыл бұрын
@@AliElZoheiry Hey Ali ! Thank you very much clearer now , thank you so much !
@udoma8
2 ай бұрын
@@AliElZoheiry My thought since has been how you figured out this particular logic, it is clean and also very uncommon while looking common
This tutorial is great thank you
@AliElZoheiry
6 ай бұрын
You're very welcome! Thank you for watching 🙏🙂
Im a complete noob and managed to follow this great (yet complexed) tutorial.. I kept leaving comments asking for help but then would follow the logic from what I asked and debug.. Then comment again with a new problem and delete as it changed aha. This is my final comment to say thank you.. Most my issues were to do with leaving a box unchecked or not connecting a pin for example I hadnt connected WeildSword to execute Bind event in the BTT_weildSword and in Sheathe sword so the BT wasn't finishing the task and getting stuck haha.. Having the comments to read through definitely helped me to fill in gaps on parts I had missed or you had done outside of the edit. Thanks for another great tutorial. Took me about 4 hrs as a noob to troubleshoot my mistakes :)
@AliElZoheiry
Ай бұрын
Hey, thanks for sharing your journey with the tutorial! It's really great to see how you were able to troubleshoot and solve the issues on your own. Your perseverance definitely paid off. Glad the comments were helpful, and I'm happy you found the tutorial useful. Keep up the great work!
love it very helpful
@AliElZoheiry
6 ай бұрын
Great to hear that! Thanks for watching and commenting
Thanks a thousand times!
@AliElZoheiry
2 ай бұрын
You're very welcome! I'm thrilled to hear that you found the content helpful. Thanks for the feedback! 🙏
Thank you teacher Ali. Like part 1 your tutorial are very detail moreover your teaching and how you explain are really amazing. I also consider WieldSword function that didn't show in video as homework. Even now I cant count the spline point and don't know why it need to -1. The Spline point function are the last thing that I cant understand. Also it took me nearly 2 month to understand overall how the function operate, That make me realized how I lack of the foundation [Gonna cry in corner]
@DaviesMurphy
Ай бұрын
for example you have 10 spline point in your patrol spline point index 0 = spline point 1 ... ... ... spline point index 9 = spline point 10 index as defaulf start 0 but your point of number going 1 , 2 , 3...
@jedtanartkulprakrom4616
Ай бұрын
Thank you so much
@AliElZoheiry
Ай бұрын
Hey there! Thank you so much for your kind words and for sharing your thoughts. I appreciate your dedication to understanding the concepts. Don't worry, taking your time to fully grasp the material is commendable, and it's okay to take a bit longer to fully understand everything. Keep going, you're doing great! 🙏 P.S, checkout the response from @DaviesMurphy, it sheds light on how incrementing the spline point works! Thanks for that Davies
For anyone having issues about being stuck in A state of flip-flop, hence not being able to change states. The problem might be the keyboard key. You can try using the enhanced input system. I first had a problem with the "Tab" button, but when I used it with the enhanced input actions, the problem was solved.
thks for this series
@AliElZoheiry
10 ай бұрын
You're very welcome 👍
amazing bro, gracias
@AliElZoheiry
11 ай бұрын
De nada, glad you liked it !
Awesome video! thank you so much again for your incredible capacity to explain things. 10/10 would recommend.
@AliElZoheiry
10 ай бұрын
You're very welcome, I'm glad you found it useful, and I appreciate your support 🙏☺️
I like that the way you design these, you are using best practices for how you would set it up for an actual game. Most tutorials just focus on getting it functioning superficially for the purpose of the video.
@AliElZoheiry
Ай бұрын
Thank you for your comment! I really appreciate it. My goal is always to make sure the tutorials I create are not only functional but also designed with a real-world game development approach in mind. I'm glad you noticed that! 🙏
Amazing!1
U ARE GOD ! MORE TUTORIAL LIKE THIS !
@AliElZoheiry
Жыл бұрын
Thank you Marcus. I hope you enjoy the rest of the series 🙏
@konspiracni_teorie_official
Жыл бұрын
@@AliElZoheiry I will check every your tutorial and hope you will continue, u are doin greet job !
omg i figured it out all good aha thank god aha aweosme
@AliElZoheiry
11 ай бұрын
Nice! Glad you figured it out. Mind sharing with the people here what the problem was and how you fixed it?
Great content so far! My AI has been severely lacking. And, these videos are just what I need. I'm wrapping up for the day. I've only had one issue that I cannot seem to figure out. When I press "1" the first time, everything works great, and I created an UnsheathSword Montage similar as you did, and spawn the sword using a Montage Notify as usual when working with Notifies. But, the Enemy will not turn to face the Player as it unsheathes the sword. It will unsheath, then turn to the Player everytime. I've tried playing around with different things, and I'm not quite sure what is going on. Other than that everything looks great. I've debugged the AI Behavior Tree, and it looks like it flashes by the BTT_FocusTarget(with AttackTarget as the Attack Target Key) and goes directly to the BTT_UnsheathSword I created under the BTD_IsWieldingSword Decorator. That is all within the first sequence. The numbers on the nodes look correct. I'm not sure why it is skipping the BTT_Focus Target Task though. EDIT: For now, I'd just added a Wait 0.5 Seconds Node to the middle of the sequence. So it will Focus wait half a second, then unsheath the sword. This gives the AI enough time to turn and face the player, even if directly behind the AI. Using 5.2.1, but don't think much has changed in this regard.
@AliElZoheiry
Жыл бұрын
Thank you! Glad you've been enjoying the content If your AI is taking a long time to turn it could be the rotation speed of the enemy character is slow. If you're not using the default manny character and default settings, make sure to match it to the default manny settings for rotation speed and see if it helps
@theindiegamedude
Жыл бұрын
@AliElZoheiry - Thanks for the tip! I was actually thinking the same thing when I woke up this morning. Oftentimes, I wind up waking up with a proper solution XD Just got in from some morning endurance cycling. I'm going to get going on my projects in a half hour. And, this will be the first thing I test. Adjusting the turning/rotation speed on the ai mesh.
@Dominicn123
8 ай бұрын
hey man, did you figure it out? i'm having the exact same issue as you and i don't think it's the rotation speed
@theindiegamedude
8 ай бұрын
@@Dominicn123 - Sorry. I never did figure out the issue with the enemy not facing the player. I just left in the Wait half a second node to the AI Tree which I mentioned above. At this point I think I'm running off a copy of one of Alizoh's source files I downloaded a while back. I didn't think of looking for the change in the source for that particular issue. When I downloaded the source project, and started working off of that.
So a few things...I'm going to hang with this but you move a little too fast and I think you forgot to show what you did around 41:00 regarding the changes you made to the initial Weird Sword. But so far I'm liking it.
@AliElZoheiry
2 ай бұрын
Hey, thanks for your feedback! I indeed didn't show the changes to the WieldSword, because they are exactly the same as the SheathSword event, and I showed the event in the blueprint, so you can pause and see what's happening there if you'd like
Your great 😃
@AliElZoheiry
5 ай бұрын
Thank you so much! I really appreciate your kind words and support. 😊
quality vid!
@AliElZoheiry
2 ай бұрын
Thanks for the support! Glad you enjoyed it 🙌
you are really best, im deleted my old ai system in only BP and im trying to use now BT. You are best man and you are best man again and you are best best man. Change your channel name to "BEST MAN"
@AliElZoheiry
3 ай бұрын
Thank you so much for your kind words and support! I'm really happy to hear that you found my content helpful as you transition to using behavior trees. I appreciate your enthusiasm and encouragement!
Nice guide. algorithm. + like.
@AliElZoheiry
4 ай бұрын
Glad you found the guide useful! Appreciate the support 🙏
@AliElZoheiry
7 ай бұрын
😊🙏
These videos are great! I find myself stumbling through UE5, how did you get to the point where you could build behavior trees, tasks and functions on the fly?
@AliElZoheiry
5 ай бұрын
Thank you! I'm glad you're finding the videos helpful. Building behavior trees, tasks, and functions became easier with practice and experimentation. I recommend trying out small projects to gradually build your skills and confidence in UE5. Keep experimenting and learning - you'll get there!
Great videos @AliElzoHeiry one small thing and im not sure if its covered in a later video but the character jitters a bit in animation when it reaches the spline point. like its deciding whether to keep walking at the next spline point. can this be made smoother somehow or is it just the nature of using splines?
@AliElZoheiry
Ай бұрын
You can play around with the character movement settings, things like declaration and acceleration speeds and friction, etc.. these can help you get a smoother effect
The more better way instead of using a Interface or Cast is to Store Data in ActorCOmponent , this is a great feature using which we not only make Less Coupled things but also modular things
@AliElZoheiry
7 ай бұрын
Hey Brock, thank you for the feedback. I indeed use actor components heavily later in the series when I start integrating a damage system and attack system
@BROCKSGAMING
7 ай бұрын
@@AliElZoheiry I see, that's great then and btw I loved your end result that's why I started watching, if you could make a enemy which can predict player moves like attack, flank
This zooming in and out all the time is making me seasick. The quality of the sound and video is great you dont need to do all the zooming. Awesome tutorial series, learning a lot!
@AliElZoheiry
8 ай бұрын
Hey Kasper, thanks for the feedback, I did indeed realize that the zooming was unnecessary and stopped doing that in the later videos of the series. Glad you're finding it useful ☺️🙏
Just out of curiosity, I'm just trying to make a simple Souls-Like Boss fight, I have the basics for the AI BT you've shown in the 1st episode, I was wondering what videos in order I could watch to get to the final 3 videos without missing anything important. For reference the character I'm following with is the boss I just don't need him patrolling/ hiding to get health if that makes sense? Love the series though and will definitely be coming back to learn more soon! 😄
@AliElZoheiry
5 ай бұрын
Hey Darryd, not sure I can tell you which videos to skip because the entire series is built sequentially, so there might be a slight change I make in one video that is used in a later one. What you can do though is check the "chapters" that are timestamped in each video, and they will give you an idea on the contents of that video, then decide whether to skip it or not
Hey, thanks for the tuturial! What can you say about Advance Locomotion System library? Have you tried it?
@AliElZoheiry
11 ай бұрын
You're welcome mate I haven't tried ALS myself, but I've seen it un multiple projects and it seems very good and flexible , so it's a good start for getting something done quick, but if you want your character movement to be unique for your game, then building your own is better
In the behavior tree tasks that you create you are casting to the enemy base class. Do you think it would be more efficient to either update the BBkey through the enemy blueprint by using "get ai controller>get blackboard>set blackboard value as..." OR would it be better in the behavior tree to cast only once and store the enemy reference instead of casting every created task?
@AliElZoheiry
10 ай бұрын
Once we start adding the enemy AI interface, I won't be casting as often since I'll be calling interface functions, but in general, casting isn't a performance heavy operation, so you can cast on each tick, hundreds of times and it won't be a performance issue unless it's thousands of times per tick
Hey great video! Just one thing, in my project, when drawing the Ai's sword, the Ai slides towards me as he is playing the animation. Once sword is unsheathed. Would you have a clue as to why the Ai slides during the draw sword animation? Cheers!
@AliElZoheiry
Жыл бұрын
Thanks Wahbz! Regarding your issue it could be a number of things so I can't tell you exactly the cause of the issue, just make sure to retrace your steps, debug your tree and see what's firing when and why by adding print statements
Thanks for these awesome tutorials! I do have one issue with the Blackboard Decorator that is on the CombatState Selector. With it on, the enemy only runs the PassiveState side of the BT. With it off, the enemy will try to move to AttackTarget, but slingshots around the area never actually reaching the player. I don't know what the issue is, but any insight would be much appreciated.
@AliElZoheiry
Ай бұрын
I'm not really sure I understand the issue, but if it is regarding the decorator not succeeding/failing correctly, then I suggest checking the implementation of the decorator and seeing when it returns false/true. Otherwise, some common mistakes are: - Using "Selector" when you mean to use a "Sequence" node - Setting the wrong input parameter to a decorator or task
@AliElzoheiry Thanks so much for this tutorial, I’ve been looking for something like this for days, and finally found it on my recommendations. I am having a weird issue with the Behavior Tree where my Set Movement Speed Task keeps resetting itself to "Idle" every time I close and reopen the Engine. Do you have any idea of what could be causing this?
@AliElZoheiry
8 ай бұрын
Hey, you're very welcome 🙏 I've experienced this issue with some BT tasks as well. I found that deleting the task and adding a new one sometimes fixes it
@jocslzr1
8 ай бұрын
@@AliElZoheiry Yes! Thanks for replying, I fixed it by closing the BT before closing the engine, I think it might be a bug related with autosave. It’s been causing some issues for me lately.
@AliElZoheiry
8 ай бұрын
Just one of those weird engine bugs I guess, glad you fixed it 💪@@jocslzr1
I love you
In part 1 we built the "BP_Enemy_Base" code (pt 1: 37:00 - 41:07). But it looks like that code got replaced by completely new code, of unknown origin, appearing here in this Part 2 at 8:16. I've spent a week on this tutorial. I've redone this and part 1 a few times now, and I can't get it working. Here's how mine works: Press "1" the first time: Enemy just stops patrolling and stares at me. Press "1" twice: Enemy slides along his patrol zone and continually unsheaths Press "1" third time: Enemy slides, then finally runs and attacks me. Press "1" fourth time: Enemy sheaths a few times and returns to his Patrol Path; the sword never disappears. After tearing out most of my hair, I gave up and downloaded the project zip. When I open that project and play, the Enemy AI faces me, unsheathes, and then runs behind a wall, faces the wrong way, and swings at empty space a few times. Is there a way to get a project download at the point where the action makes sense at the end-point of this video?
@AliElZoheiry
Жыл бұрын
Hey Heavenseek, so the enemy blueprint was not completely replaced with something else, as mentioned at 1:14, I just changed the WieldSword event and behavior tree task to include an animation and an event dispatcher, which I proceed to explain at 38:20. It sounds like your problem is likely with the wield sword event and behavior tree task, make sure that in the WieldSword event you dispatch OnWieldSword and in your task you bind to this event dispatcher and only call Finish Execute then, just like we did for the unwield task at 43:55
@heavenseek
Жыл бұрын
@@AliElZoheiry Thanks, I'll search for those and try to fix.....
@AliElZoheiry
Жыл бұрын
@@heavenseek Hey man, I found a bug in the engine that might be causing your issue. It happened to me today when I restarted the engine, I found that the Blackboard keys on the "BTT_MoveToIdealRange" in the tree got reset and I had to manually select them again. Meaning that I had to Change the "IdealRadius to be either the AttackRadius or the DefendRadius (depending on whether I'm attacking or strafing) and the AttackTarget set it to AttackTarget as well. Hope this helps
@heavenseek
Жыл бұрын
@@AliElZoheiry Thanks very much, I will definitely check that out! 🙏
@vidmaster7
Жыл бұрын
This is exactly what is happening to me. I followed the directions exactly and have gone back through them several times. I can't see where the discrepancy is. I'll take a look at Ali's suggestions here.
Excelent Video, I have a doubt, in my case my character when he appears on the map makes the animation of drawing his swords, but I want him to not move while he is doing it, so I put a wait at the beginning of the Passive State, it worked but then to advance point o'clock it is also expected, do you know how to make the wait only at the beginning and not repeat itself anymore, thank you.
@AliElZoheiry
Ай бұрын
If your character is doing an action and that action is triggered by a behavior tree task, then you shouldn't Finish the task execution until the action has ended, that's why I added the event dispatcher in the wield and sheath sword functions, to tell the task that the animation is over and you can move to the next node. This is what you should do as well, because a wait node won't work for all animations since they have different timings
Hey Ali, i was having an issue with reversing the sheathsword animation. the enemy would'nt play the montage if its reversed, but he was able to play it unreversed. i checked the BT. and when id swap to the attack state, it would just get stuck on wield weapon and he would'nt wieldSword. If i use it not reversed, functionally it works and hes able to spawn the weapon. Im not sure why that is, everything seems correct. Could it be the anim notify ? it works fine on the sheathsword animation, but should i do something else if i reverse the play rate of the animation ?
@AliElZoheiry
Жыл бұрын
Hey Shino, not really sure what the issue is, but if the montage notify isn't being triggered in the reversed montage, try deleting the notify and adding it again, it often happens that notifies become null when you make changes to the montage after adding it
@ThadeousM
6 ай бұрын
@Shino2213 I got stuck here to. My issue was, I had used the wrong method to reverse the animation. Check that you have changed the PLAY RATE by clicking the animation segment in the montage timeline Make sure you have not changed the RATE SCALE like I had! Plus reseting the also helped
Hey, not sure if this is addressed at some point but at the end of the last tutorial, the enemy snaps to the new direction it's moving in instantly. How do you make it turn smoothly like you have starting in this video? Awesome series of videos BTW! Very clear explanations and I'm learning a lot. Thanks for sharing your knowledge!!
@AliElZoheiry
8 ай бұрын
You're very welcome. glad you're enjoying it and finding it useful so far. Regarding the enemy rotation speed, if your enemy is not rotating smoothly, then this is likely due to the "rotation speed" variable on the characterMovement component in your pawn class, try adjusting that and seeing if it helps
@driftmirror
8 ай бұрын
@@AliElZoheiry I had to turn off "Use Controller Rotation Yaw" checkbox for it to turn smoothly. It wasn't respecting the rotation rate at all initially.
@dreambadger
7 ай бұрын
@@driftmirror This is the answer. Also, you can still set the rotation speed on event begin play from the character movement component - thinking about it though I could just change the default. One thing I do is that when my enemy attacks, I set the rotation speed down to like 30-50 from the montage exit pin, which gives the attack some give without glueing to the player, like if you're running near an enemy and it attempts a claw attack or something, and then on montage complete or interrupted pin, i set back to my standard rotation speed of 120. Think about smoothing on your blend spaces too. i had an awful animation jank on a creature when it would close the distance with the player, then initiate attack montage and the legs would just move to quickly. It was essentially the blendspace speed approaching 0 (idle) that I forgot to apply any smoothing to. So I set to one second and it's a relatively smooth transition now. I'm really happy how Ali's tutorials are working in my prototype.
this episode ruined it for me bro, everything was going amazing until this episode, about 3/4ths through the video things began not working right with the enemy, after the whole sheath thing. i followed exactly and went over things three times to ensure no node is incorrectly done, i can see a LOT of others had issues here too, i went on after this video and the other videos are good but this one is the issue one, i know you've defended your edits and actions in the comments but this video seriously desrves a re-do, but go over things completely as you do them, this is the ONE video hurting this entire playlist.. i found this video on reddit, on the UE sub there was about a dozen users who praised the tutorial but warned against part 2 of it, which i ignored because i assumed that i could figure out where they had issues, looks like it got me too, this video is mostly good but had a vital error keeping it from being as polished as your other vids, please re do it bro.
@BadNewsStudio
8 ай бұрын
DUDE yes!!!!! I found this on reddit yesterday too but not on that sub, it was from the game devs sub, u/NoFrillaz or whatever shared it but told people to skip the second video because he skipped a lot of steps later on in the vid and it messes up a lot of ppl lol I've been trying to redo things 4 times now and have the exact same issue!!!! it makes me so angry because everything else is SO good!! but darn it
@ong8163
8 ай бұрын
me too I am having trouble with it around that part , my enemy freezes and jitters when supposed to be switching, I agree I wish he can remake it, please Ali
@arthurwilliamsmukambe6014
8 ай бұрын
yes bro it was all good until this one, its hard to explain to him about what mine does but reading all the other comments i can see everyone that has issues with this vid, hasthe exact same issue because mine is doing same and it just make me frustrated and i've rechecked everything, please ali it won't take much effort to just redo this one, it will make ur playlist perfectly i've done the following 3 videos after this one and they all are good but the issue on this video has roots that lead and branch out to the after vids.... i've redone this tutorial 3 times now because of this issue, thinking i missed something but no, it's literally all from the sudden addition of nodes later on, even if u mentioned a few changes at the start that doesnt gloss over things, just please redo it in full and show things as you mention them!!! @@BadNewsStudio
@Dominicn123
8 ай бұрын
i'm having issues too, with the wield sword function part, i know he pinned a comment with a solution but that doesn't quite resolve things in full. i'm hoping for a re-do too haha, i've been stuck on this video for 4 days now
@AliElZoheiry
8 ай бұрын
Hey all, just to be clear, there is nothing wrong with the tutorial, you can follow it from start to finish without any problems. The reason I wrote this comment, and the reason you might be having issues, is that event dispatchers, and behaviour trees are a new way of working for most of you, so it can be confusing, but I assure you, the content itself is tried and tested and works perfectly, if you are having issues, feel free to join the Discord server and we have a youtube-help channel there where you can ask your question, provide details, then I or someone else can help you there. Just make sure first to check the existing questions in case you find the solution you're looking for. Good luck 🤞
I gonna comment in every video
@AliElZoheiry
5 ай бұрын
Thank you so much for your commitment and support! It really means a lot to me. Looking forward to your comments on future videos!
9:36 Use interface instead of casting (because the 'increment patrol route' function will apply to all types)
@hype._.
3 ай бұрын
Thank you very much😲
@AliElZoheiry
3 ай бұрын
Thank you for the suggestion! I appreciate your input on using interfaces for a more versatile solution.
@hype._.
Ай бұрын
8:38 (in Scene)
Hi, Nice tutorial!! I have a question. I followed yours but my default AttackTarget can't find target (It shows "None") when I game start and doesn't attack me. If I toggle manually, It works good. How do I can solve my problem? Thanks!
@AliElZoheiry
4 ай бұрын
Hey there, glad you enjoyed it! If you are referring to the blackboard value reverting back to none when you restart the engine, that’s unfortunately a known issue with unreal engine, if you delete the node and create a new one, it often fixes it
hey Ali, i've been really enjoying your lessons on this as i've been trying to do this whole playlist, everything was amazing up until about 70% through this video when it came to flip flopping between hitting the '1' key... i can see many others are having issues as well. i've tried a few fixes and i just can't figure out where the issues are, i've thoroughly scanned the nodes to make sure they're all connected exactly as yours as well, they are good. but could we skip this portion where we press the 1 key, and be good? because in the following videos we're setting up the ai to act independently, so i don't see for there to be any need to set up my ai with the 1 key, would i be able to continue and be good if i skiped the last portion of this video? because we won't be using it later right?
@AliElZoheiry
8 ай бұрын
Hey Dominic, the functionality of pressing 1 to get to the enemy to follow you is just for testing, but if it's not working, that probably means you have another issue with the enemy behaviour that will still occur even if you skip that part. Most people who were facing this issue were having different bugs. Some related to the event dispatcher not being called or binding incorrectly, some had bugs in the behaviour tree, etc.. so it could be anything. If you're interested in learning how to better find and fix bugs, I have a video on that kzread.info/dash/bejne/npqg08aansLPo9o.htmlsi=uuNEQicb9ihrna48
@Dominicn123
8 ай бұрын
i just became a patron so i'm gonna check out your project files@@AliElZoheiry
@Dominicn123
8 ай бұрын
okay so i have it downloaded from your dropbox link and have it now opened, its way different so i'm assuming this is the final project from the end of the series as well, so it has a ton of different things on it, everythings changed around from this episode, do you have project files per episode or is it all just one file?@@AliElZoheiry
@AliElZoheiry
8 ай бұрын
@@Dominicn123 unfortunately I don't have the project saved after every tutorial, that would fill up all my cloud storage very quickly 😅
@ong8163
8 ай бұрын
me too
Hi, I wonder is there any way to make the ai follow a specific patrol route when spawned, like for example an ai spawner when the ai is spawned, how to make that ai follow a specific patrol route, thank you. Btw love your vids!!
@AliElZoheiry
2 ай бұрын
Hey there. This is the topic of the video, how to make a specific route and have the AI follow it, not sure if you meant something else
aha i for the life of me cant seem to find current index or set current index or idex only the variable but doesnt look to same and cant plug in two variables aha what do i do
In my UE5.2, at 29:13 in the video, the key query option does not show "Equal to", instead it shows two "Not Equal to". Do you know the cause of this? The cause may be the version. Which type of UE do you use?
@AliElZoheiry
11 ай бұрын
That's very strange 😅 there should definitely be an equal to, regardless of what engine version you're using. Try restarting the engine and make sure you don't have any weird 3rd party plugins enabled that might mess with the default settings. Also check different projects to see if they have the same issue, that would narrow down if it's an engine problem or a problem with the settings of a specific project
@user-kv6sg3gq2d
11 ай бұрын
@@AliElZoheiry I don't mean to deny that, I changed the version to 5.0.3 and it worked. LOL. Apparently there is a bug in 5.2.1.
Really Appreciate your teaching Sir. Followed along with my custom Ai as Zombie from Mixamo. Everything works fine, except after SHEATHING THE SWORD, the Ai is not going back to the BTD_HasPatrolRoute Sequence. It got stuck on the BTD_ISWieldingSword Condition forever. I don't seem to figure out the problem! Can you kindly help?
@AliElZoheiry
2 ай бұрын
One possible solution to this problem could be related to the event dispatchers and binding in the behavior tree task. Make sure that the event dispatcher for when the sheath sword event has finished is firing correctly and that you are binding to it correctly in the behavior tree task. Additionally, you can debug your code to narrow down the problem. You can check what's happening step by step to identify where the issue might be occurring. If you still haven't found a solution, you can also refer to my bug fixing video for some tips on troubleshooting bugs. Here is the link to the video: kzread.info/dash/bejne/npqg08aansLPo9o.htmlsi=bOIk8RofIkZ9n5_I I hope this helps you in resolving the issue with your AI.
Second Best:)
@AliElZoheiry
Жыл бұрын
Thank you Bedirhan! Hope you enjoy it 🙏
@bedirhan1833
Жыл бұрын
@@AliElZoheiry Actually, I was wondering how we can transfer what we learned to the 2.5 platform game, can you do a tutorial like camera animations for 2.5D game?
@AliElZoheiry
Жыл бұрын
@@bedirhan1833 My focus area for now is 3D, but I'll definitely consider it 👍
In the tasks should you have an is valid off of controlled pawn? In my case I'm going to have a bunch of zombies. COD zombies style. And in my prototype (where I just used blueprints instead of behavior trees) I'd get all kinds of errors when they died unless I put is valid like everywhere lol
@AliElZoheiry
2 ай бұрын
Hey there! It depends on how you implement the death logic. If you unpossess the pawn from the controller, then you should stop the logic of the behavior tree anyway, so it doesn't matter if there is an isValid check. Generally, if you're controlled pawn is ever inValid, then that means you have something else wrong in your implementation, because that case should never occur
Hello. In the video at 32:40, you add "Cast to AIC_Enemy_Base". When I press 1, it stops right at this Node. The cast simply fails. What could be causing this? Thank you
@AliElZoheiry
6 ай бұрын
The only reasons for the cast to fail is either you are casting to the wrong class, or you didn't set the AI controller to the pawn
I cannot get the NPC to move to spline points. I'm not sure where the breakdown is because the AI debug says it's the current task, but the NPC doesn't move. I went back through the tutorial twice and I don't know what I'm missing. The only thing that I've changed from the original tutorial is I promoted the Acceptance Distance to an exposed variable on the AI Move To inside the BTT_MoveAlongPatrolPath task so I could modify it directly from the main behavior tree, and replaced the Scene Root Actor with a custom sprite billboard that is easier to find among all my world objects - I'm still able to assign the BP_PatrolSpline actor to the NPC, so the reference isn't broken as far as I can tell, and it's not abandoning the task when I put it on a selector to choose between patrolling and chasing, so I have no idea why it won't move. I haven't gone beyond timestamp 15:25 because AFAIK the implementation is broken somehow and it shouldn't be an issue with UE 5.3 - does anyone have any helpful advice for what I could be missing? Any help is appreciated.
@AliElZoheiry
6 ай бұрын
Hey, I can't really tell what your bug is just from this description, so I suggest that you add breakpoints or print statements in the patrolPath to see if it's printing the values you expect, that will help narrow down the problem. If you still can't figure it out, feel free to join the discord server and ask your question in the help channel there with more details and screenshots (Link in the description)
This is probably a specific problem I had but an easy fix anyway, my set focus wasn't working so the AI didn't focus on the player before drawing the sword, then I found out that I set the AI rotation settings to Orient Rotation to Movement instead of Used Controller desired Rotation.
@AliElZoheiry
3 ай бұрын
Glad to hear you found the solution! It's often the specific details that can make all the difference in debugging. Keep up the good work!
I'm sorry, I am having trouble assigning the patrol route spline to my character. I can't find any linkable parameters in my BP_Enemy_Base to the spline and your Video is blocking the view at 8:50 Any clues? Great tutorial btw!!! Congrats!!!
@AliElZoheiry
9 ай бұрын
Hey Erik, so the "PatrolRoute" variable we created in the enemy class should "Instance editable", which means you need to click on the "eye" icon next to the variable name in your blueprint, or make sure the checkbox for "Instance editable" is checked. Then when you select on your enemy in the World. You can search for that variable in the details panel and assign it the value of your patrol route (which also has to be placed in the world first)
@erikfischer5021
9 ай бұрын
THX!!!@@AliElZoheiry
@ericcrary2380
6 ай бұрын
Thank U!!!! U are the best. @@AliElZoheiry
im having an issue, when i restart the engine in the behavior tree in the tasks BTT_MovementSpeed, the value of the speed of the enum resets to idle, even if i save the BT and so the enemy at the engine restart wont move, because it is resetted to idle, can you help with that? Btw best tutorial series
@AliElZoheiry
6 ай бұрын
Hey there! This is indeed a known issue with unreal engine, I found that sometimes deleting the task and adding it again, prevents this issue from happening, but not always. Give it a shot and let me know
I have just come to the section near the end and to the Behavior tree and noticed yours has changed in the passive state from the first video, but haven`t showed what you did.
@AliElZoheiry
Жыл бұрын
Ahh good catch Cliff, I must have changed it when I wasn't recording and forgot to update that part. If you would like me to explain something in Discord, feel free to ask your question there and I'd be happy to answer
(SOlVED)I've had an issue with the Switch on name nodes after the animation montages not executing's. I troubleshooted and found that the animation montage is blending out and completing without firing the notify. I have moved the notify to the very first frame of the animation montage, this hasn't seemed to help. I was just making notifies in the animation montage, not using the "Montage Notify" once i created These Notifies. It works
@AliElZoheiry
8 ай бұрын
That's indeed a common issue. I talked specifically about that one in my "How to fix bugs" video
Amazing tutorial. I do have a small problem. When the enemy reaches one of the spline points it waits for halve a second and then continues to move again, but it doesnt smoothly continue as shown in your video. Any idea why this is happening?
@AliElZoheiry
3 ай бұрын
It could be the character movement settings you have are different, things like acceleration and friction can affect the movement of your character. I am personally using all the default settings that come with the UE mannequin (except the things I changed in the tutorial)
Hello, I've made progress and have gotten up to Updating the Behavior Tree at 14mins and for some reason my ai isn't moving along to the next patrol route. I've doubled checked the creation of the MoveAlongPatrolRoute and it looks right. It move along and isn't being called even though in the behaviour tree it is being called but doesn't seem to run the BP_MoveAlongPatrolRoute. Any suggestions for what is going wrong?
@Secretlycat31
11 ай бұрын
I found it, I had missed connecting one line
@AliElZoheiry
11 ай бұрын
Everything working now?
@Secretlycat31
11 ай бұрын
Oh if only :) I've broken down my current issue is coming from the MoveToTarget part on the Behaviour Tree. Atleast when everything is disconnected it isn't running past there. It just loops it very quickly and doesn't attack or do anything. Not sure why either so thats fun@@AliElZoheiry
@Secretlycat31
11 ай бұрын
What things would effect the MoveToTarget part? as I might have messed setting on one of them but going through them I can't tell