I appreciate how instead of just saying "avoid casting", you actually show the reason why. Everything is very well explained and thought out. As they say, it takes a smart guy to explain to someone how something works, it takes a genius to make them understand.
Hey, thank you so much for your kind words! I'm really glad to hear that my explanations are helping you understand better. I appreciate your support 🙏
This video is the best explanation of interfaces I ever witnessed, you're doing a great work of presenting these concepts and making it easy to understand !
@@TheVeryMadMath Thank you so much for your kind words! Really happy to hear that my teaching style is resonating with you and that you're finding this helpful. Thanks for watching and commenting 🙏
These tutorials are wildly good cause they are great for newbies to learn the 'right' way and also good as intermediates to go back and learn the concepts better or start using them more often now that you understand the basics. Super useful.
This might actually be one of the most important videos ever made in the history of Unreal development videos. It is the best explanation of how casting can be bad I have ever seen. Also that is a brilliant way of using Event Dispatchers. As opposed to the most common way which involves manually binding. Absolutely brilliant.
Finally a tutorial where the reason behind avoiding casting isn't glossed over. Always had to take that info at face value without being able to really question it. You explained it very well and concisely!
Thank you for your kind words! I'm glad to hear the explanation resonated with you. Understanding the reasoning behind things really helps with learning 🙏
You are one of the few explainig the WHYs in Unreal. Not only copy and paste stuff, but really in depth explanation of the logic behind. Thank you so much!
bro, let me tell you it is a TALENT to be able to take knowledge, and then structure it in a way that is understandable and teach it to students trying to understand and learn, but YOU have a gift of doing this VERY VERY well. I know you hear this a lot but seriously, this is your calling and the way you've been able to do it is just insane, and i've watched ALL your videos, this isn't just a compliment, this is a huge push for you to really devote yourself to becoming an instructor because you are insanely good at this, you may not think much of it, but look at the quality of your comments on all videos, it is nothing but the highest of praise instead of a bunch of irrelevant talk among viewers. I watch a lot of people attempt to be instructors but they all just read from a wikipedia page or straight from a source, without any type of conversion whatsoever, and because of that maybe only 40% can somewhat comprehend. but in your case you are able to do it so 100% can understand and i don't say all this lightly. Seriously, your channel has grown FAST. other tutorial channels struggle to break 10K after a few years!!! and you're already past 30k, and all this is on a channel with your name on it, instead of a catchier channel name lol! but i really hope you devote yourself to this completely, because WE WILL support you if you step up and become a full time instructor!! One of the most important and valuable professions on this planet is that of an instructor as it's a difficult job to truly grasp and you've got it in all areas!!
Hey Dom. Let me start by saying that your comment put a huge smile on my face. Your encouragement means a lot to me, and it's this kind of motivation that keeps me going and keeps the channel alive! I do wish I could make a living off of this, obviously now it's a bit far from that, but who knows what the future hold. I really appreciate your support, and I hope you enjoy the future content as well 🙏😊🙏
You really are one of the best educators for Unreal. Not too much handholding but rather important information about good practices that are useful for any project. Thanks so much :)
Very nice tutorial, as always. However, there is one things, I'd like to add. When thinking about casting: When you have to cast it is always helpful to consider which is the most simple object in the class hierachy, that serves your purpose. Example: You have a character class called "NPC" and you have a reference to it as an actor in another class. If you want to play an Animation Montage on it for example, you need to only cast to the character class to get the skeletal mesh, instead of loading in the whole "NPC"-class by casting to that one. (Note: You need a skeletal mesh to play an animation on a character)
Thank you for your insights! That's a great tip about casting to simpler objects in the class hierarchy to improve efficiency. I appreciate you taking the time to share that with the community 🙏
You know what? I started unreal some time back and at the beginning I had no idea of it and used random yt tutorials which lead to me ending up with a "ton of casting inside the event ticker". But then I found your channel and all of a sudden my game actually works and has very good performance!
Hey! I'm really glad to hear that my tutorials have helped you improve your game performance. That's what I aim for! Thank you for sharing your experience, it means a lot 🙏💪
Another banger. You are by far the best Unreal teacher on TH-cam (and the paid sites tbf). Hoping you eventually do some videos on GAS/ALS/Motion Matching. Keep up the great work!
Your videos, this one specifically, are absolutely amazing. I think out of all the tutorials and explanations online, yours are the best. Thank you for putting this content out in the world. One of the biggest obstacles I have run into and I know many others who are learning to make games, are ways actors communicate with each other without casting to everything. I've actually watched this video a couple time to reference and do it the way you teach. Could you make a video about best practice for class dependencies and class children? This video hits that really well but myself and probably others would love for you to explain a general sense of structure for all how to organize and build out your classes. If that makes sense.
Hey, thank you so much for your kind words! I'm really glad to hear you find my videos helpful 🙏 I’ll definitely consider it for a future video. Thanks for watching and sharing your thoughts!
This is amazing Ali. Please keep tutorials like these coming. These two concepts are essential for so many system in UE5. I’m sure there are other as well
Very clear and useful as always. Each video you make help all of us beginners. Not tested yet your chat bot as I don't need it at the moment. I think the example you use with object colliding with actor is a good one as it was one of the principal issue people had. Can't say anything than you have to keep making those videos. Pure gold, instructive, and well explained. Thanks Ali.
Hey, thank you so much for your kind words! I'm really glad to hear that you find the videos useful for beginners. Your support means a lot to me, and I’ll definitely keep them coming 🙏
Thank you so much for this video! I'm a beginner just starting to learn Blueprints, and your explanations have been incredibly helpful. You're absolutely a fantastic teacher!
All of your videos are amazing! You explain very important and advanced concepts in a simple and intuitive way. Great to see examples of things we should not do and why. Thank you for the amazing content!
These tutorials about design patterns for unreal are absolutely amazing, not to mention very rare on TH-cam. I’m about to follow your playslit about AI, I hope you are putting these patterns into practice there. If not, would be amazing to have a practicle series that uses all these design patterns you mention. (An inventory serie would be amazing 😊)
Hey! Thank you for the kind words and suggestions. I'm glad you're enjoying the tutorials. I definitely appreciate the idea of a practical series using these design patterns-I'll keep it in mind! An inventory series is also on my radar 😉. Thanks for being a part of the community! 🙏
Thank you for your feedback! I’m glad you found the explanation helpful. Event Dispatchers do offer great flexibility, but like I mentioned in the video. These are 2 methods that can work together, not one or the other. So always keep an eye out for opportunities to use them both
Thanks again Ali! Glad to have you cover this topic! Great video. Quick question: At 06:00 you dragged a connecting line from Hit Actor and it placed a reroute node. Changed my life. How did you do that?
@@Tyrannyofman thanks for the response! That allows you to connect it to another node, not auto-drop a reroute node. I did my diligence on the interwebs but couldn’t find it.
@@OverlandBound I know if you do hook up a node you can double click on the string/connector and it will create a reroute node on the string itself. If you delete out the node it was connected too, your connector node will stay. I just don’t know how to drop it like he did in the graph with already connecting it to another node like a branch or function etc etc
Hey @OverlandBound, always great to hear from you ❤️ thank you for the comment Indeed, when I found this feature as well, I felt like I unlocked a super power 😅. You just press "R" when dragging a node
Thank you for explaining about when casting is ok. Another way of thinking about casting. It's ok to cast to something that is always loaded to memory (player, controller, game mode etc)
Thank you for sharing your insights! That's a great way to look at it, and it definitely helps clarify when casting is safe to use. I appreciate your contribution! 🙏
I knew this stuff but love seeing how others explain it so hopfully i can be a better teacher too. And i think yours was super thorough and great. Also really cool about your chatbot.
Love your videos. Would be awesome if you put together a course of making a smaller game with these best programming practices and the engines framework. Part of my problem when making a game is communicating at a larger scale. Like these videos are great and shows how to do said things, but in practice when making a full game you have many more classes communicating with one another. For example, updating UI, updating and keeping track of progression, saving that progress, etc.
Hey, thank you for your insightful comment! I appreciate your suggestion about creating a complete course. I’ll definitely consider it as I see how it could be beneficial for many. Communication between classes can be tricky, and it’s a great topic to dive into. Stay tuned! 🙏
I am studying ACS architecture. (attach System component) and this was very useful to me because there is very little information about it. Thank you for your great contribution Eli. I know that one day it will be the ACS pattern's turn.
Hey! I'm glad to hear that you found it helpful, especially since there's not much information out there. Thank you for your kind words, and I'm excited to see where the ACS pattern goes in the future! 🙏
Thank you for your tutorial. By the way, you can press **CTRL**, **Shift**, and **W** to adjust the font size in the UE editor, which can help you when recording tutorials.
Still amazes me how in depth you go.. It's almost like you are doing it for newbies.. However, you are not actually making something that can be copy/pasted.. So in order to use it, you actually have to understand it.. Just love your approach.. Best way to learn, is by understanding.. Top notch direction still.. Way better than all the "here's how you make a shooter", since thats just.. copy/paste tutorials :D
Thank you for the thoughtful comment! I'm glad you appreciate the depth of the explanations. Understanding the concepts is definitely key to mastering game development. Your support means a lot 🙏
omgggggg this is so great lol im making a horror game and the code looks more terrifying than the game itself lol i am so glad i stumbled upon this im about to use these interfaces and dispatchers i KNEW there was a easier method than hard coding every single thing!
I've been looking for a good explanation for this question for ages now! Thank you so much for actually explaining the differences and not just saying "do this cause it's good"
after watching ever tut and every vid, I'm starting to FINALLY understand UE. Thnk you so much! :) was wondering.... would it be ok to suggest your next tutorial series, or only patrons can give suggestions? more than happy to become patreon if we can give a bit of a nudge in a certain direction to learn something specific :)
Hey! I'm glad to hear that you're starting to understand UE, that's awesome! 🙏 You're more than welcome to suggest ideas for future tutorials, I always appreciate input from my viewers. Thank you for considering supporting me on Patreon as well! Just let me know what you have in mind 😊
@@AliElZoheiry im not sure if it has been already suggested, but maybe a stamina system incorporates the environment source be rly awesome! Similar to the one in BotW (how you can climb any surfaces, slide down and getting exhausted if a surface is inclined, how u go faster downhill, gliding). Even if if only for Patreons, i would gladly give u ma monei to learn smt like that. ur an amazing teacher :)
I think it can also be confusing knowing you still need to reference something across both Interfaces, and Dispatchers. I've fallen into this trap as well where regardless of what I wish to do (at least for calling an event of something), both Dispatcher and Interface still needs a reference passed into them in order to know what they are actually affecting (which is what OOP is all about), and sometimes that can be quite hard to achieve without knowing how to do that. It's easy for collision events since it passes the actor that it hits already, but for other cases, and can be tricky. On top of this, for specific use case where a player needs to call out to a range of different actors, they would still need some form of referencing to all of these actors such as using a 'get all actors of class/Tag/etc.' node (which is expensive) or use some sort of array and store the actor's ID's in there.
Hey! You bring up some valid points. Referencing actors across Interfaces and Dispatchers can indeed get a bit tricky. To solve for that, you can use the "Mediator Pattern" to build an EventManger, which I show how to do in this tutorial th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Fantastic explanations, really helped me understand. My only comment would be, I would have liked to see a different example of how using an Event Dispatcher could be useful (optimal) with something different than the Actor Component use case. But thanks so much !!
Hey! I'm glad to hear the explanations helped you understand 🙏 Thank you for your suggestion! I'll definitely keep that in mind for future videos. Thanks for watching and commenting! 😊
First of all, great tutorial! Diving further into memory management, would you ever make a tutorial on it in general? Or maybe a guide on soft references?
Thank you for the kind words! I'll definitely consider making a tutorial on memory management and soft references in the future. Appreciate the suggestion! 🙏
Great video, I'm really loving your teaching style. I'd really like to see a video on effectively managing a large number of timers that are based on actual clock movement with potential multipliers. Think of a game like Factorio where there could be tens/hundreds of thousands of independent timers. I may just be overthinking it and it's not as difficult to scale as I think.
Thank you for your kind words! I'm glad you’re enjoying the content. That's an interesting suggestion, and I'll definitely add it to my list for future videos! It's a complex topic, but not impossible to tackle. Stay tuned! 🙏
Thanks for the compliment! Besides health, I often use Components like Movement, Inventory, and many others, though it highly depends on the type of game. If you have any specific use cases in mind, feel free to ask! 🙏
@@AliElZoheiry Thank YOU! Since you asked....! I'm building a single-player, turn based battle + explore game inspired by PS1 final fantasies. For battle mode - Health as you suggested, I suppose MP for magic abilities. For explore mode - Inventory as you suggested would be great. So long as the items are unique to explore mode (e.g. keys). Any other ideas at top of mind?
Great video. With the introduction of Unreal Engine 5, I now increasingly find myself using Gameplay Messages as a third way of writing decoupled logic between unrelated classes. This also uses the publish-subscribe model, but requires the least amount of setup in my experience and so allows for you to implement the behaviour more freely and loosely across the game. Have you had much experience with these? If so, I would love to see a video on your opinions on them and how they should best be utilised alongside interfaces and event delegates.
Hey! Thanks for your comment. I appreciate your insights on Gameplay Messages; they can indeed offer flexibility in decoupled logic. I haven't explored them in-depth yet, but I’ll add your suggestion to my list for future videos. Stay tuned! 🙏
Love the content, Ive been wanting to learn more about dispatchers. Is a dispatcher only used from a component, or can you use them outside of components? Thanks for the hard work!
Hey, thank you for your kind words! Dispatchers can be used both within components and outside of them. They're a great way to keep your code organized and facilitate communication between different parts of your game. If you have more questions, feel free to ask! 🙏
For a Points/Score system in the HUD, I think that would be similar to health where there's an actors component with an event dispatcher on both sides correct? I can see how an interface could be used too but It sounds like Dispatchers would be better in that case.
Amazing video, calmly and steady showing the steps. But when is it better to usa an interface over an event dispatcher? I think flexibility of code is so powerful that deciding on structures is just a step in the wrong direction.
Thank you for your thoughtful comment! Great question regarding interfaces and event dispatchers. Generally, interfaces are better when you want to enforce a consistent structure across different classes, while event dispatchers are useful for communication between objects without tight coupling. It really depends on your design goals and flexibility needs. Hope that helps! 🙏
This channel is gem, you deserve 1220302100123001301 times more subs. I wish i discovered you earlier, now i have to fix my code because i made a traps that can kill a player and i did them with "Cast to BP_PlayerCharacter" and then makes player go ragdoll and disable movement and player respawns, but interfaces would definitely have helped me saving memory usage. Is it possible to make it? Whenever player's body interacts with box collsion of trap it dies and simulates ragdoll physics and instead of casting all the time all types of traps to BP_PlayerCharacter it just communicates with interfaces? I will try to do that, probably i will struggle as im really new to unreal engine and new to coding lol, i just started 2/3 months ago. Anyways awesome tutorial and explanation, subbed and liked and i will watch more of ur old videos and continue watching newer ones in the future aswell. Have a nice day!
Hey! Thank you for your supportive comment! 🙏 Yes, using interfaces is a great way to streamline communication and save memory. It sounds like a solid plan to implement that for your traps! Don't worry if you face challenges; everyone starts somewhere, and learning takes time. I'm glad you found the tutorials helpful, and I appreciate you subscribing! Enjoy your journey with Unreal Engine, and have a nice day! 😊
Still admiring your talent for explaining things so lucidly! I'm very interested in your opinion on the solution I came up with and how bad or good it is. I decided to switch to components, and instead of interfaces I use tags (to make sure that the actor has such a component) . For example, an AC_MyComponent component adds an “AC_MyComponent” tag to its owner and on a fordcast I can get something like GetAllActorsWithTag, then from each actor get the AC_MyComponent component and work with it. This allows me to add a component to an actor without having to change the actor. I only use interfaces instead of tags if I have to call component functions in their implementations anyway. I see these pros and cons of my solution: Pros: 1) The actor may not know anything about the component. For example, if an item can be reported by radio, we don't need to change the item itself, we just add a component. 2) The actor's logic remains as clean as possible and, as far as possible, is not cluttered by working with the component Cons: 1) I don't know, but I assume that getting actors by tag is slower than getting them by interface. Plus, you probably have to store a reference to each actor and a reference to the component from it 2) Most components will have to make an assumption about the approximate type of their owner. Extremely interested in what you think about this, what mistakes you see in it.
Hey! Thank you for the thoughtful comment and for sharing your approach. I appreciate your analysis of the pros and cons-it really shows your critical thinking. Using components with tags can indeed keep your actor logic clean and decoupled, which is a solid advantage. As for your concerns regarding performance, tags can sometimes be less efficient than interfaces, particularly when dealing with large numbers of actors. However, for many scenarios, the difference may not be significant enough to outweigh the benefits of using components. It’s also true that relying on assumptions about the owner’s type can lead to issues if not managed carefully. Overall, it sounds like you're on the right track! Keep iterating on your ideas and experimenting to find the best balance for your specific needs. Would love to hear more about your findings as you continue working on this! 🙏
these videos are great, makes it really easy to understand proper design patterns and their practical applications. one question I had is whether it makes sense to use interfaces, or what the correct approach is, when the calling actor may be looking for different types of data from interface function depending on the object it's used on? ex: I have an interact interface defined and implemented similarly to the one in the video by several actors in my project. However, while my player doesn't care about what happens when it calls interact on a door, when calling it on something like a zipline, vehicle, etc. I'd like it to return a pointer/reference to the actor so my player character can do stuff with it. My initial thought would be to make it so that interact always returns an AActor pointer, but have the door return null. Then for all non-null pointers, try to cast to each class? Alternatively, maybe the player could pass a reference to itself using the interact interface, and then the actors could use that reference to pass data back to the player. For example, the player calls interact(this), then the zipline can use that pointer to set a pointer to itself in the player class like player->rideZipline(this).
Hey, thanks for your comment! You bring up a great point. Using interfaces can definitely allow for flexibility in design. Your idea of having the interact function return an `AActor` pointer sounds like a solid approach. This way, you can easily check for null and handle each actor type accordingly. Passing a reference to the player is another option that could work well, especially if you want the actors to directly communicate back with the player. Both approaches have their merits, so it really depends on what fits best in your specific use case. Good luck with your project! 🙏
As always the best tutorial maker on youtube, great video thank you ! The only thing that I still don't get is where to use an event dispatcher other than linking an Event in a Component to its owner. The receiver of an event dispatcher needs a reference to do the binding, making it less modural and lead to casting. So maybe we should avoid using event dispatchers in those cases and reserve it for when the reference is easy to get ? Or did I miss something else ?
Hey, thank you for your kind words! 🌟 You bring up a great point about event dispatchers. To take it a step further and remove the need to get a reference to the actor that is dispatching an event, you can create an "Event Manager" also known as an "Event Bus". Which will allow you to trigger an event from anywhere, and have a central listener that broadcasts it. For example, the enemy dying can trigger an event. Then the player can listen to all event of any enemy dying without having a reference to any enemy. I cover this topic in detail in this video and show how to implement it: th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Hey! Thank you for the kind words! I don't have a video on the State Tree planned yet, but I'll definitely consider it for the future. Thanks for the suggestion! 🙏
Thanks Ali! The way you explain different concepts is so clear. you really have a talent for this. I have one question though. All of the videos I have watched regarding interfaces, references, and memory usage always use the same example: an interactable interface and an interact function / event. This is great and all but what if I only want to get basic data of an object, like world transform for example, from another object, let's say my player character, without creating a hard reference to that specific object. Is it possible to use BP interfaces for that? I was thinking of creating a generic BP interface called "reference manager" where I would create functions that declare basic data so I could get them and create variables out of them inside the objects that need a reference to this data.
Hey! Thank you for your kind words, I really appreciate it 🙏 For getting basic information, you should already be able to do that on any actor, you can get the transform of any actor without having a reference to a specific class. So I wouldn't recommend creating an interface for defining functions that might already exist on the actor class.
@@AliElZoheiry Thanks for replying! I'm not sure how it's possible to get an actor's data from another actor's blueprint without creating a hard reference though. let's say I use the "get actor rotation" node in my player character blueprint and the target is another actor called BP_Box for example. I'm not sure how I can do that without declaring to my BP_PlayerCharacter that BP_Box exists. I know that casting creates a hard reference so I was trying to find a way to easily get basic data from actor to actor without having to create hard references. In the meantime I found a workaround using a blueprint interfaces and tags which seems to work relatively well
Hey, thank you for the question! It's generally a good idea to use multiple interfaces when you have distinct behaviors or functionalities that may not always be applicable to every class. This keeps your code cleaner, easier to maintain, and more modular. Hope that helps! 🙏
Thank you very much, Ali! You are a great teacher! I'm a bit struggling with interfaces - imagine I have an Interact function, but the inputs of it should be different for 2 classes. Intuitively I realize that I need to create an iterface with interaction function - but how do I handle the different inputs to it? Do I need to create 2 different functions in one interface (which looks like not the best decision) or probably something is not right with my code if it leads to having different inputs?
It would be great to have more AI videos on how to add improvements and the possibility of AI tutorials that are friendly like in stores, banks for buying and selling items, etc. since there is no information on that.
Good explanation! One thing which i always struggling is...when you doesn't have reference to actor for interface/dispatcher call. In your example it's pretty easy with trace, but imagine case when door actor should ask some global manager actor, can open? (Like when alarm state is active or something). Or manager has to tell all objects to change their states... In that case door/manager should has hard reference on begin play or hard referenced through level. And i don't have another solution for that, and i really bothered of that because most of the "managers" has many hard references to deal with other things in game.
Hey! Great question, and I'm glad you found the explanation useful 🙏 For managing references like this, all actors can have a hard reference to the "manager" actor itself, that's fine because you expect that actor to always be there and all other actors to depend on it (since it's a global manager), but don't put references to other actors in the manager itself, the manager should be agnostic of other classes. I have a tutorial on how to build an "Event manager" for usecases like that, check it out if you're interested th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
When you use "Get Actor of Class" or "Get Component by Class" in an attempt to get the actor that is calling the dispatcher, so that you can bind the dispatcher, can this have negative effects for other actors that have different logic but use the same component or class? Let's say that it does cause issues, I've heard that you can also use tags to get specific actors, or storing references to actors in game instances, would these be more preferable or the same? Thanks!
Hey! Get actor of class is very different than get component by class. I use "Get component by class" to search the components of a specific actor to see if that component exists. and then I do certain actions (like binding) only if the component exists. If the component doesn't exist, then I do nothing, and this has no negative effects, because I am only supporting actors that do have this component, and the ones that don't just don't get the additional functionality (which is expected)
Hi, love your videos, keep up the great work. I would like to ask for a video which I was not able to find anywhere or at least not explained video how it works really. The subject is control rig blueprint. How to control the players character during game- to grab a door handle when opening a door, make character touch a wall in front when moving too close or simular stuff. I followed some tutorials but they never explain how the transforms changes work and I see alot of weird position of arms or legs of which I am sure should not be possible. Thank you.
Hey! Thanks so much for your kind words and your suggestion. Controlling character interactions like that sounds interesting, and I'll definitely consider it for a future video. The way transforms work can be tricky, but I’ll try to clarify that. Appreciate your support! 🙏
You're welcome! That is indeed one difference, but event dispatchers can be built in a way to operate on a global level as well, by building something called an "Event Manager". I explain that in this video here th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
This is really cool, thank you. How would you use interfaces so when i click on a mesh at runtime and display the location of the actor details in a widget? I have been struggling to do this with interfaces for a month now. I can do it with casting but not with interfaces.
Hey! I'm glad you found it cool! For your question, start by creating an interface with a function that returns the actor's details. Then implement this interface in the actor class you're clicking on. When you click the mesh, call the interface function to get the details and then display them in your widget. If you're still having issues, feel free to ask on Discord; the community might be able to help as well! 🙏
so casting is dependent on actors recalling the in memory storage, interface is dependent on its connected blueprints so will want to call on the blueprint its connected to, and event dispatchers are kind of standalone independent functions that are not really dependent at all? is it possible to just replace all interfaces and casting with event functions or are there distinct differences that wouldn't allow that?
Hey there! Almost, but its important to understand that casting just creates a "hard reference" and adds a dependency, and that's what causes something to be loaded into memory. So when using event dispatchers, you also have to reference an actor to bind to its event, and therefore create a hard reference as well, so just be aware of what you are referencing in any class. If you want to learn more about dependencies I suggest checking out this video th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Ali your videos are wonderful. I have watched almost all of them, and over the last few weeks I have used a lot of the info for building a basic FPS. However, I've got myself a bit confused. Through your tutorials, I have BPI_Damageable set up, and the Health component set up. This has resulted in a Death custom event and an On_death event in my player character blueprint, and I am not sure which to use. When it comes to these systems, I am confused on which should be integrated with my HUD. Is it better to have the interface pass damage info to the component which then passes the damage to the player character and then the health bar? I am confused enough that I don't know if I am even explaining this properly.
Hey! Thank you for the kind words, I'm really glad to hear that my videos have been helpful for your FPS project 🙏 As for your question, like I said in the video, there is no right or wrong, or one way that's better than the other, you should be using both approaches, and assess which approach is right for your specific use case. I suggest using the information from this video to try to understand which one is better for your specific need.
So if you wanted your player to be able to push a button to open a door, there would be an interface implemented between the player and the button, and an event dispatch between the button and the door?
Well it depends on a lot of things, but generally speaking, if you have multiple different kinds of doors, all with their own unique "Open" function. Then yes, you would have a door interface, and the player just calls an "Open" function on that door reference without caring what type of door it is. Then if you want the door to notify the player when it's fully open, you can then indeed dispatch an event from the door saying where the player listens to it, and then knows it's fully open when it's called
I appreciate how instead of just saying "avoid casting", you actually show the reason why. Everything is very well explained and thought out.
As they say, it takes a smart guy to explain to someone how something works, it takes a genius to make them understand.
Thank you so much for your kind words! I'm glad to hear you found the explanations clear and helpful. It means a lot to me 🙏
dude plz dont stop u explain shit step by step, u actually made me understand so much shit i was strugglin with...keep it up like this
Hey, thank you so much for your kind words! I'm really glad to hear that my explanations are helping you understand better. I appreciate your support 🙏
This video is the best explanation of interfaces I ever witnessed, you're doing a great work of presenting these concepts and making it easy to understand !
@@TheVeryMadMath Thank you so much for your kind words! Really happy to hear that my teaching style is resonating with you and that you're finding this helpful. Thanks for watching and commenting 🙏
These tutorials are wildly good cause they are great for newbies to learn the 'right' way and also good as intermediates to go back and learn the concepts better or start using them more often now that you understand the basics. Super useful.
This might actually be one of the most important videos ever made in the history of Unreal development videos. It is the best explanation of how casting can be bad I have ever seen. Also that is a brilliant way of using Event Dispatchers. As opposed to the most common way which involves manually binding. Absolutely brilliant.
Thank you for your kind words! I'm really glad you found the video helpful and enjoyed the explanation. Your support means a lot 🙏
I absolutely love that you are teaching exactly at my level: Not too cuddly, but also not assuming I write C++ all day. Absolutely. Fantastic. Work.
Thank you so much for your kind words! I'm glad to hear the content resonates with you. I appreciate your support 🙏
Finally a tutorial where the reason behind avoiding casting isn't glossed over. Always had to take that info at face value without being able to really question it. You explained it very well and concisely!
Thank you for your kind words! I'm glad to hear the explanation resonated with you. Understanding the reasoning behind things really helps with learning 🙏
You are one of the few explainig the WHYs in Unreal. Not only copy and paste stuff, but really in depth explanation of the logic behind. Thank you so much!
Thank you for your kind words! I'm glad to hear you appreciate the explanations. Understanding the "why" is essential, and I aim to make it clear 🙏
bro, let me tell you it is a TALENT to be able to take knowledge, and then structure it in a way that is understandable and teach it to students trying to understand and learn, but YOU have a gift of doing this VERY VERY well. I know you hear this a lot but seriously, this is your calling and the way you've been able to do it is just insane, and i've watched ALL your videos, this isn't just a compliment, this is a huge push for you to really devote yourself to becoming an instructor because you are insanely good at this, you may not think much of it, but look at the quality of your comments on all videos, it is nothing but the highest of praise instead of a bunch of irrelevant talk among viewers. I watch a lot of people attempt to be instructors but they all just read from a wikipedia page or straight from a source, without any type of conversion whatsoever, and because of that maybe only 40% can somewhat comprehend. but in your case you are able to do it so 100% can understand and i don't say all this lightly.
Seriously, your channel has grown FAST. other tutorial channels struggle to break 10K after a few years!!! and you're already past 30k, and all this is on a channel with your name on it, instead of a catchier channel name lol! but i really hope you devote yourself to this completely, because WE WILL support you if you step up and become a full time instructor!! One of the most important and valuable professions on this planet is that of an instructor as it's a difficult job to truly grasp and you've got it in all areas!!
Hey Dom. Let me start by saying that your comment put a huge smile on my face. Your encouragement means a lot to me, and it's this kind of motivation that keeps me going and keeps the channel alive! I do wish I could make a living off of this, obviously now it's a bit far from that, but who knows what the future hold.
I really appreciate your support, and I hope you enjoy the future content as well 🙏😊🙏
You really are one of the best educators for Unreal. Not too much handholding but rather important information about good practices that are useful for any project. Thanks so much :)
Thank you! I really appreciate your kind words. I'm glad to hear you find the information helpful 🙏
Very nice tutorial, as always. However, there is one things, I'd like to add.
When thinking about casting:
When you have to cast it is always helpful to consider which is the most simple object in the class hierachy, that serves your purpose.
Example:
You have a character class called "NPC" and you have a reference to it as an actor in another class. If you want to play an Animation Montage on it for example, you need to only cast to the character class to get the skeletal mesh, instead of loading in the whole "NPC"-class by casting to that one.
(Note: You need a skeletal mesh to play an animation on a character)
Thank you for your insights! That's a great tip about casting to simpler objects in the class hierarchy to improve efficiency. I appreciate you taking the time to share that with the community 🙏
This might be the best UE5 tutorials TH-cam channel. Great job!
Thank you so much for your kind words! I'm really glad you're finding the tutorials helpful. 🙏
You know what? I started unreal some time back and at the beginning I had no idea of it and used random yt tutorials which lead to me ending up with a "ton of casting inside the event ticker". But then I found your channel and all of a sudden my game actually works and has very good performance!
Hey! I'm really glad to hear that my tutorials have helped you improve your game performance. That's what I aim for! Thank you for sharing your experience, it means a lot 🙏💪
Another banger. You are by far the best Unreal teacher on TH-cam (and the paid sites tbf). Hoping you eventually do some videos on GAS/ALS/Motion Matching. Keep up the great work!
Thank you for the kind words! I really appreciate your support 🙏 I'll definitely keep those topics in mind for future videos.
As usual, your video is super clear and answer the very question I was asking myself.. It is very helpfull to have you on TH-cam !
Thank you for your kind words! I'm glad to hear the video was helpful and answered your question 🙏
Amazing, thank you for this
Keep it up !
You're very welcome! Thanks for your kind words, I always love reading your comments. I appreciate it 🙏
you are one of the premier UE guys on youtube. thank you!
Thank you for your kind words! I really appreciate your support 🙏
I never really understood event dispatchers before, thank you so much for making this amazing tutorial!!!! God bless!!!
You're very welcome! I'm glad the tutorial helped clarify event dispatchers for you. Thank you for watching and commenting 🙏
Your videos, this one specifically, are absolutely amazing. I think out of all the tutorials and explanations online, yours are the best. Thank you for putting this content out in the world.
One of the biggest obstacles I have run into and I know many others who are learning to make games, are ways actors communicate with each other without casting to everything. I've actually watched this video a couple time to reference and do it the way you teach.
Could you make a video about best practice for class dependencies and class children? This video hits that really well but myself and probably others would love for you to explain a general sense of structure for all how to organize and build out your classes. If that makes sense.
Hey, thank you so much for your kind words! I'm really glad to hear you find my videos helpful 🙏 I’ll definitely consider it for a future video. Thanks for watching and sharing your thoughts!
This is amazing Ali. Please keep tutorials like these coming. These two concepts are essential for so many system in UE5. I’m sure there are other as well
Thank you so much for your comment! I'm glad you found it useful. I'll definitely keep creating more tutorials around essential concepts in UE5 🙏
Best tutorial on youtube, please keep doing tutorials like this
Thank you so much for your kind words! I'm glad you found it helpful. I'll definitely keep making more tutorials 🙏
Very clear and useful as always. Each video you make help all of us beginners. Not tested yet your chat bot as I don't need it at the moment. I think the example you use with object colliding with actor is a good one as it was one of the principal issue people had. Can't say anything than you have to keep making those videos. Pure gold, instructive, and well explained. Thanks Ali.
Hey, thank you so much for your kind words! I'm really glad to hear that you find the videos useful for beginners. Your support means a lot to me, and I’ll definitely keep them coming 🙏
Thank you so much for this video! I'm a beginner just starting to learn Blueprints, and your explanations have been incredibly helpful. You're absolutely a fantastic teacher!
You're very welcome! I'm glad to hear that you found the explanations helpful. Thank you for your kind words, and happy learning! 🙏
All of your videos are amazing! You explain very important and advanced concepts in a simple and intuitive way. Great to see examples of things we should not do and why. Thank you for the amazing content!
Thank you so much for your kind words! I'm really glad to hear that you find my explanations helpful and intuitive. I appreciate your support 🙏
These tutorials about design patterns for unreal are absolutely amazing, not to mention very rare on TH-cam. I’m about to follow your playslit about AI, I hope you are putting these patterns into practice there. If not, would be amazing to have a practicle series that uses all these design patterns you mention. (An inventory serie would be amazing 😊)
Hey! Thank you for the kind words and suggestions. I'm glad you're enjoying the tutorials. I definitely appreciate the idea of a practical series using these design patterns-I'll keep it in mind! An inventory series is also on my radar 😉. Thanks for being a part of the community! 🙏
The best explanation I ever saw regarding the 2 options. I prefer Event Dispatcher for the flexibility and seems easier to understand.
Thank you for your feedback! I’m glad you found the explanation helpful. Event Dispatchers do offer great flexibility, but like I mentioned in the video. These are 2 methods that can work together, not one or the other. So always keep an eye out for opportunities to use them both
Thanks again Ali! Glad to have you cover this topic! Great video. Quick question: At 06:00 you dragged a connecting line from Hit Actor and it placed a reroute node. Changed my life. How did you do that?
Think you just hold ctrl while dragging. I could be wrong tho. Not at my PC atm
@@Tyrannyofman thanks for the response! That allows you to connect it to another node, not auto-drop a reroute node. I did my diligence on the interwebs but couldn’t find it.
@@OverlandBound I know if you do hook up a node you can double click on the string/connector and it will create a reroute node on the string itself. If you delete out the node it was connected too, your connector node will stay. I just don’t know how to drop it like he did in the graph with already connecting it to another node like a branch or function etc etc
Hey @OverlandBound, always great to hear from you ❤️ thank you for the comment
Indeed, when I found this feature as well, I felt like I unlocked a super power 😅. You just press "R" when dragging a node
Excellent explanation man. Lovin the content lately!
Thank you! I'm glad you're enjoying the content 🙏
Thank you for explaining about when casting is ok.
Another way of thinking about casting. It's ok to cast to something that is always loaded to memory (player, controller, game mode etc)
Thank you for sharing your insights! That's a great way to look at it, and it definitely helps clarify when casting is safe to use. I appreciate your contribution! 🙏
I knew this stuff but love seeing how others explain it so hopfully i can be a better teacher too. And i think yours was super thorough and great. Also really cool about your chatbot.
Thank you for your kind words! I'm glad you found my explanation helpful. It's always great to share knowledge and learn from each other 🙏
This is by far the best explination for event dispatchers as Unreal's docs doesn't explain them well.
Thank you for your kind words! I’m glad you found my explanation helpful 🙏
Love your videos. Would be awesome if you put together a course of making a smaller game with these best programming practices and the engines framework. Part of my problem when making a game is communicating at a larger scale. Like these videos are great and shows how to do said things, but in practice when making a full game you have many more classes communicating with one another. For example, updating UI, updating and keeping track of progression, saving that progress, etc.
Hey, thank you for your insightful comment! I appreciate your suggestion about creating a complete course. I’ll definitely consider it as I see how it could be beneficial for many. Communication between classes can be tricky, and it’s a great topic to dive into. Stay tuned! 🙏
I am studying ACS architecture.
(attach System component) and this was very useful to me because there is very little information about it.
Thank you for your great contribution Eli.
I know that one day it will be the ACS pattern's turn.
Hey! I'm glad to hear that you found it helpful, especially since there's not much information out there. Thank you for your kind words, and I'm excited to see where the ACS pattern goes in the future! 🙏
well i watched around 5 or 6 of your videos and i can say that you are a legend (subscribed from first video )
شكرا لك علي الزهيري , بارك الله فيك
Thank you so much for your kind words! I'm really glad you enjoyed the videos and found them helpful. Appreciate the support! 🙏
Thanks for clarifying the casting taboo.
You're welcome! Glad I could help clarify that 🙏
Clean and clear, as usual. Thanks Ali
Hey @@Pizatol good to see you again! Thanks for the comment, glad you found it used 🙏😊
Thank you for your tutorial. By the way, you can press **CTRL**, **Shift**, and **W** to adjust the font size in the UE editor, which can help you when recording tutorials.
Thank you for the tip! That's really helpful 🙏 I'll definitely keep it in mind for future recordings!
wow that's handy. allegedly you can also hold ctrl while zoo3in9 to zoo3 right into the blueprints, 6ut 3ay not 6e needed with the ctrl shift w trick
Best explanation best tutorial best developer and the god use of ue5. You deserve 1 mil subscribers
Thank you so much for your kind words! I really appreciate your support 🙏 Glad you found the tutorial helpful!
Another banger. So glad I found this channel.
Thanks for your support! I'm really glad you're enjoying the content 🙏
This was exactly what I needed. I should share this video with my classmates!
I'm glad to hear it was helpful! Feel free to share it with your classmates 🙏 Thank you for watching!
Great video explaining the differences. Super helpful!
Thank you! I'm glad you found it helpful 🙏
Still amazes me how in depth you go.. It's almost like you are doing it for newbies.. However, you are not actually making something that can be copy/pasted.. So in order to use it, you actually have to understand it..
Just love your approach.. Best way to learn, is by understanding.. Top notch direction still.. Way better than all the "here's how you make a shooter", since thats just.. copy/paste tutorials :D
Thank you for the thoughtful comment! I'm glad you appreciate the depth of the explanations. Understanding the concepts is definitely key to mastering game development. Your support means a lot 🙏
omgggggg this is so great lol im making a horror game and the code looks more terrifying than the game itself lol i am so glad i stumbled upon this im about to use these interfaces and dispatchers i KNEW there was a easier method than hard coding every single thing!
I'm glad you found it useful for your horror game! Interfaces and dispatchers can definitely simplify things. Good luck with your project! 😄
I've been looking for a good explanation for this question for ages now! Thank you so much for actually explaining the differences and not just saying "do this cause it's good"
You're very welcome! I'm glad the explanation was helpful. Thank you for your comment 🙏
Great explanation.. Thank you Ali ❤
You're very welcome! I’m glad you found it helpful. Thank you for watching and commenting! ❤️
after watching ever tut and every vid, I'm starting to FINALLY understand UE. Thnk you so much! :)
was wondering.... would it be ok to suggest your next tutorial series, or only patrons can give suggestions? more than happy to become patreon if we can give a bit of a nudge in a certain direction to learn something specific :)
Hey! I'm glad to hear that you're starting to understand UE, that's awesome! 🙏 You're more than welcome to suggest ideas for future tutorials, I always appreciate input from my viewers. Thank you for considering supporting me on Patreon as well! Just let me know what you have in mind 😊
@@AliElZoheiry im not sure if it has been already suggested, but maybe a stamina system incorporates the environment source be rly awesome! Similar to the one in BotW (how you can climb any surfaces, slide down and getting exhausted if a surface is inclined, how u go faster downhill, gliding).
Even if if only for Patreons, i would gladly give u ma monei to learn smt like that. ur an amazing teacher :)
Ahh I like it for my "Games Dissected" series, I'll definitely keep it in mind 👍@@Tenchinu
@@AliElZoheiry thnk u very much! cannot wait :)
Thank you for yet another amazing and free lession
You're very welcome! I'm glad you found it helpful. Thank you for watching and commenting 🙏
The unreal master is back! ❤ Thanks for that perfect explanation!
Thank you for your kind words! I'm glad you found the explanation helpful 🙏
nice always wanted know about event dispatcher properly. :DD nice video as always ty
You're very welcome! I'm glad you found it helpful 🙏 Thanks for watching and commenting!
I really do like your tutorials as you really do explain things very well. I am hoping you cover the Command design pattern at some point.
Hey! Thank you for your kind words, I appreciate it! I'll definitely consider covering the Command design pattern in future content 🙏
I think it can also be confusing knowing you still need to reference something across both Interfaces, and Dispatchers. I've fallen into this trap as well where regardless of what I wish to do (at least for calling an event of something), both Dispatcher and Interface still needs a reference passed into them in order to know what they are actually affecting (which is what OOP is all about), and sometimes that can be quite hard to achieve without knowing how to do that. It's easy for collision events since it passes the actor that it hits already, but for other cases, and can be tricky. On top of this, for specific use case where a player needs to call out to a range of different actors, they would still need some form of referencing to all of these actors such as using a 'get all actors of class/Tag/etc.' node (which is expensive) or use some sort of array and store the actor's ID's in there.
Hey! You bring up some valid points. Referencing actors across Interfaces and Dispatchers can indeed get a bit tricky. To solve for that, you can use the "Mediator Pattern" to build an EventManger, which I show how to do in this tutorial th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Fantastic explanations, really helped me understand. My only comment would be, I would have liked to see a different example of how using an Event Dispatcher could be useful (optimal) with something different than the Actor Component use case. But thanks so much !!
Hey! I'm glad to hear the explanations helped you understand 🙏 Thank you for your suggestion! I'll definitely keep that in mind for future videos. Thanks for watching and commenting! 😊
Найкраще пояснення цієї теми на TH-cam
Дякую! Радий чути, що пояснення було корисним 🙏
First of all, great tutorial!
Diving further into memory management, would you ever make a tutorial on it in general? Or maybe a guide on soft references?
Thank you for the kind words! I'll definitely consider making a tutorial on memory management and soft references in the future. Appreciate the suggestion! 🙏
Great video, I'm really loving your teaching style. I'd really like to see a video on effectively managing a large number of timers that are based on actual clock movement with potential multipliers. Think of a game like Factorio where there could be tens/hundreds of thousands of independent timers. I may just be overthinking it and it's not as difficult to scale as I think.
Thank you for your kind words! I'm glad you’re enjoying the content. That's an interesting suggestion, and I'll definitely add it to my list for future videos! It's a complex topic, but not impossible to tackle. Stay tuned! 🙏
What a PHENOMENAL tutorial. Amazing! Just stumbled across your channel, will definitely check out more videos!
Thank you for the kind words! I'm glad you found it useful. I hope you enjoy the other videos too! 🙏
first time seeing this channel 45 sec in and im a subscriber!
Hey, thanks for subscribing! I hope you find the content useful 🙏
Another Great video! I'm curious what are other Actor Components you most frequently use besides health?
Thanks for the compliment! Besides health, I often use Components like Movement, Inventory, and many others, though it highly depends on the type of game. If you have any specific use cases in mind, feel free to ask! 🙏
@@AliElZoheiry Thank YOU! Since you asked....! I'm building a single-player, turn based battle + explore game inspired by PS1 final fantasies.
For battle mode - Health as you suggested, I suppose MP for magic abilities.
For explore mode - Inventory as you suggested would be great. So long as the items are unique to explore mode (e.g. keys).
Any other ideas at top of mind?
Sounds pretty good @@WestinsWorldStudio indeed an inventory component could be great for your use case
A pretty good breakdown of how these work
Thank you! I'm glad you found it helpful 🙏
Thanks Bro ♥️
@@NatadTech you're very welcome, thanks for watching and commenting
Great video as usual ☺️
Thanks! I'm glad you enjoyed it 😊
Great video. With the introduction of Unreal Engine 5, I now increasingly find myself using Gameplay Messages as a third way of writing decoupled logic between unrelated classes. This also uses the publish-subscribe model, but requires the least amount of setup in my experience and so allows for you to implement the behaviour more freely and loosely across the game. Have you had much experience with these? If so, I would love to see a video on your opinions on them and how they should best be utilised alongside interfaces and event delegates.
Hey! Thanks for your comment. I appreciate your insights on Gameplay Messages; they can indeed offer flexibility in decoupled logic. I haven't explored them in-depth yet, but I’ll add your suggestion to my list for future videos. Stay tuned! 🙏
This is exactly what I needed
You're very welcome! I'm glad to hear that it was helpful 🙏
Love the content, Ive been wanting to learn more about dispatchers. Is a dispatcher only used from a component, or can you use them outside of components? Thanks for the hard work!
Hey, thank you for your kind words! Dispatchers can be used both within components and outside of them. They're a great way to keep your code organized and facilitate communication between different parts of your game. If you have more questions, feel free to ask! 🙏
So incredibly valuable
Thank you! I'm glad you found it valuable 🙏
lol I literally was thinking this question the other day. You mind reader! Great video thank you.
For a Points/Score system in the HUD, I think that would be similar to health where there's an actors component with an event dispatcher on both sides correct? I can see how an interface could be used too but It sounds like Dispatchers would be better in that case.
Haha, that's funny! I'm glad the video resonated with you. Thank you for watching and your kind words! 😊
Can you make a course about everything the most used nodes in blueprints? That would be very helpful for a lot of people I believe. Great videos btw!!
Hey! Thank you for the suggestion! I’ll definitely consider making a course on the most used nodes in Blueprints 🙏 Glad you’re enjoying the videos!
Awesome fella thank you!
You're welcome! Glad you liked it 🙏
Amazing video, calmly and steady showing the steps.
But when is it better to usa an interface over an event dispatcher?
I think flexibility of code is so powerful that deciding on structures is just a step in the wrong direction.
Thank you for your thoughtful comment! Great question regarding interfaces and event dispatchers. Generally, interfaces are better when you want to enforce a consistent structure across different classes, while event dispatchers are useful for communication between objects without tight coupling. It really depends on your design goals and flexibility needs. Hope that helps! 🙏
Beat Boxing vid next? ;) Great explanation as always and very much appreciated for sharing. ~Thank you.
@@KINGDOMSONSTV hahaha glad you noticed that Easter egg, now I know who watches till the end ;)
Thank you for this info
@@michaelbond4609 you're very welcome 😁 thanks for watching and commenting 🙏
This channel is gem, you deserve 1220302100123001301 times more subs. I wish i discovered you earlier, now i have to fix my code because i made a traps that can kill a player and i did them with "Cast to BP_PlayerCharacter" and then makes player go ragdoll and disable movement and player respawns, but interfaces would definitely have helped me saving memory usage. Is it possible to make it? Whenever player's body interacts with box collsion of trap it dies and simulates ragdoll physics and instead of casting all the time all types of traps to BP_PlayerCharacter it just communicates with interfaces? I will try to do that, probably i will struggle as im really new to unreal engine and new to coding lol, i just started 2/3 months ago. Anyways awesome tutorial and explanation, subbed and liked and i will watch more of ur old videos and continue watching newer ones in the future aswell. Have a nice day!
oh i just watched further and i know that i should use event dispatchers instead of interfaces when it comes to player's death i guess XD
Hey! Thank you for your supportive comment! 🙏 Yes, using interfaces is a great way to streamline communication and save memory. It sounds like a solid plan to implement that for your traps! Don't worry if you face challenges; everyone starts somewhere, and learning takes time. I'm glad you found the tutorials helpful, and I appreciate you subscribing! Enjoy your journey with Unreal Engine, and have a nice day! 😊
@@AliElZoheiry thanks Ali, keep it up with ur great content if u ever release course im 100% buying it. Have a nice day aswell
This is incredible.
Thank you! I'm glad you think so 🙏
Still admiring your talent for explaining things so lucidly!
I'm very interested in your opinion on the solution I came up with and how bad or good it is. I decided to switch to components, and instead of interfaces I use tags (to make sure that the actor has such a component) . For example, an AC_MyComponent component adds an “AC_MyComponent” tag to its owner and on a fordcast I can get something like GetAllActorsWithTag, then from each actor get the AC_MyComponent component and work with it. This allows me to add a component to an actor without having to change the actor. I only use interfaces instead of tags if I have to call component functions in their implementations anyway. I see these pros and cons of my solution:
Pros:
1) The actor may not know anything about the component. For example, if an item can be reported by radio, we don't need to change the item itself, we just add a component.
2) The actor's logic remains as clean as possible and, as far as possible, is not cluttered by working with the component
Cons:
1) I don't know, but I assume that getting actors by tag is slower than getting them by interface. Plus, you probably have to store a reference to each actor and a reference to the component from it
2) Most components will have to make an assumption about the approximate type of their owner.
Extremely interested in what you think about this, what mistakes you see in it.
Hey! Thank you for the thoughtful comment and for sharing your approach. I appreciate your analysis of the pros and cons-it really shows your critical thinking.
Using components with tags can indeed keep your actor logic clean and decoupled, which is a solid advantage. As for your concerns regarding performance, tags can sometimes be less efficient than interfaces, particularly when dealing with large numbers of actors. However, for many scenarios, the difference may not be significant enough to outweigh the benefits of using components. It’s also true that relying on assumptions about the owner’s type can lead to issues if not managed carefully.
Overall, it sounds like you're on the right track! Keep iterating on your ideas and experimenting to find the best balance for your specific needs. Would love to hear more about your findings as you continue working on this! 🙏
these videos are great, makes it really easy to understand proper design patterns and their practical applications. one question I had is whether it makes sense to use interfaces, or what the correct approach is, when the calling actor may be looking for different types of data from interface function depending on the object it's used on?
ex: I have an interact interface defined and implemented similarly to the one in the video by several actors in my project. However, while my player doesn't care about what happens when it calls interact on a door, when calling it on something like a zipline, vehicle, etc. I'd like it to return a pointer/reference to the actor so my player character can do stuff with it. My initial thought would be to make it so that interact always returns an AActor pointer, but have the door return null. Then for all non-null pointers, try to cast to each class?
Alternatively, maybe the player could pass a reference to itself using the interact interface, and then the actors could use that reference to pass data back to the player. For example, the player calls interact(this), then the zipline can use that pointer to set a pointer to itself in the player class like player->rideZipline(this).
Hey, thanks for your comment! You bring up a great point. Using interfaces can definitely allow for flexibility in design. Your idea of having the interact function return an `AActor` pointer sounds like a solid approach. This way, you can easily check for null and handle each actor type accordingly. Passing a reference to the player is another option that could work well, especially if you want the actors to directly communicate back with the player. Both approaches have their merits, so it really depends on what fits best in your specific use case. Good luck with your project! 🙏
As always the best tutorial maker on youtube, great video thank you !
The only thing that I still don't get is where to use an event dispatcher other than linking an Event in a Component to its owner.
The receiver of an event dispatcher needs a reference to do the binding, making it less modural and lead to casting. So maybe we should avoid using event dispatchers in those cases and reserve it for when the reference is easy to get ? Or did I miss something else ?
Hey, thank you for your kind words! 🌟 You bring up a great point about event dispatchers. To take it a step further and remove the need to get a reference to the actor that is dispatching an event, you can create an "Event Manager" also known as an "Event Bus". Which will allow you to trigger an event from anywhere, and have a central listener that broadcasts it.
For example, the enemy dying can trigger an event. Then the player can listen to all event of any enemy dying without having a reference to any enemy.
I cover this topic in detail in this video and show how to implement it:
th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
@@AliElZoheiry Thanks for the response ! I forgot you hard a video about that, very useful !
Awesome video thanks a lot! Do you have plans to make a video about the State Stree? I would love to hear your thoughts a guidence on how to use it :)
Hey! Thank you for the kind words! I don't have a video on the State Tree planned yet, but I'll definitely consider it for the future. Thanks for the suggestion! 🙏
Thank you!
You're welcome! Thanks for watching and commenting 🙏
Thanks Ali! The way you explain different concepts is so clear. you really have a talent for this. I have one question though. All of the videos I have watched regarding interfaces, references, and memory usage always use the same example: an interactable interface and an interact function / event. This is great and all but what if I only want to get basic data of an object, like world transform for example, from another object, let's say my player character, without creating a hard reference to that specific object. Is it possible to use BP interfaces for that?
I was thinking of creating a generic BP interface called "reference manager" where I would create functions that declare basic data so I could get them and create variables out of them inside the objects that need a reference to this data.
Hey! Thank you for your kind words, I really appreciate it 🙏 For getting basic information, you should already be able to do that on any actor, you can get the transform of any actor without having a reference to a specific class. So I wouldn't recommend creating an interface for defining functions that might already exist on the actor class.
@@AliElZoheiry Thanks for replying! I'm not sure how it's possible to get an actor's data from another actor's blueprint without creating a hard reference though.
let's say I use the "get actor rotation" node in my player character blueprint and the target is another actor called BP_Box for example. I'm not sure how I can do that without declaring to my BP_PlayerCharacter that BP_Box exists. I know that casting creates a hard reference so I was trying to find a way to easily get basic data from actor to actor without having to create hard references.
In the meantime I found a workaround using a blueprint interfaces and tags which seems to work relatively well
Great video! Could you explain Game Mode and Game Instance as well? Thanks!
Hey! Thank you for your comment! I appreciate the suggestion, and I'll definitely consider covering Game Mode and Game Instance in future videos 😉
Awesome vid. My question, when should you use multiple interfaces? Rather than throwing all your stuff in one cohesive interface?
Hey, thank you for the question! It's generally a good idea to use multiple interfaces when you have distinct behaviors or functionalities that may not always be applicable to every class. This keeps your code cleaner, easier to maintain, and more modular. Hope that helps! 🙏
ach! I was expecting that! thanks! 👍
@@HumpaLumpaBiriBam you're very welcome, glad you found it helpful 🙏
Thank you very much, Ali! You are a great teacher! I'm a bit struggling with interfaces - imagine I have an Interact function, but the inputs of it should be different for 2 classes. Intuitively I realize that I need to create an iterface with interaction function - but how do I handle the different inputs to it? Do I need to create 2 different functions in one interface (which looks like not the best decision) or probably something is not right with my code if it leads to having different inputs?
It would be great to have more AI videos on how to add improvements and the possibility of AI tutorials that are friendly like in stores, banks for buying and selling items, etc. since there is no information on that.
Hey! Thank you for your suggestion, it’s definitely something I’ll keep in mind for future videos. I appreciate your input 🙏
Good explanation.
Thanks! I’m glad you found it helpful 🙏
I want to integrate the consolidation system with the inventory system I almost did this, but I can't get the health bar to work
Hey! That sounds like a great project!. Good luck! 🙏
@@AliElZoheiry I think so and the mission was completed successfully
liked before watched, thanks bud
Thank you! I appreciate your support 🙏 Enjoy the video!
Good explanation! One thing which i always struggling is...when you doesn't have reference to actor for interface/dispatcher call.
In your example it's pretty easy with trace, but imagine case when door actor should ask some global manager actor, can open? (Like when alarm state is active or something). Or manager has to tell all objects to change their states...
In that case door/manager should has hard reference on begin play or hard referenced through level. And i don't have another solution for that, and i really bothered of that because most of the "managers" has many hard references to deal with other things in game.
Hey! Great question, and I'm glad you found the explanation useful 🙏 For managing references like this, all actors can have a hard reference to the "manager" actor itself, that's fine because you expect that actor to always be there and all other actors to depend on it (since it's a global manager), but don't put references to other actors in the manager itself, the manager should be agnostic of other classes.
I have a tutorial on how to build an "Event manager" for usecases like that, check it out if you're interested th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Nice video. It would be cool if you could do a similar video for Gameplay Tags.
Thanks for your comment! I'll definitely add that to my list of video ideas 🙏
When you use "Get Actor of Class" or "Get Component by Class" in an attempt to get the actor that is calling the dispatcher, so that you can bind the dispatcher, can this have negative effects for other actors that have different logic but use the same component or class? Let's say that it does cause issues, I've heard that you can also use tags to get specific actors, or storing references to actors in game instances, would these be more preferable or the same? Thanks!
Hey! Get actor of class is very different than get component by class. I use "Get component by class" to search the components of a specific actor to see if that component exists. and then I do certain actions (like binding) only if the component exists. If the component doesn't exist, then I do nothing, and this has no negative effects, because I am only supporting actors that do have this component, and the ones that don't just don't get the additional functionality (which is expected)
Great video!
Thank you! Glad you enjoyed it 🙏
Hi, love your videos, keep up the great work.
I would like to ask for a video which I was not able to find anywhere or at least not explained video how it works really. The subject is control rig blueprint. How to control the players character during game- to grab a door handle when opening a door, make character touch a wall in front when moving too close or simular stuff. I followed some tutorials but they never explain how the transforms changes work and I see alot of weird position of arms or legs of which I am sure should not be possible. Thank you.
Hey! Thanks so much for your kind words and your suggestion. Controlling character interactions like that sounds interesting, and I'll definitely consider it for a future video. The way transforms work can be tricky, but I’ll try to clarify that. Appreciate your support! 🙏
Thank you
You're welcome! Thanks for watching and commenting 🙏
That is, it turns out that the interfaces operate at the global level and the event dispatcher locally, Thank you very much
You're welcome! That is indeed one difference, but event dispatchers can be built in a way to operate on a global level as well, by building something called an "Event Manager". I explain that in this video here th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Just use both. They work very wonderfully when use together
Thanks for the input! It's great to hear that they work well together. Appreciate your comment! 🙏
This is really cool, thank you. How would you use interfaces so when i click on a mesh at runtime and display the location of the actor details in a widget?
I have been struggling to do this with interfaces for a month now. I can do it with casting but not with interfaces.
Hey! I'm glad you found it cool! For your question, start by creating an interface with a function that returns the actor's details. Then implement this interface in the actor class you're clicking on. When you click the mesh, call the interface function to get the details and then display them in your widget. If you're still having issues, feel free to ask on Discord; the community might be able to help as well! 🙏
awesome video.
Thanks! Glad you enjoyed it 🙏
Hi Ali, could you cover behavior trees, state trees and (unrelated) gameplay tags?
Also could you cover when to use event graphs versus construction scripts?
and also could you cover blueprint function libraries?
Hey! Thank you for your comment and suggestions! I'll definitely consider these topics in future videos. Stay tuned! 🙏
so casting is dependent on actors recalling the in memory storage, interface is dependent on its connected blueprints so will want to call on the blueprint its connected to, and event dispatchers are kind of standalone independent functions that are not really dependent at all?
is it possible to just replace all interfaces and casting with event functions or are there distinct differences that wouldn't allow that?
Hey there! Almost, but its important to understand that casting just creates a "hard reference" and adds a dependency, and that's what causes something to be loaded into memory.
So when using event dispatchers, you also have to reference an actor to bind to its event, and therefore create a hard reference as well, so just be aware of what you are referencing in any class.
If you want to learn more about dependencies I suggest checking out this video th-cam.com/video/y4fE2JdFdvY/w-d-xo.html
Ali your videos are wonderful. I have watched almost all of them, and over the last few weeks I have used a lot of the info for building a basic FPS. However, I've got myself a bit confused. Through your tutorials, I have BPI_Damageable set up, and the Health component set up. This has resulted in a Death custom event and an On_death event in my player character blueprint, and I am not sure which to use. When it comes to these systems, I am confused on which should be integrated with my HUD. Is it better to have the interface pass damage info to the component which then passes the damage to the player character and then the health bar? I am confused enough that I don't know if I am even explaining this properly.
Hey! Thank you for the kind words, I'm really glad to hear that my videos have been helpful for your FPS project 🙏 As for your question, like I said in the video, there is no right or wrong, or one way that's better than the other, you should be using both approaches, and assess which approach is right for your specific use case. I suggest using the information from this video to try to understand which one is better for your specific need.
So if you wanted your player to be able to push a button to open a door, there would be an interface implemented between the player and the button, and an event dispatch between the button and the door?
Well it depends on a lot of things, but generally speaking, if you have multiple different kinds of doors, all with their own unique "Open" function. Then yes, you would have a door interface, and the player just calls an "Open" function on that door reference without caring what type of door it is.
Then if you want the door to notify the player when it's fully open, you can then indeed dispatch an event from the door saying where the player listens to it, and then knows it's fully open when it's called