How to build a Health bar for multiplayer in Unreal Engine 5 the right way - Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น •

  • @robertwilson1589
    @robertwilson1589 10 หลายเดือนก่อน +5

    This here is EXACTLY what i was looking for. A dispatcher and replicated progress bar for multiplayer. You, sir, are amazing.

  • @EinarEdberg
    @EinarEdberg หลายเดือนก่อน +1

    Thank you, would love to see more multiplayer videos from you.

    • @LeafBranchGames
      @LeafBranchGames  หลายเดือนก่อน

      Thanks for the feedback, I will keep it in mind.

  • @x4loviGaming
    @x4loviGaming ปีที่แล้ว +6

    Finally something about multiplayer now i can know what is the difference between single game and multiplayer
    Edit : after watching i think i build my project the wrong way since i want it to be fully multiplayer sadly very very few YT's teach how to code for Multiplayer

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว +2

      The best resource available to understanding multiplayer and how it works for Unreal is this PDF: cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
      I also already have some tutorials on multiplayer replication on the channel.
      Game development is a complex subject in itself, multiplayer on top of it makes it more difficult. But getting some basics of the flow can go a long way.

  • @jiggyspice6809
    @jiggyspice6809 ปีที่แล้ว +1

    What a great tutorial. I've been following so many half assed outdated unreal 4 videos and it was an absoluten nightmare trying to make it work for multiplayer with their methods. Finally someone giving clear and solid gameready sollutions. Please keep making multiplayer related tutorials, there are so very few of them and even less with clear information with someone that has a good microphone and actually good sollutions.

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว +1

      Thank you. Glad to hear you like it. :)

  • @geoffreyfook9735
    @geoffreyfook9735 ปีที่แล้ว +1

    Thanks for the tutorial. I am slowly learning that multiplayer is not easy - for anyone busy developing a multiplayer game, beware of all the RFC stuff out there - it does not handle lag well at all when doing movements. It may look right when testing locally, but if you add some ping your whole game might fall apart.
    Learn how to test with ping - will save you time in the future!

  • @kevinsmith3348
    @kevinsmith3348 ปีที่แล้ว +1

    Thanks so much. Clear and concise tutorial. I tried making my own but kept having issues with the players sharing health. Thanks again!

  • @muerrtee
    @muerrtee ปีที่แล้ว +3

    Thanks, i love anything related to multiplayer 👍

  • @rayloh8259
    @rayloh8259 ปีที่แล้ว +1

    Hi LeafBranch,
    i just want to say thank you for all your Tutorials. I made so many of them and i am still not done ;) Some of them i made twice to impliment it a bit different in my Game. So i can say that i learned most of my unreal engine skills from you. So thank you for that and continue your good work :D
    Best Regards Ray

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      I appreciate you telling me that, thank you for your support Ray. :)

  • @EnricoPietrocola
    @EnricoPietrocola ปีที่แล้ว +1

    Great tutorial, aside from multilayer stuff I like a lot your use of event dispatcher and how tidy your code is, congrats

  • @KasimMeta
    @KasimMeta 6 หลายเดือนก่อน +1

    thanks dod , the only right person explained that

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน

      :)

    • @KasimMeta
      @KasimMeta 6 หลายเดือนก่อน

      @@LeafBranchGames can you make replication system for press "shift key"
      to increase or decrease max walk speed of player please ? , all method on YT is say make two Event , one as server and second as client and run first on server and second on owning client but all of these methods is not working ,

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน

      @@KasimMeta If you want to learn about multiplayer, I would recommend Bry from my "great unreal engine channels" playlist.

    • @KasimMeta
      @KasimMeta 6 หลายเดือนก่อน

      @@LeafBranchGames can u send link please ?🤍 of that

    • @LeafBranchGames
      @LeafBranchGames  6 หลายเดือนก่อน

      @@KasimMeta www.youtube.com/@LeafBranchGames/playlists

  • @plank2490
    @plank2490 หลายเดือนก่อน

    Thanks for the toturial!
    I was wondering, why are you setting up the widgit in the player pawn and not in the player controller?

    • @LeafBranchGames
      @LeafBranchGames  หลายเดือนก่อน

      There is no reason, other than slightly lowering the amount of blueprints to go through, making it a little simpler.

  • @AG-AYUSH-7
    @AG-AYUSH-7 5 หลายเดือนก่อน +1

    Thanks dude

  • @pedinky293
    @pedinky293 ปีที่แล้ว +1

    i have a issue were the client works perfect but the widget server side wont update, the stings are there and accurate but widget wont change

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      Make sure you have done everything according to the tutorial. Especially the parts where we create, show and update the widget information.

  • @blacies2166
    @blacies2166 10 วันที่ผ่านมา

    Hello sir. Thanks for the tutorial. I just had a little problem,which is,even if the health is 0,when I press 1 it keeps going minus. How can I keep it between 0-100?

    • @LeafBranchGames
      @LeafBranchGames  10 วันที่ผ่านมา

      Clamp the health between your wanted values.

    • @blacies2166
      @blacies2166 10 วันที่ผ่านมา

      @LeafBranchGames thanks for your answer. Where should I pin the output?

    • @LeafBranchGames
      @LeafBranchGames  10 วันที่ผ่านมา

      @@blacies2166 Before storing your variable.

  • @Ed_Kass
    @Ed_Kass ปีที่แล้ว +1

    This way of implementing Health removes the need for using GAS to do it for multiplayer? I mean... The main reason I was using GAS is to have replicated Health and Mana for multiplayer... Using this health and doing the same for mana and such can "extend" the original way of your RPG tutorial for multiplayer?

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว +1

      You are not forced to use GAS to get multiplayer replication to work. The benefit of using GAS is that you have a robust system with a lot of features out of the box. The down side is that it might be a bit complex. But you can for sure do all of it yourself if you want to, like done here in the tutorial. Yes, this can be done for the RP tutorial series as well if you want to.

  • @sohansuvarna1369
    @sohansuvarna1369 8 หลายเดือนก่อน

    @leafybranchgames
    Thanks a lot for this amazing tutorial.
    I have also followed your card game tutorial.
    I need to know one thing can widget component/widget ref be replicated.

    • @LeafBranchGames
      @LeafBranchGames  8 หลายเดือนก่อน

      You can replicate anything that is not on the local client. A UI element tends to only be relevant on a specific client.

  • @matheusvidal3537
    @matheusvidal3537 ปีที่แล้ว

    I need to know one thing about that tutorial logic.. why u're casting the TP Character on the HP widgets for multiplayer? because, if we're creating other characters to the game, we will have a lot of others characters BP, right? but that logic will only applies to one character. What is the correct way to do that, so?

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      Characters with common logic can reduce code duplication through the use of inheritance. So the common class that has the health logic would be the same for all of them.

    • @matheusvidal3537
      @matheusvidal3537 ปีที่แล้ว

      @@LeafBranchGames Great! I could understand what u said, but I don't know about how this works... I'll have to do something for this inheritance?
      srry about anything, I'm not native speaker, so... haha

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      @@matheusvidal3537 Inheritance is a concept within object oriented programming as a way to reuse code for classes that share commonality.

    • @matheusvidal3537
      @matheusvidal3537 ปีที่แล้ว

      ​@@LeafBranchGamesLet's see if I did understood... In essence, I need to finalize this main BP_Character, which serves as the foundational blueprint for all others. By creating my actual character as a child of this blueprint, the HealthBar functionality should operate seamlessly, correct? This approach ensures that the HealthBar will continue to function for my subsequent characters, correct?
      I appreciate the clarification.
      Moving forward, I understand that for this I should develop all my new characters BP by right-clicking on this main BP already made and clicking on "Create Bind Blueprint Class", is that right?
      Thank you for your assistance. You have one of the best channel to learn gamedev

  • @jefftehboy2840
    @jefftehboy2840 6 หลายเดือนก่อน

    Hi,
    Thanks for the tutorial it was really useful im just wondering if you would have any idea why my progressbar resets to default value and doesn't change after i destroy current character respawn new and possess. everything works fine on first life for both server and client but breaks on both on respawn
    a reply would be amazing
    many thanks

  • @calcalcalcalcalcal
    @calcalcalcalcalcal 10 หลายเดือนก่อน

    It says "Server Damage (Target is BP_Player Controller Replicated to server(If owning client))" how do i make it doesn't have the "replicated to server if owning client" like how it is in the video?

    • @LeafBranchGames
      @LeafBranchGames  10 หลายเดือนก่อน

      If you follow the tutorial closely, you should not run into such an issue.

  • @dhruvbajaj1054
    @dhruvbajaj1054 ปีที่แล้ว

    I am able to do this but in my game i want the health to be in sync so if player 1 loses health player 2 will also lose health. I am new to networking and Unreal Engine. Any help would be appreciated

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      Not really a multiplayer specific feature. You just want to have one healthbar somewhere and have that affected by damage adn heals and then show the current status. All the other logic is the same.

  • @nikohedegaard
    @nikohedegaard ปีที่แล้ว

    Hey :)
    Great tutorial, been looking for a video on this for a while and i cant seem to get it to work
    everytime i press 1 or 2 my health gets set to 0 even tho the maths should be subtracting dmg with health
    even had this problem on my "Arrow overlapping" logic
    do you have any idea on what could cause this? :)
    watched the vid 3 times just to make sure i didn't miss anything

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      Hello! Unfortunately, the short answer is that you missed something in the tutorial, I would recommend making sure you do every little detail the same as in the video. Or start with singleplayer HP first, and when that works for you - move to making multiplayer.
      It cna be something like default value not set, to a pin not connected, to having an incorrect reference. There are many different mistakes that could result in that effect.

    • @nikohedegaard
      @nikohedegaard ปีที่แล้ว

      @@LeafBranchGames Cheers! :)
      Rofl okay i just found the issue
      so at "event anydamage" when i subtract damage with health i had damage on 1. pin and health on 2. pin
      never thought of that xD
      have a nice day mate :)

  • @Mr.K.Johnson.
    @Mr.K.Johnson. ปีที่แล้ว

    Hello, i do all thing like you in the tutorial but i don´t get the Progressbar work on clientside??? But the values for the health in the printstring for server and client are working correct!? What do i wrong?

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      Sounds like you missed something with the create UI on client event possibly. Make sure to do everything like in the tutorial.

  • @Hipnas
    @Hipnas 10 หลายเดือนก่อน

    Thanks Leaf for a great tutorial, I ran into a little situation here. When I want to Set Percent, for my Progress bar but since I use Radial Slider the Set Percent node is only for progress bar's and it doesn't let me connect my radial slider variable to it. Is there a different node which I could use or a work around?

    • @LeafBranchGames
      @LeafBranchGames  10 หลายเดือนก่อน

      When you have the progress widget in the editor, you can see all the properties it has and you can toy around with them to see what they affect. In the case of a progress bar, it is called percent. So you can bring your other widget in, play around with its properties and you will see which property controls it in the manner you want it to change.

  • @dicesuki4286
    @dicesuki4286 2 หลายเดือนก่อน

    But isn't casting not effecient for your game especially when you use it on your health bar. Wouldn't be better to use other methods instead, and save casting to bigger things?

    • @LeafBranchGames
      @LeafBranchGames  2 หลายเดือนก่อน

      Not sure what you mean with saving casting for bigger things. In general, casting gets worse for larger object, due to hard reference dependency chains.
      For this topic, this video might be helpful for you: th-cam.com/video/aUG54KCP89M/w-d-xo.html

  • @tastyvegan1
    @tastyvegan1 ปีที่แล้ว

    My healthbar doesnt react when i press key 1 or 2, but i do get the print string, what have i done wrong at this point?

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      It is one of two things typically. Either the value is not being changed or the UI is not properly reacting to the value.

  • @梦羽星辰_821
    @梦羽星辰_821 10 หลายเดือนก่อน

    after I clicking 1 and 2 the string is showing me the health can increase or decrease, but the problem is mine health progress bar it wont update aftter i click 1 and 2

    • @LeafBranchGames
      @LeafBranchGames  10 หลายเดือนก่อน

      That means you have missed some part in the tutorial related to the UI updating. The fastest way to fix it would likely be to redo the tutorial since it is so short. But if you want a learning experience for why the error is happening, I would suggest debugging the issue.

    • @梦羽星辰_821
      @梦羽星辰_821 10 หลายเดือนก่อน

      @@LeafBranchGames the Ui part all in the possess event right?
      i will check it again

  • @tazz1226
    @tazz1226 ปีที่แล้ว

    hey leaf, i think its not a good idea to cast to your character from the widget blueprint, as some characters can be really expensive to have in memory, and casting will create a hard reference, so if you could do a small video on the repnotify alone of the health bar, that would be great!

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      You are very unlikely to have a user interface without your main playable character available and loaded in memory.

  • @FuNKYSPuNKYmusician
    @FuNKYSPuNKYmusician ปีที่แล้ว

    I got this working before but now it only works on client and the server's client doesn't work. any ideas?

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      I would look at the events executing on server and replicating to clients. Likely one of them is incorrectly setup.

  • @matheusvidal3537
    @matheusvidal3537 ปีที่แล้ว

    How add ALL players health to the hud? like, If player 0 exist, show his HP bar, If player 1 exist too, show as well..
    ... I'll search here How to make a team x team system with char select, everything in multiplayer. That's the thing I need at the moment

    • @LeafBranchGames
      @LeafBranchGames  ปีที่แล้ว

      It is exactly the same theory as in the tutorial. The difference is that your UI belongs to your controller and your pawn. That is not true for others. So you would need a reference to either all those objects/characters/actors you want to track, or just have your UI get fed that information whenever they change by a central class that keeps track of that.

    • @matheusvidal3537
      @matheusvidal3537 ปีที่แล้ว

      @@LeafBranchGames Thanks bro, love u. If one day u do a tutorial about it, I'll be happy 😁