So, Smite 2 has launched an open beta, and I’ve been looking at how its life bar works.
Every 100 health it creates some marks that take up half the height and are aligned above and, every 1000 health it creates another mark but with full height and thicker than the 100 and they are completely dynamic, that is, it doesn’t matter how much the MaxLife value is, Smite and Unreal Engine 5 show them all in a uniform and clear way. For example in League of Legends when the maximum life exceeds a value x the bars start to be less, but in Smite 2 curiously it renders them perfectly and with perfect uniformity.
And I have tried to replicate this system with blueprints and through a material, but I can’t get it to work as it should. As you can see in the screenshots (Smite2), you can see how the bar dynamically adjusts to the character’s maximum health with low and high values.
Can someone help me or give me some steps to follow to get it working, either with blueprints, materials or in the best possible way?
Hey there @VG_ByVold! Welcome to the community! This thread should be able to get you the basic setup for the healthbar material, however you may need to do some extra math to set the UTiling based on how much health the character has accurately:
@SupportiveEntity I’ve seen this thread before, but either I didn’t understand it or it wasn’t what I was looking for.
However, it seems that @L1z4rD89 has done it exactly as I’m looking for, so I’ll take a look at it as soon as I have time.
Anyway, many thanks to both of you.
Thank you very much for your example @L1z4rD89 but I have some doubts about this.
In the video, the first clip I have changed the width of the health bar (of my character) and I have left the normal size in orange, but my health bar, misaligns some marks and makes them disappear, can this be corrected or does it need a specific fixed size?
Then in the second clip, with the 2 healthbars with the default size, but without maximizing the preview window of unreal engine and it also starts to deform, does this need a fixed resolution x?
Can these 2 things be solved?
Then also, I want to try to put the life calculations inside the material using scalar parameter, is it possible to do that, or should I not even try to do it?
you should try to find the perfect size of the health bar for you and then you can adjust the STEPs inside the material, they adjust the line thickness. They vanish if they are too thin.
I’d calculate everything outside the material and modify the material parameters afterwards. The way you mentioned would be unnecessary difficult when it comes to complex calculations. But you could create an extra component or extra class for all health depending calculations.
Yes, of course, what I’m looking for is just the calculation of the marks above the life bar, that’s why I thought I could, in a simple way, calculate the marks inside the material independently of the logic outside the material.
In any case, I’ll try with the base that you’ve given me to be able to work.
And with this material would it be possible to add a shield (with a different color) on the same life bar?
And I’m sorry for all the questions but I’m very new to Unreal materials, would it be possible to separate the life bar from the marks? That is, the material would be an image on top of a progress bar.
I mean that the bar can be adapted to something like an overshield, that is, a variable for MaxHealth and another for the shield value, as in the photo.
The blue is the life and the white would be the shield, added independently of the player’s current and maximum life. I don’t know if I explained myself correctly.
According to what I’m watching in the example video I posted at the beginning of the thread, it explains that there are 2 progress bars (I suppose inside a horizontal box) [Although now that I think about it, if there are 2 progress bars, even if it has half its life, the progress bar still takes up x space and doesn’t fit its current life, I don’t know, I’m in a big mess] and that the life marks are calculated based on the maximum life + the shield (if the current life + shield is greater than the maximum life, otherwise it takes up the space within the maximum life)
Why isn’t it possible to make the material only make the marks (using an image) and not calculate the progress bar within the material, because I think that’s what doesn’t allow it that modularity, that it’s calculating everything within the material and not just more marks.
I’m going to keep trying on my own and I’ll let you know.