Page 1 of 10

[Mod] HUD Bars [2.3.5] [hudbars]

Posted: Thu Feb 05, 2015 15:07
by Wuzzy
This mod replaces the builtin health and breath indicators by nice little “progress bars” which show an icon, a label and a numerical value plus maximum.
Plus, the mod is extensible with a quite powerful API.

Breath and health bar:
Image

Example with some extra HUD bars added via the API:
Image

(Customized hotbar not included!)

Both bars behave similar to the builtin ones, so the breath bar will be hidden automatically if you have full breath. This auto-hide feature can be disabled (use the advanced settings menu).

Classic statbars and “Better HUD”-style statbars are supported, too:
Image
Spoiler
For modders: The mod can also be extended by custom HUD bars. You can customize the label, font color, bar color. All bars have to show a current value and a maximum value and both must be at least 0.
Currently, custom HUD bars will be automatically placed by the mod.
So, with this mod you could easily add custom player attributes and whatnot to the HUD without much trouble.

It is a fork of the “Better HUD” [hud] mod by BlockMen, but with all the stuff which I consider clutter removed, so no hunger, armor support, or modifications of other HUD elements. Just the bars. This should make it easier to integrate this mod with other mods without much hassle.

I consider this mod finished and usable now and its API stable. But backwards-compatible feature requests and bug reports are still welcome, possibly even if this thread has become old.
Version: 2.3.5 (This mod uses semantic versioning, as of 2.0.0 of the standard)
Works with: Minetest 5.3.0 or later.
Project page with Git repository: https://codeberg.org/Wuzzy/minetest_hudbars
Download: Version 2.3.5
Translations: German, Portuguese, Turkish, Dutch, Italian, Malay.

Dependencies: None!

License for code: MIT License
License for images: Contains some CC BY-SA 3.0 images (see README), rest is MIT License.

List of games using this mod (examples): List of mods using this mod (examples): This mod is incompatible with:

Re: [Mod] HUD bars [0.1.0] [hudbars]

Posted: Thu Feb 05, 2015 15:30
by srifqi
Looks nice!

/me is waiting for Mana mod!

Re: [Mod] HUD bars [0.1.0] [hudbars]

Posted: Thu Feb 05, 2015 16:29
by Minetestforfun
great work again, your work is awesome !

Is it possible to tweak this mod because i want to have only the "progressive mana bar" and other bars with hearth/bread/bubles/etc... ? (for tests)

Re: [Mod] HUD bars [0.1.0] [hudbars]

Posted: Thu Feb 05, 2015 16:33
by rubenwardy
Raw numbers makes sense when you don't show hearts or fractional hearts. Ie 19/20

Re: [Mod] HUD bars [0.1.0] [hudbars]

Posted: Thu Feb 05, 2015 18:05
by ExeterDad
Looks really slick. Well done

Version 0.2.0 released

Posted: Sun Feb 08, 2015 03:18
by Wuzzy
Hi! I released version 0.2.0 today.

Not much changed, but I added the API documentation, you can find it in API.md.
The codebase did not really change.

But the API will certainly be still subject to change, there are some real oddities in it. But feel free to look already now into it and give your comments.

There are also some other minor tweaks which are not worth mentioning, lol.

Version 0.3.0 released

Posted: Tue Feb 10, 2015 01:47
by Wuzzy
I release version 0.3.0 today. I cleaned up the API, so it makes more sense and I got rid of some oddities it had.

Changelog:
  • Rename main table from “hud” to “hb” (affects function names!)
  • Arguments 3-4 in hb.change_hudbar can be nil for values which should not change
  • Add proper function hb.init_hudbar, replaces odd call to hud.hudtables[identifier].add_all
  • Update API documentation and fix mistakes
  • Use “hudbars.conf” instead of “hud.conf” (configuration file)
One major thing I want to add to this are sane configuration variables. Currently, they are a bit chaotic. Lastly, I want to do a bit of refactoring before 1.0.0. Then final testing, and I could release 1.0.0.

I also want to you inform of a problem with this mod: Currently, it is unable to cope with different GUI scales. Do enough people care about such stuff? And is it really my duty to fix it or should I just wait for the engine to become better in this regard?

Version 0.4.0 released

Posted: Thu Feb 12, 2015 05:25
by Wuzzy
I release 0.4.0 today. I have again worked hard on the API to make extension as painless as possible.
  • New function: hb.get_hudbar_state to get information about the state of an active HUD bar, such as values, whether it is hidden, etc.
  • hb.change_hudbar has been optimized to call hud_change fewer times, which is hopefully good for networking
  • Rename hb.register_hudbar parameter “start_hide” to “start_hidden”
  • start_hidden parameter now finally works
  • Do not affect other HUD flags (crosshair, wielditem, etc.) when starting mod
  • Show error message when trying to call hb.init_hudbar or hb.change_hudbar with bad values
  • Update documentation
  • Lots of refactoring
  • Health and breath bar now use API, this makes the code much much cleaner
Download in first post.
I also finally uploaded the Git repository, here is the project page:
http://repo.or.cz/w/minetest_hudbars.git


There is probably not much left to do for the 1.0.0. If you want to have certain API functions added, please tell me now before I release 1.0.0. I am now pretty happy with the API as of now.
I will probably only make just some final testing, add some smaller features, then, if nothing serious pops up, I will release 1.0.0.


Also, any testing of this mod, especially the API, will be greatly appreciated! If you don't understand something, ask here right away, I will try to help. :-)

Edit: I uploaded a new screenshot on the first post to show what is possible with the API.

Version 1.0.0 released!

Posted: Thu Feb 12, 2015 21:17
by Wuzzy
Finally!
Version 1.0.0 is there.

The changelog is rather small this time:
  • Add new parameter start_hidden to hb.init_hudbar, specified whether HUD bar is hidden on start
  • Copy-editing of API.md and README.txt
  • Internal: Fix add_all weirdness
The download is as always in the attachment of the first post.

From version 1.0.0, I try to ensure backwards-compability as long as possible and only break it when it I think it is really neccessary. Hopefully never. I consider the API to be fairly stable and usable now. When backwards compatibility is broken, the major version number will be increased, since this is a SemVer.

But it is still not too late to make feature requests or report bugs, but from now on, requests for features which are backwards-compatible are highly preferred over requests for features which are not backwards-compatible.

Bugfix release: 1.0.1

Posted: Sat Feb 21, 2015 16:27
by Wuzzy
Version 1.0.1 is here to fix a nasty race condition bug which caused the server to crash on some systems.

Download is in the first post, as always.

Re: [Mod] HUD bars [1.0.1] [hudbars]

Posted: Sun Feb 22, 2015 21:18
by SpaghettiToastBook
If you connect to a server with this mod more than once, the hotbar, crosshairs, and hand don't appear anymore.

Bugfix release: 1.0.2

Posted: Mon Feb 23, 2015 00:44
by Wuzzy
Version 1.0.2 is here to fix 2 embarrisingly stupid bugs:
  • Fix HUD elements like crosshair, hotbar and wielded item disappearing for rejoining players (Bug reported by SpaghettiToastBook, thanks for reporting!)
  • Remove pointless delays for initializing the HUD for new or rejoining players. The HUD should be now correctly displayed immediately after joining

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Fri Feb 27, 2015 07:53
by Wuzzy
Is it possible to tweak this mod because i want to have only the "progressive mana bar" and other bars with hearth/bread/bubles/etc... ? (for tests)
Sorry, I have missed this question, I shall answer it now:

Well, it is always possible to tweak if you mean with “tweak” to actually edit source code.
But it is not done by changing a single varible.

Currently, this mod forces the health and breath to be shown as HUD bars, this is hardcoded.
Everything else (like the mana bar) is provided by seperate mods.

Maybe I can edit this mod in such a way that it allows for different “bar styles”, for example, the classical icon-based statbars.
But I am just not motivated for that.

Personally, I do not think it is a good idea from an usability standpoint if you mix the classical icon-based statbars with the progress-bar-like bars.
Also, I think the icon-based approach is flawed in many aspects:
  • Icon bars fail badly if you need large values, they can only give you a very coarse estimate
  • For example, the hunger bar from the Better HUD mod is ambigious when it shows 10 breads: It means your saturation is between 20 and 30. The last 5 breads are hidden so that all icon bars show never more than 10 symbols. IMO this is just stupid, I did not even know about this until I started to create [hbhunger]
  • Icon bars also fail badly when numerical values are important, obviously
Especially when Minetest will allow to manually set the max health and breath of players, the standard icon-based approach will become really limiting (Would you now display 50 heart symbols for 100 HP?), but this mod will be perfectly prepared as soon as you can change these maximum values. It would only require a minor change in the source code.

PS, as for hunger, I have recently forked the “Better HUD” mod once again, ripped it apart which resulted in this mod adding the hunger game mechanic from Better HUD, but with using the HUD bars mod:
viewtopic.php?f=9&t=11336

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Tue Mar 03, 2015 10:14
by Minetestforfun
Hi,

Thank you for your answer.

Today, I decided to change all of my status bars to your "progressive" status bars.

My main problem, it's my other mods...

I need your bar on health / stamina / mana / breath / hunger, and maybe, if it's possible, armor...

So, I suposed I need [hudbars] + [hbhunger], and i need to import from [hud] the hunger.lua (tweaked) and the hud.conf (tweaked), i also need to delete [hud]

Any advice ? Did I forget something ?

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Tue Mar 03, 2015 13:57
by Wuzzy
Minetestforfun wrote:Hi,

Thank you for your answer.

Today, I decided to change all of my status bars to your "progressive" status bars.

My main problem, it's my other mods...

I need your bar on health / stamina / mana / breath / hunger, and maybe, if it's possible, armor...

So, I suposed I need [hudbars] + [hbhunger], and i need to import from [hud] the hunger.lua (tweaked) and the hud.conf (tweaked), i also need to delete [hud]

Any advice ? Did I forget something ?
Health, stamina, mana, breath, hunger and armor bars are provided when you enable these mods:
  • [hudbars] (core API + health bar + breath bar)
  • [stamina] (stamina bar)
  • [mana] (mana bar)
  • [hbhunger] (satiation bar)
  • [hbarmor] (armor bar)
But then you must disable:
  • [hud]
Use either [hud] or [hudbars], but not both. Both together would simply just mess up the HUD and other unexpected / untested stuff.

If you use [hudbars] + [hbhunger] + [hbarmor], the original [hud] mod should be already be pretty well emulated (all 3 mods are forks of [hud]). Note that [hbhunger] and [hbarmor] are both a bit experimental.
There is really no point in trying to run both [hud] and [hudbars] at the same time.

So why would you want to import hunger.lua or anything else from [hud]? I don't understand what you are saying here.
[hbhunger] is not compatible with [hud] at all, you shouldn't “import” anything (whatever you meant by that). If you miss a particular feature in [hbhunger], make a feature request in the correct thread.




Also note that I have made a list of mods which use this mod in the first post of this thread.

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Tue Mar 03, 2015 15:30
by u34
+1 awesome mod...

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Tue Mar 03, 2015 18:59
by mahmutelmas06
Thank you for the mod its awesome.

Cant u provide intllib support to translate this mod to our languages ?
viewtopic.php?f=11&t=4929

Re: [Mod] HUD bars [1.0.2] [hudbars]

Posted: Wed Mar 04, 2015 01:37
by Wuzzy
I could provide intllib support, yes.
At the moment, I am a bit lazy for stuff like this. I wait until Minetest has a sane mechanic for translating mods. See here: https://github.com/minetest/minetest/issues/2270

The problem with intllib is that it is server-side and forces the server's language to all clients.

Version 1.0.3 released.

Posted: Wed Mar 04, 2015 03:48
by Wuzzy
Version 1.0.3 is released! This version has been adjusted for Minetest 0.4.12.

This version only changes the default position of the HUD bars, so that the HUD bars don't overlap with the hotbar. It should work out of the box for most subgames (including Minetest (the subgame)), but you can always configure the mod for different values if it is neccessary. See the readme file.

Re: [Mod] HUD bars [1.0.3] [hudbars]

Posted: Wed Mar 04, 2015 17:50
by mahmutelmas06
suggestion moved to
viewtopic.php?f=9&t=11336

Re: [Mod] HUD bars [1.0.3] [hudbars]

Posted: Wed Mar 04, 2015 19:05
by Wuzzy
Nope. This is totally out of scope of this mod.

The scope of this mod is to provide HUD bars for health and breathing, plus an API for mods to build upon. This mod has nothing to do with hunger or eating.
You probably meant the [hbhunger] mod.

Re: [Mod] HUD bars [1.0.3] [hudbars]

Posted: Thu Mar 12, 2015 19:52
by bdjnk
This is great. Really cleans up the HUD and clarifies your condition.

I've got no suggestions nor complaints. I just wanted to state my appreciation. Thanks :)

Re: [Mod] HUD bars [1.0.3] [hudbars]

Posted: Sun Mar 22, 2015 20:15
by pilcrow
I like this mod. I just wish there was a setting to make the breath bar not disappear; I have a thing for symmetry, and would rather just see it all the time...

Release 1.1.0

Posted: Mon Mar 23, 2015 17:49
by Wuzzy
Done. In version 1.1.0, which I just released, you have to add “hudbars_autohide_breath = false” into your minetest.conf to disable the automatic hiding of a full breath bar. By default, the breath bar is automatically hidden.

This setting is server-sided only for now. This may change if Minetest adds a sane way in the Lua API to interact with a player's client-side configuration. I could probably hack my own system in Lua, but I fear the codebase will become much more bloated, and this is undesirable for me for such a small feature.

Re: [Mod] HUD bars [1.1.0] [hudbars]

Posted: Mon Mar 23, 2015 20:12
by pilcrow
Awesome, thanks! I am definitely gonna use this mod. It makes things look so much nicer! :)