Unreal Engine tutorials dont teach you about this...

Поділитися
Вставка
  • Опубліковано 31 тра 2024
  • 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:
    🎥 UA-cam | / @rubadev
    🖥️ Website | summonevil.com/
    👉 Discord | / discord
    📱 TikTok | / frontv9
    Patreon | / rubadev

КОМЕНТАРІ • 96

  • @3sgamestudio
    @3sgamestudio Місяць тому +38

    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.

    • @RubaDev
      @RubaDev  Місяць тому +5

      Thank you for clearing that one out. Pinned!

    • @knuckles7410
      @knuckles7410 11 днів тому +1

      @@RubaDev No, what is shown here isn't best practices, why would you even say that? The best practice is to use a view model object with field notify. You guys are both clowns. Why making tutorials with convoluted bullshit when you don't even know what you are doing or talking about?

  • @driftmirror
    @driftmirror Місяць тому +24

    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!

    • @RubaDev
      @RubaDev  Місяць тому

      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!

    • @3sgamestudio
      @3sgamestudio Місяць тому +3

      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).

    • @knuckles7410
      @knuckles7410 11 днів тому +1

      @@3sgamestudio You're full of shit, it has nothing to do with c++ or BP but with the memory weight of what you are casting. Since the base class are lightweight, casting to a generic actor class will have almost no negative impact because it's an empty shell. Build your customized, high rez character and you'll have at least 2gig of textures and other stuff. I guess no one is playing with the invisible man in his game right? Stop misleading people with your bullshit about c++. Casting is bad if you can avoid it and/or if it loads something heavy that you might not use in the game session.

  • @tofast4ya
    @tofast4ya Місяць тому +13

    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.

    • @RubaDev
      @RubaDev  Місяць тому +1

      Yes thats correct! I just wanted to show how blueprint interfaces work!

    • @dreamingacacia
      @dreamingacacia Місяць тому +1

      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.

    • @InfiniteBeyondFiji
      @InfiniteBeyondFiji Місяць тому

      @@RubaDev Can you teach us how to use dispatchers effectively?

  • @b.delacroix7592
    @b.delacroix7592 Місяць тому

    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.)

  • @alternativehats3926
    @alternativehats3926 Місяць тому +3

    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!

  • @Fizziepop
    @Fizziepop Місяць тому +1

    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.

  • @JustATanneriteDummy
    @JustATanneriteDummy Місяць тому

    Just started about a month ago and you are making this so easy for beginners to understand efficiency. Thank you.

  • @Mr.Jeremia
    @Mr.Jeremia Місяць тому +2

    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.

    • @RubaDev
      @RubaDev  Місяць тому +2

      I will work hard to produce more quality content thank you for kind comment!

  • @shibii
    @shibii Місяць тому +2

    Awesome video again! I'm starting with UE5 in the past 2 weeks and I learned a lot from you so far!

    • @RubaDev
      @RubaDev  Місяць тому +1

      Thank you very much comments like those keep me going !

  • @MaviLeb
    @MaviLeb Місяць тому +3

    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.

  • @Obumbro
    @Obumbro Місяць тому

    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!👏

  • @azoth._.
    @azoth._. Місяць тому

    Thank you for making this tutorial. Made me one of your 3.1k subscribers :D

  • @MKJwhoa
    @MKJwhoa Місяць тому

    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

  • @jb2760
    @jb2760 Місяць тому +2

    Best explanation of interfaces by far. Great job man.

    • @RubaDev
      @RubaDev  Місяць тому

      Thank you very much, glad I could help!

  • @gambello1195
    @gambello1195 Місяць тому

    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.

  • @Flowerpot2905
    @Flowerpot2905 Місяць тому +1

    I'm very new to Blueprint so this is great to know - I always had a bad feeling about casting!

    • @RubaDev
      @RubaDev  Місяць тому

      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!

  • @ryanjdevlin87
    @ryanjdevlin87 Місяць тому +11

    THANK YOU ! Good practice videos are such a blessing ! thank you for showing this !

    • @RubaDev
      @RubaDev  Місяць тому +2

      Thank you! I'm glad you found it helpful!

  • @JulioDevUnreal
    @JulioDevUnreal Місяць тому

    thank you!

  • @Luke-cecilpod
    @Luke-cecilpod Місяць тому +1

    Thanks for honest help. First I’ve found.

    • @RubaDev
      @RubaDev  Місяць тому

      No problem! I am happy to help!

  • @studiothink81
    @studiothink81 Місяць тому +1

    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 ;) )

    • @RubaDev
      @RubaDev  Місяць тому

      Thank you very much friend!

  • @ricardo22448
    @ricardo22448 Місяць тому +5

    Thx❤ i dislike casting. This is a nice solution

    • @RubaDev
      @RubaDev  Місяць тому +1

      Thank you! Yup this solution is best practice that you can do in your blueprints!

  • @Multiblitzyy
    @Multiblitzyy Місяць тому

    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?

  • @TorQueMoD
    @TorQueMoD Місяць тому

    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.

  • @wowwowwoah
    @wowwowwoah Місяць тому

    thanks bud
    it was in time

  • @lancelmarchettil
    @lancelmarchettil Місяць тому

    Brilliant!

  • @sadravin1
    @sadravin1 Місяць тому

    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.

    • @Drakuba
      @Drakuba Місяць тому +1

      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

  • @betraid
    @betraid Місяць тому

    Great channel, specially when you try teach the right way, cuz ticks are bad practice for sure, unless you are making something very simple

  • @JonSkov-DK
    @JonSkov-DK Місяць тому +1

    This video made me subscribe

    • @RubaDev
      @RubaDev  Місяць тому +1

      Thank you very much I'm glad you liked it!

  • @boomwowsion64
    @boomwowsion64 Місяць тому

    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.

  • @fragileglass9622
    @fragileglass9622 Місяць тому +1

    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.

    • @RubaDev
      @RubaDev  Місяць тому

      Hm are you thinking video where I cover where should you organize your stuff like naming conventions?

    • @fragileglass9622
      @fragileglass9622 Місяць тому

      @@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.

  • @MikeyBison
    @MikeyBison Місяць тому

    gg keep it up! Thanks for teaching us the right way instead of casting.

  • @craigmakarowski6060
    @craigmakarowski6060 Місяць тому

    Excellent

  • @eligijuspranskunas3509
    @eligijuspranskunas3509 Місяць тому

    nice!

  • @connorjade5460
    @connorjade5460 Місяць тому +1

    U DESERVE 1Million subs

    • @RubaDev
      @RubaDev  Місяць тому +1

      Fingers crossed! Thank you very much!

  • @gosti_fr6106
    @gosti_fr6106 Місяць тому +1

    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!

    • @RubaDev
      @RubaDev  Місяць тому +1

      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!

    • @gosti_fr6106
      @gosti_fr6106 Місяць тому

      @@RubaDev Thank you :) Good vibes

  • @6Planet
    @6Planet Місяць тому

    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.

  • @1_Man_Media
    @1_Man_Media Місяць тому +1

    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.

    • @RubaDev
      @RubaDev  Місяць тому

      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!

  • @revan9903
    @revan9903 Місяць тому

    Very nice tutorial. But doesn't the BeginOverlap Event also create a check on every tick? 🤔

  • @korypeters2059
    @korypeters2059 Місяць тому +1

    💯 ty

  • @dreamingacacia
    @dreamingacacia Місяць тому

    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.

  • @xjuliussx
    @xjuliussx Місяць тому +1

    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++ ?

    • @D4KiRZ
      @D4KiRZ Місяць тому +1

      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

    • @RubaDev
      @RubaDev  Місяць тому +1

      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
      @RubaDev  Місяць тому

      Yes I agree, or some competitive shooters don't!

    • @xjuliussx
      @xjuliussx Місяць тому

      @@RubaDev yes it helps a lot. I am aiming for a 20 vs 20 , so i will need c++

    • @D4KiRZ
      @D4KiRZ Місяць тому

      @@RubaDev well PUBG is using blueprints^^
      so its wrong to say that, maybe in ue3 it was bad

  • @LonelyCornerCrew
    @LonelyCornerCrew Місяць тому

    As a new person I have a hard time understanding what’s actually happening in blue prints.

  • @omegablast2002
    @omegablast2002 Місяць тому +3

    good tutorial however blueprint interfaces are indeed taught, often and by literally every unreal engine tutorial maker.

    • @RubaDev
      @RubaDev  Місяць тому +1

      🤔 I actually rarely see them in tutorials.

    • @d00gl3
      @d00gl3 Місяць тому

      ​@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.

    • @dobrx6199
      @dobrx6199 Місяць тому

      A good amount of the time they aren't

  • @youseiy
    @youseiy Місяць тому

    Use Event dispachers insted, not interfaces

  • @wormjuice7772
    @wormjuice7772 Місяць тому +1

    Its all about use case scenario.

  • @derekk3664
    @derekk3664 Місяць тому

    Maybe create Content warning in ue5

  • @Astaraa
    @Astaraa Місяць тому

    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.

  • @waterlemon9512
    @waterlemon9512 Місяць тому

    Why not use Event Dispatchers???? The player shouldnt care about updating the UI and thats what event dispatchers are for

  • @Madlion
    @Madlion Місяць тому

    UA-cam tutorials are bad, but paid professional courses are good. But youtube tutorials are free so the bad knowledge passes on

  • @MrKosiej
    @MrKosiej Місяць тому

    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.

  • @viktorkram2531
    @viktorkram2531 Місяць тому

    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.

  • @NB-qq8wo
    @NB-qq8wo Місяць тому +9

    Blueprints break many fundamental Software Engineering principles. What a pity, what a mess.

    • @fragileglass9622
      @fragileglass9622 Місяць тому +5

      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. 😂😂

    • @RubaDev
      @RubaDev  Місяць тому +4

      I agree blueprints can get really messy and I prefer C++ over blueprints for gameplay logic and mechanics!

    • @RubaDev
      @RubaDev  Місяць тому +5

      @@fragileglass9622 Hahaha blueprints are trully a mess once project gets a bit larger..

    • @yahootube90
      @yahootube90 Місяць тому +1

      Yesss... I find blueprints so messy and confusing compared to regular code.

    • @user-qo4zm6qr9i
      @user-qo4zm6qr9i Місяць тому +1

      ​@@RubaDev So please tell me can I use just blueprints for a moderate project ? ❤