Smart Enemy AI | (Part 8.5: Fix Bugs & Improvements) | Tutorial in Unreal Engine 5 (UE5)

  Рет қаралды 9,558

Ali Elzoheiry

Ali Elzoheiry

Күн бұрын

Chapters:
00:00 Intro
00:33 1. Fix Idle Animations
01:52 2. Fix Enemy Respond to Damage
09:53 3. Fix Player Spamming Attack
12:20 4. Fix Enemy Switching States After Target Dies
14:57 5. Fix Enemy Sliding When Blocking
16:49 6. Fix Ranged Enemy Moving Away From Projectiles
18:28 7. Move Health Bar to HUD
22:26 8. Add Hit Reactions to Player
24:12 9. Improve Player Aim System
29:04 Bonus For My Patrons
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...
About me:
I've been learning game development for a few years now, I do have a background in software engineering, and I also have a background in education, so being able to combine my love of gaming and love of education is the best way to spend my time.
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 KZbin 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
#unrealengine #unrealengine5 #ue5 #gamedev #smart #enemy #combat #AI #blueprint #tutorial #behavior #tree #ranged #melee #damage #system #attack #block #defend

Пікірлер: 84
@ezelrza7572
@ezelrza7572 9 ай бұрын
GUYSSS, Why is the Decoupling between the number of views and likes? Friends, Ali is doing a very successful and self-sacrificing job here. In fact, this is something that applies not only to Ali, but to everyone who works hard. Reward your hard work. You may not have money. But at least you can like
@AliElZoheiry
@AliElZoheiry 9 ай бұрын
Thank you so much for your support Ezelrza, it means a lot that you like my content and that you're encouraging others to do the same. I appreciate it 🙏😊
@XvirusX
@XvirusX 10 ай бұрын
finally i found someone good that explain good and shows everything 🤗 subscribed and turned notifications man you are the best thank you so much for your tutorials
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
You're very welcome! I appreciate the support, thank you 🙏
@user-pn3ut7rw6c
@user-pn3ut7rw6c 2 ай бұрын
Thanks for another great lesson! I really enjoy the content.
@AliElZoheiry
@AliElZoheiry 2 ай бұрын
You're most welcome! I'm so glad you're enjoying the lessons and finding them helpful. Thank you for your continued support!
@Yggdrasil777
@Yggdrasil777 10 ай бұрын
Hi! You do some good work and I am enjoying your lessons on your channel. I wanted to leave a note, and I paused the video at this point, @20:00 you make a bind for the progress bar. That ticks with Tick (put a Print String on it and watch the magic). You should only need to update the progress bar if it has any changes to do, not every tick per second. It's a small thing at this moment, but could become quite cumbersome later. You will want to use an Event Dispatcher or a related function/event to have the UI updated only when the progress bar needs to be moved.
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Thank you 🙏 and indeed it's a bit overkill to call this on tick, but since it's doing a simple O(1) check that will always finish in constant time, then the impact on performance is negligible, if we had a loop or something there, then that definitely would be a bad idea 😅
@user-bj8bs3rg5q
@user-bj8bs3rg5q 3 ай бұрын
Спасибо за уроки! Вы как всегда на высоте!!!
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
You're very welcome! I'm glad you enjoyed the tutorials! 🙏
@moncef0147
@moncef0147 10 ай бұрын
YES, i noticed the range enemy avoiding the projectile in a previous video, and i thought huh, that's weird, so when you explained that the projectile itself was breaking the enemy's line of sight you blew my mind 😂. Great video as usual, keep up the great work Ali.
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
It's a very interesting bug indeed, some might even call it a feature haha 😂Thank you for watching as always ;)
@IbrahimSyah-kw3mi
@IbrahimSyah-kw3mi 4 күн бұрын
Emergent AI 😁
@roydash5657
@roydash5657 10 ай бұрын
You are the best! You just perfect developer
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
and you are the perfect supporter, thank you 🙏
@roydash5657
@roydash5657 10 ай бұрын
@@AliElZoheiry I am really so gladly supported amazing developer like a you
@occy999
@occy999 8 ай бұрын
to do the 2nd bugfix i changed the set passive state in handle sensed damage to set investigating state. made a variable in AIC called DamageStimulusLocation, broke the stimulus from can sense actor and set stimulus location as DamageStimulusLocation plugged that variable in the afformentioned investigating state and viola
@AliElZoheiry
@AliElZoheiry 8 ай бұрын
That could also work indeed, good job 💪
@user-go6ee7tf1q
@user-go6ee7tf1q Ай бұрын
17:00 Is exactly enemy AI instinct of preservation
@AliElZoheiry
@AliElZoheiry Ай бұрын
Hahaha Indeed, they are becoming conscious
@theindiegamedude
@theindiegamedude 10 ай бұрын
I'm curious about the "2 unavailable videos are hidden" at the bottom of this KZbin Playlist. Are those for the upcoming videos, which are perhaps scheduled into the future to release publicly? I've looked through your Patreon content, just to see if they are videos available to members only. Thanks :)
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Hahah I'm curious too, I see that notification, but I don't have any hidden videos, I think KZbin is just messing with us 😅
@theindiegamedude
@theindiegamedude 10 ай бұрын
🤣
@vidmaster7
@vidmaster7 10 ай бұрын
Hi, Ali. Thanks for your two most recent videos. I was able to incorporate the Damage System from your earlier tutorials. Right now, everything is functioning as expected EXCEPT one thing. As soon as I shoot either of the enemies, they remain frozen. I have looked through everything I created and compared it to yours. I focused on the AI Behavior Trees and the BP_Enemy_Base. I can't seem to find what is causing this. Any ideas? Thanks.
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Seems like an issue in the Hit response event, the enemy should call SetStateAsAttacking after the hit response is finished. Make sure that's happening, and the correct attack target is being passed
@derakon4791
@derakon4791 10 ай бұрын
😁 I think it's not bug you just make him too smart 😁 tnx for video
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Hahaha maybe he's learning on his own, true AI :D
@themeskimoze
@themeskimoze 10 ай бұрын
I know it's a great video without even watching it yet
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Thank you so much 🙏Hope you enjoyed it
@sebastianciesielski1553
@sebastianciesielski1553 10 ай бұрын
Hi, are you going to talk in one of future videos about handling positioning of multiple enemies at once?
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
It's definitely an interesting topic, I'll definitely consider it if there are enough people interested.
@sebastianciesielski1553
@sebastianciesielski1553 10 ай бұрын
@@AliElZoheiry I've got this implemented in the way that I've got fixed amount of point around the player in the melee range, and each oponent that wants to attack the player need to occupy one of the free slots. If no slots are free then it follows the player with higher stopping distance. But I've got it implemented in blueprints instead of BH and I'm wandering if it could be done better, so I'm asking because I see that you know what you are doing :D
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
@@sebastianciesielski1553 it really depends on the game you're making. A game like Doom, for example, uses a point system, and each enemy needs a certain amount of points to follow/attack the player, some enemies use up more points than others, and once all the points are used, that means the player can't handle anymore enemies, and the rest should stay back. The harder the difficulty, the higher the number of points in the game. This is of course just a simple way of describing it, but that's the idea behind group enemy attacks, that they consume a shared pool of resources
@bradjack8865
@bradjack8865 8 ай бұрын
is there a way to just hold the click button to keep shooting? also i am very interested in the Boss AI like the Boss Fight video, especially the calculation and behavior for the dash/teleportation skill🤯
@AliElZoheiry
@AliElZoheiry 8 ай бұрын
There is indeed, you can simply keep looping the shoot function until the button is released
@themerpheus
@themerpheus 10 ай бұрын
How do you handle multiple enemies try to melee attack at once? Usually in games one attacks while others wait, but I guess current system doesn't allow then, no?
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
I'll be covering that in a later part, haven't decided yet which approach to take, but I'm thinking of something like Doom's token system, where each enemy attack costs a specific amount of tokens, and there is a limited amount of total tokens per level (that can change based on difficulty) checkout the full explanation I'm this great video (starts at minute 17) kzbin.info/www/bejne/iJSylaetntR4nKs
@DragonFang253D
@DragonFang253D 3 ай бұрын
If I set the damage response to set state as attacking like you did in the "enemy responds to damage" part, if the enemy has already sensed with sight, the AI never gets "Isdead" to true in the BTS_StopAttackingIfTargetIsDead. But if I dont attack the AI after it sees me and just lets it kill me it gets IsDead as true
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
Hey there. I'm not really sure I understand your problem. I suggest joining the Discord server and asking your question there, then you can provide screenshots/videos so someone can better help you with your problem
@EHLarson
@EHLarson 2 ай бұрын
Does it make sense to have the damage causer to be part of the S_Damage_Info to keep it packaged together?
@AliElZoheiry
@AliElZoheiry 2 ай бұрын
That's definitely a good solution as well. The reason I didn't do it though because it's also possible that the damage was caused by the environment or fall damage, and in that case there is no "damage causer" but to be honest it will depend on your game, though I don't see any strong reasons not to do that
@EHLarson
@EHLarson 2 ай бұрын
@@AliElZoheiry that makes sense. Thinking it through a bit more I started to think of the damage causer more of a combat concern than a health system concern.
@elkcippickle2169
@elkcippickle2169 3 ай бұрын
Hi! i was wondering if you could help with an issue in my bp player blueprint. When following along, at minute 7:00 I plugged in the damage causer and got an error in my construct script saying the 'DamageResponse' doesnt match the necessary signature. I Noticed that I cant select 'DamageResponse(DamageResponse)' when I create an event off of 'Bind Event to On Damage Response' anymore,, and also noticed that the signature on this event is (ByteProperty, Actor Object Reference) instead of just (ByteProperty). I went back to the damage tut and re-did this section but still hv an error. Thanks for the videos, learned a ton so far!
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
Hey there, since we changed the event dispatcher to have an additional parameter (DamageCauser) then you also need to have that parameter as an input to the event that handles this call. So just make sure to add the missing input field and everything should work fine (You'll see that I face the same error and fix it just seconds later in the video)
@elkcippickle2169
@elkcippickle2169 3 ай бұрын
Ohh that makes a lot of sense, just implemented it and now it’s all good,, thank you!!
@vegeto3484
@vegeto3484 10 ай бұрын
please tell from where you have to take that animation(Kamehamehaa) ?
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
I got it from Mixamo, it's called "Fireball" but if you want it retargetted for the unreal mannequin with a root bone, then you can get it from my Patreon (www.patreon.com/Alizoh)
@josecervilla5362
@josecervilla5362 10 ай бұрын
Hi, I have a question, how can we do with 2 AI respect their turn, while one attacks the other remains still?
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
I'll be covering that in a later part, haven't decided yet which approach to take, but I'm thinking of something like Doom's token system, where each enemy attack costs a specific amount of tokens, and there is a limited amount of total tokens per level (that can change based on difficulty) checkout the full explanation in this great video (starts at minute 17) kzbin.info/www/bejne/iJSylaetntR4nMs
@MrMeat570
@MrMeat570 Ай бұрын
In the second bug fix when u fixed the damage response, for some reason my magic attack doesnt deal damage anymore and the AI isnt playing the hit response, i tryed to go through the bug fix again but still no luck, i have no idea what could be wrong, any ideas? Plz respond as soon as you can, PLZZ help bro
@AliElZoheiry
@AliElZoheiry Ай бұрын
Hey there, sorry to hear about the issue. I'd recommend checking the changes made during the bug fix and see if anything might have unintentionally impacted the magic attack and AI behavior. Also, try reverting the specific changes related to the magic attack and AI hit response to see if that resolves the issue. If you're still encountering problems, I recommend checking my video on how to fix bugs to help you better debug the issue
@MrMeat570
@MrMeat570 Ай бұрын
@@AliElZoheiry I tried to do what you told me to do but zero luck, can i just not do the second bug fix and move on like it wont interfere with the next episode like it should be no problem right?
@AliElZoheiry
@AliElZoheiry Ай бұрын
@@MrMeat570 You can skip the fix for now, but just keep the bug in mind and try to come back to it later. It won't affect your ability to follow the rest of the series
@MrMeat570
@MrMeat570 Ай бұрын
@@AliElZoheiry OMG, I just found the bug, in the bp melee i had opened up the take damage interface which then made it into a function and that was causing it to not take damage so i just set it back to interface by deleting the function NOW EVERYTHING WORKS, INCLUDING the second bug fix!!! In Programming its really always the smallest things that cause such big issues and then u just overlook them lol.
@AliElZoheiry
@AliElZoheiry Ай бұрын
@@MrMeat570 That's great to hear. Well done 💪
@dustanschutte8724
@dustanschutte8724 8 ай бұрын
Hey man. Here again. Not finished with the video yet but it's not in the bug fixes so I think it's maybe something I've done wrong but the melee enemy doesn't block an attack I do towards him but the ranged enemy uses the same projectile. I have set it to blockable but he just doesn't block please help if possible.
@dustanschutte8724
@dustanschutte8724 8 ай бұрын
I seem to be getting into a rhythm of this. Found out that somehow since the last time I was in ue5. Ie last night, the attacking function on my player and defaulted. Adding the output of attacking and having to remake the variable has fixed it. 😂
@AliElZoheiry
@AliElZoheiry 8 ай бұрын
Awesome! Glad you fixed it 😊
@dustanschutte8724
@dustanschutte8724 8 ай бұрын
Okay, really sorry but for some reason my melee enemy keeps blocking with out my player attacking. He still attacks but it'll be interrupted by the block every now and then.
@AliElZoheiry
@AliElZoheiry 8 ай бұрын
I modified the block functionality in the first section of this tutorial kzbin.info/www/bejne/i3qkkq2FnNyqlas Check it out and let me know if it fixes your issue
@TheDarkDevilGames
@TheDarkDevilGames 4 күн бұрын
Hey so i was following the tutorial, and everything was working perfectly. But now the melee enemy as stopped blocking the ranged enemy attacks i tried looking for the source, but im still slumped.
@TheDarkDevilGames
@TheDarkDevilGames 4 күн бұрын
Ok so i just fixed it, but now the block impact animation plays twice xD and i checked and the ranged enemy just deals damage once, but when the melee enemy blocks the anim montage plays twice, and its only agaisnt the ranged enemy. Agaisnt the player he blocks normally
@AliElZoheiry
@AliElZoheiry 2 күн бұрын
Hey there, I suggest adding a breakpoint in the flow of the damage function and see when the block get's triggered, that will give you an idea what's triggering it a 2nd time
@TolisPiperas82
@TolisPiperas82 3 ай бұрын
please and to the player character bow attacks pleaaaasssssse
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
Hey there! Thanks for the suggestion! I'll definitely consider making a bow and arrow tutorial series for future videos. Keep an eye out!
@TolisPiperas82
@TolisPiperas82 3 ай бұрын
@@AliElZoheiry the best will be to add to the existing ai series to this olayer char, like when equip the bow to start the bow mecanisms
@essa4436
@essa4436 10 ай бұрын
Ali How do you get an AI to enter the door??
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Replied on your other comment 😅
@MCT0117
@MCT0117 3 ай бұрын
dang that "do once" macro fixed my shotgun BP
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
That's great to hear! I'm glad the "do once" macro helped fix the issue with your shotgun BP! It's a node I use quite often indeed
@MCT0117
@MCT0117 3 ай бұрын
@@AliElZoheiry yeah man thanks a lot, still watching the whole smart AI playlist picking stuff that I could remake and use 👍. BTW what would you recommend on Navlinks on crouching? Move to location doesn't do anything besides make the enemy spasm even if the enemy have variables regarding crouching
@AliElZoheiry
@AliElZoheiry 3 ай бұрын
Crouching shouldn't affect navigation in any way since it just shortens the capsule. If you're having issues with navigation during crouching, try checking the other movement settings related to crouch, like crouch speed and CanCrouch, etc..
@MCT0117
@MCT0117 3 ай бұрын
@@AliElZoheiry yeah I think it's the problem was the implementation of crouch on my Enemy BP it doesn't get called when the AI reaches the Navlinks
@jvkmakerspace227
@jvkmakerspace227 2 ай бұрын
While this is shown in other videos and is done fairly well. This was the easiest way I think I have seen it done. kzbin.info/www/bejne/a57Hcod4adqModEfeature=shared&t=1453 Let's just say, I have some of this logic done in a different way that is not very friendly. I do need to do more testing with this method, but I think this is much easier to implement. BTW, so far this series has been great and I have learned a lot more than just AI.
@AliElZoheiry
@AliElZoheiry 2 ай бұрын
Thanks for sharing your feedback! I'm glad to hear that you found the method in my series to be easier to implement. And I really appreciate the support and feedback on the series as a whole. If you have any more questions or suggestions, feel free to let me know!
@stmgaming465
@stmgaming465 10 ай бұрын
Hello, I have an idea for an online autobattler game. It is not too difficult to develop but will be quite popular. Do you want to develop together? I could work on 3d models and sounds, and I also thought over the mechanics.
@AliElZoheiry
@AliElZoheiry 10 ай бұрын
Hey man, I would love to collaborate on something sometime, but now is not the best time. Feel free to join the Discord community and we can chat there (link in the description)
@liujame-vx5xj
@liujame-vx5xj Ай бұрын
29:50 you are using a new way of retargeting miximo animations,I do not know what to do
@AliElZoheiry
@AliElZoheiry Ай бұрын
Hey there, I am indeed now using this mixamo converter terribilisstudio.fr/?section=MC It's free and works very well
@liujame-vx5xj
@liujame-vx5xj Ай бұрын
@@AliElZoheiry It's very good! thank you Ali.
@liujame-vx5xj
@liujame-vx5xj Ай бұрын
​@@AliElZoheiry I used mixamo converter to redirect the animation, but sometimes when playing the animation, the character would flash and flicker. This would not happen without do footik. I don’t know why.
@trelaskillz
@trelaskillz 4 ай бұрын
Thanks for another great lesson! I really enjoy the content.
@AliElZoheiry
@AliElZoheiry 4 ай бұрын
You're very welcome! I'm glad you found it helpful. Always happy to hear that you're enjoying the content. Thank you for watching and commenting!
How To Have Random Idle Animations In Unreal Engine 5
6:35
Matt Aspland
Рет қаралды 12 М.
Универ. 13 лет спустя - ВСЕ СЕРИИ ПОДРЯД
9:07:11
Комедии 2023
Рет қаралды 571 М.
1 класс vs 11 класс  (игрушка)
00:30
БЕРТ
Рет қаралды 1,4 МЛН
100❤️
00:20
Nonomen ノノメン
Рет қаралды 61 МЛН
Use Unreal Engine to make the boss battle of Sekiro
2:19
八层肚
Рет қаралды 13 М.
20 Unreal Engine Tips You NEED to know | UE5
8:38
Ali Elzoheiry
Рет қаралды 17 М.
How to do AOE damage and healing | Unreal Engine 5 Tutorial | ue5
58:20
Smart Enemy AI |  (Part 20: Boss Fight) | Tutorial Unreal Engine 5 (UE5)
1:05:42
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
Ali Elzoheiry
Рет қаралды 88 М.
Талдың үстіне үй соқтым!!! (Scrap Mechanic)
41:36