Unreal Engine tutorials dont teach you about this...

2024 ж. 15 Мам.
17 072 Рет қаралды

Lot of youtube tutorials don't teach you proper way of managing the code and communicating between the blueprints! Let me show you how to do it!
LIKE and SUBSCRIBE with NOTIFICATIONS ON if you enjoyed the video! 👍
Have you ever had a dream about having your own game? Lets make that dream come true. You can order me and my team to create your very own game which you will have full owning rights for! Order us at: www.fiverr.com/summonevilgames
--------------------------
▶️ SOCIALS:
🎥 KZhead | / @rubadev
🖥️ Website | summonevil.com/
👉 Discord | / discord
📱 TikTok | / frontv9
Patreon | / rubadev

Пікірлер
  • yes and no... its not being updated on every tick.. its being fetched on every tick with a memory pointer therefore it is not free operation but GETTERS is a simple operation. its super low performance. if you would +1 before displaying - that would be a math operation and local variable memory change and therefore it would be performance wise bad.. the biggest "cost" to your getter in widget was float to text conversion. not float fetch on tick. And I disagree on "no one covers it in tutorials" as I made extensive tutorial on good practices for interactions between actors. so interfaces and dispatchers. Just to be clear - what you are teaching here is BEST PRACTICES. and it's a 10/10 :D But I'm a picky little goblin that likes to do "ugh actually!" and so I did.

    @3sgamestudio@3sgamestudioАй бұрын
    • Thank you for clearing that one out. Pinned!

      @RubaDev@RubaDevАй бұрын
  • I started in on UE5 and game dev via tuts about 3 months ago and coming from a programing background I'd been wondering about this a lot. Had just started researching this stuff and your video was great and timely. Thanks man!

    @alternativehats3926@alternativehats3926Ай бұрын
  • I'd like to push back on your view of casting in Unreal because it fundamentally gets new devs to over-complicate their system designs. Casting is NOT bad and you shouldn't avoid it at all costs. Casting is in the engine for a reason and it has a ton of uses that you're throwing out if you try to avoid it. Casting is only a problem if you're casting to something that wouldn't otherwise be loaded into memory already. Even then, its only an issue if you have a chain where that object you're casting to has other hard references and casts. In your UI example, your player HUD would reasonably always be loaded and in memory along with your player. Casting to the HUD on BeginPlay and saving it as a variable that you can then update directly is much better than using the Get Widgets Of Class node every time you want to make a change. I completely agree on the binding part of your video, but please don't avoid casting and make communication more complicated than it should be. Hopefully that helps!

    @driftmirror@driftmirrorАй бұрын
    • You are right! Also half of this video was focused to just show how blueprint interfaces work and whats logic behind it, but I agree with what you say ofcourse that is indeed true!

      @RubaDev@RubaDevАй бұрын
    • I saw this comment and I will do another "Well actually"... Casting is not really an issue if you're casting to core C++ classes in the engine or casting to core c++ classes in your main game - those that are compiled into the final build of the EXE. as all classes templates are being pulled into memory on the start of the games exe (so all mechanics in c++ are being available to memory instantly, but not all resources that are in anyway visual). What that means is that when you for example cast to character - you are comparing your class header to a default object template in memory already - so it's a pretty straightforward operation (by the way in blueprints we have access to "get class defaults" but in c++ we have actually option into reference a default COPY of an object and its values after its constructor resolved. So for example, you can get its Scale value when in class defaults it's unavailable). HOWEVER - if you cast to a BP class even though blueprints are nativized by default now, it still creates a default copy of the cast class, constructs it, runs its constructor and then compares the header and signature. So a cast to something very complicated like " fluid ninja actor" or some super complex auto-vine system - will be more memory-heavy. it's less impactful on computation. now - if you cast on tick to something heavy, you get a lot of garbage for the garbage collector therefore you can brick your performance on less memory available platforms like mobile or switch (with its ridiculous 4 GB of shared GPU and RAM).

      @3sgamestudio@3sgamestudioАй бұрын
  • Thank you so much! As a new developer, I am always on the lookout for better code practices. I've seen a lot of devs that seem to advertise 'dirty' code. They always say casting is bad but they're gonna do it anyway. Makes no sense to me.. and it's really good to be able to recognize bad practices when I see them. Every now and then I stumble over a dev willing to show the *right* way to do it, and that is gold. So, ty! New sub. I will be binge watching your other stuff soon.

    @Fizziepop@FizziepopАй бұрын
  • Just started about a month ago and you are making this so easy for beginners to understand efficiency. Thank you.

    @JustATanneriteDummy@JustATanneriteDummyАй бұрын
  • Happely stumbled on this! Knew I should have been using Interfaces for a while but always was seeing ways to do things without them. Thanks for the clear demo! Suscribed!👏

    @Obumbro@ObumbroАй бұрын
  • Very nice to see someone with a "best practice" video. I have to say at first interfaces had my mind in a knot but now I understand them much better they are my favorite tool. Imagine my excitement to discover they are also implementable in C++. (note I didn't say blueprint interfaces are implementable from C++, just C++ by using multiple inheritance.)

    @b.delacroix7592@b.delacroix759214 күн бұрын
  • Great video! Thank you sooo much for this one. Please provide us with more videos like this because it's really essential for creating highly performant code/blueprints in game development.

    @Mr.Jeremia@Mr.JeremiaАй бұрын
    • I will work hard to produce more quality content thank you for kind comment!

      @RubaDev@RubaDevАй бұрын
  • I feel like that in this specific case using an event dispatcher seems a lot faster, less fiddly and generally easier. Having an object send the signal to whom-it-may-concern(subscriber list); player handlers and/or player-stats handlers seems more suited keeping track of that. I probably would only really use interfaces for things like interacting and weapon related things: things that need to interact more "specifically" and less "broadly". Anyone who is interested into reading more into that; I suggest the book - Game programing patterns by Bob Nystrom.

    @tofast4ya@tofast4yaАй бұрын
    • Yes thats correct! I just wanted to show how blueprint interfaces work!

      @RubaDev@RubaDevАй бұрын
    • I totally forgot about this book which someone recommended like years ago. I never got a chance to read cuz life. But I guess it's a good time to start now.

      @dreamingacacia@dreamingacaciaАй бұрын
    • @@RubaDev Can you teach us how to use dispatchers effectively?

      @InfiniteBeyondFiji@InfiniteBeyondFijiАй бұрын
  • Finally a blueprint interface tutorial that actually shows how pass variables between blueprints! This is exactly what I've been searching for for the past few weeks as I've been learning UE5. Thanks so much! Liked and Subscribed

    @MKJwhoa@MKJwhoaАй бұрын
  • Awesome video again! I'm starting with UE5 in the past 2 weeks and I learned a lot from you so far!

    @shibii@shibiiАй бұрын
    • Thank you very much comments like those keep me going !

      @RubaDev@RubaDevАй бұрын
  • Best explanation of interfaces by far. Great job man.

    @jb2760@jb2760Ай бұрын
    • Thank you very much, glad I could help!

      @RubaDev@RubaDevАй бұрын
  • Thank you for making this tutorial. Made me one of your 3.1k subscribers :D

    @azoth._.@azoth._.Ай бұрын
  • I'm very new to Blueprint so this is great to know - I always had a bad feeling about casting!

    @Flowerpot2905@Flowerpot2905Ай бұрын
    • Not always is casting bad for example when you have something loaded thru the whole game for example HUD or GAMEINSTANCE there will always be some examples but this comes with experience! Don't worry about it too much!

      @RubaDev@RubaDev28 күн бұрын
  • THANK YOU ! Good practice videos are such a blessing ! thank you for showing this !

    @ryanjdevlin87@ryanjdevlin87Ай бұрын
    • Thank you! I'm glad you found it helpful!

      @RubaDev@RubaDevАй бұрын
  • Thanks you for sharing this! I've seen this happen in most if not all most popular UE tutorials, that's why what I've done, and I recommend doing, is to just watch the tutorials for reference and try to apply it yourself the "proper" way. Of course if youre a beginner just follow the tutorials, you'll learn and the "dirty" code is fine if it works.

    @gambello1195@gambello1195Ай бұрын
  • Thx❤ i dislike casting. This is a nice solution

    @ricardo22448@ricardo22448Ай бұрын
    • Thank you! Yup this solution is best practice that you can do in your blueprints!

      @RubaDev@RubaDevАй бұрын
  • thank you!

    @JulioDevUnreal@JulioDevUnrealАй бұрын
  • We only learn from Masters... as you are! Thank you for this approach! (i didn't learn anything in this video that I didn't already know... but that's cool to see good tutorials like yours ;) )

    @studiothink81@studiothink81Ай бұрын
    • Thank you very much friend!

      @RubaDev@RubaDevАй бұрын
  • thanks bud it was in time

    @wowwowwoah@wowwowwoahАй бұрын
  • Brilliant!

    @lancelmarchettil@lancelmarchettilАй бұрын
  • Thanks for honest help. First I’ve found.

    @Luke-cecilpod@Luke-cecilpodАй бұрын
    • No problem! I am happy to help!

      @RubaDev@RubaDevАй бұрын
  • Great tutorial. Get all Widgets of Class can be expensive too though. Not as much as binding in the UI, but still more expensive. Best option is to get the UI Var from the player controller or character.

    @TorQueMoD@TorQueMoDАй бұрын
  • i’m in the process of switching from unity to unreal, and have been getting very frustrated with all the tutorials. This is the first tutorial I have seen that actually makes sense. Other tutorials like doing health bars and having it zero to one to me is wrong it should be 0 to 100 on a slider, but I couldn’t find a tutorial to do it. I have a long way to go to get good at blueprints after being so used to unities visual programming. Thank you.

    @sadravin1@sadravin1Ай бұрын
    • its the most effecient to go 0-1. You can create your custom framework, but if you really want to optimize you convert the MaxHP into 1 and MinHP into 0, no matter if the number is supposed to be 100 or 200 or 900 but yes, a lot of tutorials are worthless, the worst i have seen so far was a guy that started with EventTick, put a Sequencer afterwards,immediately followed by Delay of 5seconds... from what i gathered, EventTick should be used only on physic calculation or updating anything graphics related. Delay have ultra specific uses and should not be used in 99% of cases

      @Drakuba@DrakubaАй бұрын
  • I always use property binding instead of function binding. I have not delved into the UE source code to be absolutely sure, but it seems that the UPropertyBinding class takes an FScriptDelegate in its Bind() method. So, I think it's some implementation of the observer pattern, which means that it is not called each frame, but only when the value of the bound variable actually changes. I would be surprised if they haven't done it this way, because that would not make any sense to me. This is much easier to work with as you don't need to care about actually updating the widget, but only about the respective value.

    @MaviLeb@MaviLebАй бұрын
  • Great video, a practical example with a good explanation as to why you do what you do! Question! Very often I struggle to decide whether to use interface or event dispatchers as a solution to a problem, mostly I default to interfaces. I am afraid I'm missing some vital information that make this choice harder than it should be. Do you have a few pointers on how to choose between the two?

    @Multiblitzyy@MultiblitzyyАй бұрын
  • I’ve been so appreciative of your videos. Love that you’re covering some better practices. Would you be able to make best practice video on folder structure, Unreal is really bad for moving things around and causing breakage. I’d love to create a third party folder for my Marketplace addons. Marketplace forcing us to load into Content folder makes it really hard to manage a clean structure.

    @fragileglass9622@fragileglass9622Ай бұрын
    • Hm are you thinking video where I cover where should you organize your stuff like naming conventions?

      @RubaDev@RubaDevАй бұрын
    • @@RubaDev I was thinking along the lines of managing content within folders as project grows. It breaks a lot of things if you don’t have redirects set correctly, folders don’t completely move or delete. I find moving down the road with a project, I can’t easily restructure folders and things get out of control fast.

      @fragileglass9622@fragileglass9622Ай бұрын
  • This video made me subscribe

    @JonSkov-DK@JonSkov-DKАй бұрын
    • Thank you very much I'm glad you liked it!

      @RubaDev@RubaDevАй бұрын
  • gg keep it up! Thanks for teaching us the right way instead of casting.

    @MikeyBison@MikeyBisonАй бұрын
  • Excellent

    @craigmakarowski6060@craigmakarowski6060Ай бұрын
  • Great channel, specially when you try teach the right way, cuz ticks are bad practice for sure, unless you are making something very simple

    @betraid@betraidАй бұрын
  • Many thanks and congratulations for this video! You help more than you imagine a young beginner developer like me, even after watching numerous videos and documentation on Blueprints, communication is a real subject. I'm really looking forward to seeing your next videos !! :) There's probably one thing that would be great to explain (because I see a lot of ways to use the Steam Advanced Session for lobby creation, etc.) but it doesn't have the following situation: I have a main menu and a main map I created the Session functions (Creation, search, join, destroy a session...) My problem is: Player (server) created a session, when another player (client) joins the session, if player (server) comes from the Destroy session during that same time, then the player who joins currently does not do so. cancel the download. A kind of infinite connection. How to have: If the player (server) has Destroy Session, then players currently connecting to the session will cancel the connection and return to the menu. For example in your "Pause menu" video, if the player (server) returns to the main menu, his session is destroyed but at that moment then a player (client) was connecting. And a real topic, which I can't find anywhere, would be to explain why certain video game projects last several years, what are the most common problems that slow down development. (Without taking into account time, money. Let's imagine instead that a developer has all his time, no money problems and works alone, his only constraint is knowledge). And so if an independent developer learns all areas, can he succeed in making an ambitious multiplayer video game? And last subject: Concerning optimization, how to know in advance the limits of video game development, for example, you must respect a number of assets, card size, number of blueprints or Interface. . Because if we prepare a complete gameDesign in the game and we realize 3 years after the start of development that there are technical constraints... I think you understand this :) Fingers crossed, in the meantime, thanks again, well done, this channel is incredible!

    @gosti_fr6106@gosti_fr6106Ай бұрын
    • Thank you for your feedback. I read thru this and I can agree some of those topics should be covered I'll work on it in the future! Stay updated!

      @RubaDev@RubaDevАй бұрын
    • @@RubaDev Thank you :) Good vibes

      @gosti_fr6106@gosti_fr6106Ай бұрын
  • Very nice tutorial. But doesn't the BeginOverlap Event also create a check on every tick? 🤔

    @revan9903@revan990329 күн бұрын
  • U DESERVE 1Million subs

    @connorjade5460@connorjade5460Ай бұрын
    • Fingers crossed! Thank you very much!

      @RubaDev@RubaDevАй бұрын
  • nice!

    @eligijuspranskunas3509@eligijuspranskunas3509Ай бұрын
  • Is there any way to figure out where a BPI is called from without digging through every blueprint and finding ones that implement that BPI? Probably not? I've been using Unreal for months and haven't found a way to stack trace BPIs.

    @6Planet@6PlanetАй бұрын
  • 💯 ty

    @korypeters2059@korypeters2059Ай бұрын
    • No problem!

      @RubaDev@RubaDevАй бұрын
  • Some good stuff, but honestly for something static like this for money you should just manually set the text inside the char bp on add money, since you made the HUD in your char you could just promote to a variable and cut a lot of unneeded interfaces. Interfaces are great for things that you don't have any easy hard reference for or you want to call to many types of actors with the same call.

    @1_Man_Media@1_Man_MediaАй бұрын
    • Its just an example and usually I put HUD inside of the playercontroller also I was just showcasing how you can use one with simple examples. Thanks for feedback tho appreciated!

      @RubaDev@RubaDevАй бұрын
  • yeah, don't use binding events if you really really don't have to. UI only needs to be updated when it needs to . I don't use binding events at all. No casting either. Interface is the way to go. No hard referenes either.

    @boomwowsion64@boomwowsion64Ай бұрын
  • Maybe create Content warning in ue5

    @derekk3664@derekk3664Ай бұрын
  • Can you please explain why the use of blueprint is not recommended for multiplayer game, everyone says is bad performance, and why you require C++ ?

    @xjuliussx@xjuliussxАй бұрын
    • maybe they talk about ue3, ue5 i cant see any difference that matters atleast for most games, if you are not planing to create an MMO you are fine with blueprints

      @D4KiRZ@D4KiRZАй бұрын
    • It is not recommended for multiplayer game as blueprint runs code way slower than C++ and now you can imagine if you have thousands of actions per second in multiplayer game you will have significantly lower performance as you would have with C++ basically C++ will fire off code way faster than blueprint will ever be able to, especially when it comes to multiplayer games you need to get performance where you can! Although for smaller games COOP or something like Horror/Puzzles you can use blueprints and you probably wont be "that much" affected! Hope it helps!

      @RubaDev@RubaDev28 күн бұрын
    • Yes I agree, or some competitive shooters don't!

      @RubaDev@RubaDev28 күн бұрын
    • @@RubaDev yes it helps a lot. I am aiming for a 20 vs 20 , so i will need c++

      @xjuliussx@xjuliussx28 күн бұрын
    • @@RubaDev well PUBG is using blueprints^^ so its wrong to say that, maybe in ue3 it was bad

      @D4KiRZ@D4KiRZ27 күн бұрын
  • Use Event dispachers insted, not interfaces

    @youseiy@youseiyАй бұрын
  • I feels like I already watched this like months ago or over a year. It's uncanny similar to the voice and speaking pattern as if I watched this specific video before.

    @dreamingacacia@dreamingacaciaАй бұрын
  • Its all about use case scenario.

    @wormjuice7772@wormjuice7772Ай бұрын
    • Exactly!

      @RubaDev@RubaDevАй бұрын
  • This isn't a necessary use of interface. There's nothing "wrong" with casting. In this particular example casting would be simpler. I'll use an interface if something needs to be modular, where a class may not exist or class may vary.

    @Astaraa@AstaraaАй бұрын
  • good tutorial however blueprint interfaces are indeed taught, often and by literally every unreal engine tutorial maker.

    @omegablast2002@omegablast2002Ай бұрын
    • 🤔 I actually rarely see them in tutorials.

      @RubaDev@RubaDevАй бұрын
    • ​@RubaDev depends on who you watch. Bigger channels that often have very poor blueprint etiquette (not gonna name drop but you can probably guess a few) usually don't use them. However I have seen plenty of tutorials utilizing blueprint interfaces lately, definitely usually from smaller channels though.

      @d00gl3@d00gl3Ай бұрын
    • A good amount of the time they aren't

      @dobrx6199@dobrx6199Ай бұрын
  • As a new person I have a hard time understanding what’s actually happening in blue prints.

    @LonelyCornerCrew@LonelyCornerCrewАй бұрын
  • Why not use Event Dispatchers???? The player shouldnt care about updating the UI and thats what event dispatchers are for

    @waterlemon9512@waterlemon951214 күн бұрын
  • KZhead tutorials are bad, but paid professional courses are good. But youtube tutorials are free so the bad knowledge passes on

    @Madlion@MadlionАй бұрын
  • Title is a bit click baity because stuff you show is pretty common in various tutorials, but you're right about this not being present in beginner tutorials. It's not a bad thing though. "Clean Code" and "Good Practices" are concepts you should know about when your work matters. When you're starting, optimization and complicated systems are not your goal. You get to that in time, but you got to start somehere with something simple, binding and casting is simpler than interfaces and net of events, and it also is a perfectly viable solution to many problems. You're telling people why you shouldn't use those, but you're omitting situations they're useful for. There are various levels of complexity in UE systems, and you're not on the top. I could just as well tell you your practices are not the best because widgets should be handled with a HUD class and updated with a viewmodel so text is bound to the field notify and changes only when the variable changes without extra event net, and the health should not be a character's variable but a decoupled component. But it doesn't matter by itself. What you should or shouldn't use depends on the context, and when you're learning, you need the basics. Btw, i don't have a beef with you telling people about those concepts, it's great, just keep in mind these things are in the engine for a reason and you're not telling the whole story.

    @MrKosiej@MrKosiejАй бұрын
  • Sir, if you are talking about real programming and says how the viewers should do the things, you are living in the only one universe where the cube is knowing that it should increase players money 😅 In fact, the cube should have a cost field and the field should be taken by the pick up event, which will increase players money for the cost of the cube.

    @viktorkram2531@viktorkram2531Ай бұрын
  • Blueprints break many fundamental Software Engineering principles. What a pity, what a mess.

    @NB-qq8wo@NB-qq8woАй бұрын
    • Amen! I love Blueprints on the visual side of the game engine. Materials, artwork, VFX. The game logic really falls hard on me. I’m a Frontend Developer by trade. I struggle hard to build the game mechanics from Blueprints. PHP, JavaScript, Typescript are all bastardized languages, not leaving me much room to stuff C++ into my brain. 😂😂

      @fragileglass9622@fragileglass9622Ай бұрын
    • I agree blueprints can get really messy and I prefer C++ over blueprints for gameplay logic and mechanics!

      @RubaDev@RubaDevАй бұрын
    • @@fragileglass9622 Hahaha blueprints are trully a mess once project gets a bit larger..

      @RubaDev@RubaDevАй бұрын
    • Yesss... I find blueprints so messy and confusing compared to regular code.

      @yahootube90@yahootube90Ай бұрын
    • ​@@RubaDev So please tell me can I use just blueprints for a moderate project ? ❤

      @user-qo4zm6qr9i@user-qo4zm6qr9iАй бұрын
KZhead