[Mod] HUD bars [2.3.2] [hudbars]

Post Reply
User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

[Mod] HUD bars [2.3.2] [hudbars]

by Wuzzy » Post

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
Version: 2.3.2 (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: http://repo.or.cz/w/minetest_hudbars.git
Download: Version 2.3.2
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: List of mods using this mod: This mod is incompatible with:
Attachments
screenshot_2085609335.png
(17.19 KiB) Downloaded 1 time
screenshot_1449813209.png
(18.67 KiB) Downloaded 1 time
Last edited by Wuzzy on Sat Jul 18, 2020 18:56, edited 55 times in total.

User avatar
srifqi
Member
Posts: 557
Joined: Sat Jun 28, 2014 04:31
GitHub: srifqi
IRC: srifqi
In-game: srifqi
Location: Indonesia

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

by srifqi » Post

Looks nice!

/me is waiting for Mana mod!
Saya dari Indonesia! · Terjemahkan Minetest! · my mods · My nickname in IPA: /es.rif.qi/

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

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

by Minetestforfun » Post

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)

User avatar
rubenwardy
Moderator
Posts: 6298
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

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

by rubenwardy » Post

Raw numbers makes sense when you don't show hearts or fractional hearts. Ie 19/20

User avatar
ExeterDad
Member
Posts: 1717
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad
Location: New Hampshire U.S.A

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

by ExeterDad » Post

Looks really slick. Well done

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 0.2.0 released

by Wuzzy » Post

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.

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 0.3.0 released

by Wuzzy » Post

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?

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 0.4.0 released

by Wuzzy » Post

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.

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 1.0.0 released!

by Wuzzy » Post

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.

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Bugfix release: 1.0.1

by Wuzzy » Post

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.

User avatar
SpaghettiToastBook
Member
Posts: 52
Joined: Sun Feb 22, 2015 21:11
In-game: STB
Location: The Milky Way

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

by SpaghettiToastBook » Post

If you connect to a server with this mod more than once, the hotbar, crosshairs, and hand don't appear anymore.

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Bugfix release: 1.0.2

by Wuzzy » Post

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

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Post

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

User avatar
Minetestforfun
Member
Posts: 940
Joined: Tue Aug 05, 2014 14:09
GitHub: MinetestForFun
IRC: MinetestForFun
In-game: MinetestForFun
Location: On earth
Contact:

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

by Minetestforfun » Post

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 ?

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Post

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.

User avatar
cHyper
Member
Posts: 908
Joined: Fri May 06, 2011 08:49
GitHub: cHyper-0815OL
IRC: cHyper cHyper_de
In-game: cHyper cHyper_0815
Location: Austria
Contact:

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

by cHyper » Post

+1 awesome mod...

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

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

by mahmutelmas06 » Post

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
My Mods:

Beverage

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Post

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.

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 1.0.3 released.

by Wuzzy » Post

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.

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

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

by mahmutelmas06 » Post

suggestion moved to
viewtopic.php?f=9&t=11336
Last edited by mahmutelmas06 on Wed Mar 04, 2015 19:36, edited 1 time in total.
My Mods:

Beverage

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

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

by Wuzzy » Post

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.

User avatar
bdjnk
Member
Posts: 104
Joined: Wed Mar 20, 2013 21:03
GitHub: bdjnk
Location: New York
Contact:

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

by bdjnk » Post

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

User avatar
pilcrow
Member
Posts: 25
Joined: Thu Sep 12, 2013 09:10

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

by pilcrow » Post

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

User avatar
Wuzzy
Member
Posts: 4089
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Release 1.1.0

by Wuzzy » Post

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.

User avatar
pilcrow
Member
Posts: 25
Joined: Thu Sep 12, 2013 09:10

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

by pilcrow » Post

Awesome, thanks! I am definitely gonna use this mod. It makes things look so much nicer! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests