Unreal Engine tutorials dont teach you about this...

Поделиться
HTML-код
  • Опубликовано: 15 ноя 2024

Комментарии • 97

  • @3sgamestudio
    @3sgamestudio 7 месяцев назад +42

    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  7 месяцев назад +7

      Thank you for clearing that one out. Pinned!

  • @MKJwhoa
    @MKJwhoa 7 месяцев назад +2

    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

  • @b.delacroix7592
    @b.delacroix7592 6 месяцев назад +1

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

  • @driftmirror
    @driftmirror 7 месяцев назад +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  7 месяцев назад

      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 7 месяцев назад +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).

  • @alternativehats3926
    @alternativehats3926 7 месяцев назад +4

    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!

  • @tofast4ya
    @tofast4ya 7 месяцев назад +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  7 месяцев назад +1

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

    • @dreamingacacia
      @dreamingacacia 7 месяцев назад +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 7 месяцев назад +1

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

  • @JustATanneriteDummy
    @JustATanneriteDummy 7 месяцев назад +1

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

  • @Fizziepop
    @Fizziepop 7 месяцев назад +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.

  • @shibii
    @shibii 7 месяцев назад +3

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

    • @RubaDev
      @RubaDev  7 месяцев назад +1

      Thank you very much comments like those keep me going !

  • @MaviLeb
    @MaviLeb 7 месяцев назад +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.

  • @gambello1195
    @gambello1195 7 месяцев назад

    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.

  • @Mr.Jeremia
    @Mr.Jeremia 7 месяцев назад +3

    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  7 месяцев назад +2

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

  • @ricardo22448
    @ricardo22448 7 месяцев назад +5

    Thx❤ i dislike casting. This is a nice solution

    • @RubaDev
      @RubaDev  7 месяцев назад +1

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

  • @jb2760
    @jb2760 7 месяцев назад +4

    Best explanation of interfaces by far. Great job man.

    • @RubaDev
      @RubaDev  7 месяцев назад

      Thank you very much, glad I could help!

  • @sadravin1
    @sadravin1 7 месяцев назад

    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 7 месяцев назад +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

  • @GaryParkin
    @GaryParkin 3 месяца назад

    Thank you for the video. I've been a software engineer for the last 30 years but UE5 is new. That said, a lot of people say use Event Dispatchers, but when I tried I still had to have a reference to the thing that is dispatching so an Interface is what I used. I've watched a few tuts on Event Dispatchers and I still need a reference. If I'm making a character that is spawned in after the game start then I'd have to use a cast to get the thing that is sending the message in order to subscribe. Maybe I have it all wrong?

  • @Obumbro
    @Obumbro 7 месяцев назад

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

  • @boomwowsion64
    @boomwowsion64 7 месяцев назад

    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.

  • @Flowerpot2905
    @Flowerpot2905 7 месяцев назад +1

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

    • @RubaDev
      @RubaDev  7 месяцев назад

      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!

  • @revan9903
    @revan9903 7 месяцев назад

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

  • @moo_goo
    @moo_goo 3 месяца назад

    I just started as a beginner but ive been watching a few videos myself and have seen a lot of different approaches.
    How does this compare to dispatchers? My impression was by casting anything, you create a memory footprint dependency between those two actors and that can scale if it is not managed.
    is this more performant or more reliable at the cost of that memory footprint?

  • @betraid
    @betraid 7 месяцев назад

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

  • @studiothink81
    @studiothink81 7 месяцев назад +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  7 месяцев назад

      Thank you very much friend!

  • @Multiblitzyy
    @Multiblitzyy 7 месяцев назад

    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?

  • @ryanjdevlin87
    @ryanjdevlin87 7 месяцев назад +11

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

    • @RubaDev
      @RubaDev  7 месяцев назад +2

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

  • @gosti_fr6106
    @gosti_fr6106 7 месяцев назад +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  7 месяцев назад +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 7 месяцев назад

      @@RubaDev Thank you :) Good vibes

  • @TorQueMoD
    @TorQueMoD 7 месяцев назад

    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.

  • @1_Man_Media
    @1_Man_Media 7 месяцев назад +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  7 месяцев назад

      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!

  • @fragileglass9622
    @fragileglass9622 7 месяцев назад +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  7 месяцев назад

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

    • @fragileglass9622
      @fragileglass9622 7 месяцев назад

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

  • @azoth._.
    @azoth._. 7 месяцев назад

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

  • @wowwowwoah
    @wowwowwoah 7 месяцев назад

    thanks bud
    it was in time

  • @xjuliussx
    @xjuliussx 7 месяцев назад +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 7 месяцев назад +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  7 месяцев назад +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  7 месяцев назад

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

    • @xjuliussx
      @xjuliussx 7 месяцев назад

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

    • @D4KiRZ
      @D4KiRZ 7 месяцев назад

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

  • @Astaraa
    @Astaraa 7 месяцев назад

    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.

  • @6Planet
    @6Planet 7 месяцев назад

    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.

  • @JulioDevUnreal
    @JulioDevUnreal 7 месяцев назад

    thank you!

  • @Luke-cecilpod
    @Luke-cecilpod 7 месяцев назад +1

    Thanks for honest help. First I’ve found.

    • @RubaDev
      @RubaDev  7 месяцев назад

      No problem! I am happy to help!

  • @derekk3664
    @derekk3664 7 месяцев назад

    Maybe create Content warning in ue5

  • @youseiy
    @youseiy 7 месяцев назад

    Use Event dispachers insted, not interfaces

  • @MikeyBison
    @MikeyBison 7 месяцев назад

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

  • @connorjade5460
    @connorjade5460 7 месяцев назад +1

    U DESERVE 1Million subs

    • @RubaDev
      @RubaDev  7 месяцев назад +1

      Fingers crossed! Thank you very much!

  • @dreamingacacia
    @dreamingacacia 7 месяцев назад

    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.

  • @wormjuice7772
    @wormjuice7772 7 месяцев назад +1

    Its all about use case scenario.

    • @RubaDev
      @RubaDev  7 месяцев назад +1

      Exactly!

  • @waterlemon9512
    @waterlemon9512 6 месяцев назад

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

  • @JonSkov-DK
    @JonSkov-DK 7 месяцев назад +1

    This video made me subscribe

    • @RubaDev
      @RubaDev  7 месяцев назад +1

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

  • @LonelyCornerCrew
    @LonelyCornerCrew 7 месяцев назад

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

  • @korypeters2059
    @korypeters2059 7 месяцев назад +1

    💯 ty

    • @RubaDev
      @RubaDev  7 месяцев назад

      No problem!

  • @MrKosiej
    @MrKosiej 7 месяцев назад

    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.

  • @lancelmarchettil
    @lancelmarchettil 7 месяцев назад

    Brilliant!

  • @craigmakarowski6060
    @craigmakarowski6060 7 месяцев назад

    Excellent

  • @eligijuspranskunas3509
    @eligijuspranskunas3509 7 месяцев назад

    nice!

  • @omegablast2002
    @omegablast2002 7 месяцев назад +3

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

    • @RubaDev
      @RubaDev  7 месяцев назад +1

      🤔 I actually rarely see them in tutorials.

    • @d00gl3
      @d00gl3 7 месяцев назад

      ​@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 7 месяцев назад

      A good amount of the time they aren't

  • @NicolaiCzempin
    @NicolaiCzempin 5 месяцев назад

    I know this wasn't the point of the video, but:
    Using floating-point numbers for currency is a really bad idea.

  • @Madlion
    @Madlion 7 месяцев назад

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

  • @viktorkram2531
    @viktorkram2531 7 месяцев назад

    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 7 месяцев назад +9

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

    • @fragileglass9622
      @fragileglass9622 7 месяцев назад +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  7 месяцев назад +4

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

    • @RubaDev
      @RubaDev  7 месяцев назад +5

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

    • @yahootube90
      @yahootube90 7 месяцев назад +1

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

    • @Marmar-b5p
      @Marmar-b5p 7 месяцев назад +1

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