Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Better HUD display #52

Open
Git-Forked opened this issue Mar 22, 2021 · 12 comments
Open

Feature Request: Better HUD display #52

Git-Forked opened this issue Mar 22, 2021 · 12 comments
Labels
enhancement New feature or request

Comments

@Git-Forked
Copy link

Git-Forked commented Mar 22, 2021

Instead of showing an XP bar and a separate HUD for Rank and experience, this should all be on the XP bar.

Current XP Bar:

[ XP: % Fulfilled ]

Suggested XP Bar:

Rank:
[ XP: % Fulfilled, Current XP/Next Level XP ]

Rank listed above XP bar.

@BuckarooBanzay BuckarooBanzay added the enhancement New feature or request label Mar 23, 2021
@OgelGames
Copy link
Contributor

Would be added by #47, but there's not much going on with that PR...

@BuckarooBanzay
Copy link
Member

Would be added by #47, but there's not much going on with that PR...

That PR is just a "dump-all-my-changes" thing, i asked him what he changed for your-land... so..

@SwissalpS
Copy link
Contributor

I'm trying to understand what you want and made a little mock-up.

Current:
xpbar_now

And is this what you want it to look like (approx)?
xpbar_next

@Git-Forked
Copy link
Author

It's looking much better. Perhaps the icon can go to the left of the Rank name, so it takes up less room on the screen.

[icon] Cobble Peasant
XP bar

Also I'd love to see an option to remove the icons showing over heads. (I can make this a second feature request if need be.)

Thank you for your contributions in improving this mod.

@BuckarooBanzay
Copy link
Member

BuckarooBanzay commented Apr 6, 2021

Also I'd love to see an option to remove the icons showing over heads. (I can make this a second feature request if need be.)

This should already be possible:

disable_hover_entity = minetest.settings:get_bool("xp.disable_hover_entity"),

just set xp.disable_hover_entity to true

@Git-Forked
Copy link
Author

I'm trying to understand what you want and made a little mock-up.

Current:
xpbar_now

And is this what you want it to look like (approx)?
xpbar_next

When will this be merged? I'm excited to try it out.

@BuckarooBanzay
Copy link
Member

When will this be merged? I'm excited to try it out.

@Git-Forked i think this is "just" a mock-up:

I'm trying to understand what you want and made a little mock-up.

if you want to try to change/implement this, feel free, that's why we are having PR's 😉

@SwissalpS
Copy link
Contributor

It's looking much better. Perhaps the icon can go to the left of the Rank name, so it takes up less room on the screen.

[icon] Cobble Peasant XP bar

Also I'd love to see an option to remove the icons showing over heads. (I can make this a second feature request if need be.)

Thank you for your contributions in improving this mod.

Positioning icon next to text is difficult to achieve so that it looks good on various screen sizes.
Overlaying text on progress bar is easier, though, especially on small screens, the problem of legibility turns up.

The good thing about git repos, is that we can roll back easily if players don't like what we did.

@SwissalpS
Copy link
Contributor

SwissalpS commented Dec 8, 2021

xpHUD2021-12-08 12 19 30

This is the closest I got by changing code. Adapting the background to the length of the text is not a straightforward feat.
So I suggest removing the background altogether.

@SwissalpS
Copy link
Contributor

a couple screenshots without progessbar background:
xpHud2021-12-08 12 28 44
xpHUD2021-12-08 12 32 07
XPhud2021-12-08 12 28 12

Without the background, player has no visual idea when the bar is actually full. Since the text is over the progressbar, players will probably expect the bar to go to the end of the text :/

@SwissalpS
Copy link
Contributor

Here is what I changed in hud.lua to achieve this. In case somebody wants to pick up and improve on it.
I don't think it's worth it so I'm dropping work on it.

@@ -23,16 +23,6 @@ local setup_hud = function(player)
 
 	player:get_meta():set_string(xp_redo.HUD_DISPLAY_STATE_NAME, "on")
 
-	data.info = player:hud_add({
-		hud_elem_type = "text",
-		position = HUD_POSITION,
-		offset = {x = 0,   y = 0},
-		text = "",
-		alignment = HUD_ALIGNMENT,
-		scale = {x = 100, y = 100},
-		number = 0x0000FF
-	})
-
 	data.rank = player:hud_add({
 		hud_elem_type = "text",
 		position = HUD_POSITION,
@@ -45,7 +35,7 @@ local setup_hud = function(player)
 
 	-- rank img
 
-	local RANK_IMG_OFFSET = {x = 0,   y = 90}
+	local RANK_IMG_OFFSET = {x = -37,   y = 31}
 
 	data.rankimg = player:hud_add({
 		hud_elem_type = "image",
@@ -63,26 +53,36 @@ local setup_hud = function(player)
 
 	else
 		local XP_PROGRESS_OFFSET = {x = 0, y = 40}
-
+--[[
 		data.background = player:hud_add({
 			hud_elem_type = "image",
 			position = HUD_POSITION,
 			offset = XP_PROGRESS_OFFSET,
 			text = "xp_progress_bg.png",
 			alignment = HUD_ALIGNMENT,
-			scale = {x = 1, y = 1}
+			scale = {x = 1, y = 2.3}
 		})
-
+--]]
 		data.progressimg = player:hud_add({
 			hud_elem_type = "image",
 			position = HUD_POSITION,
 			offset = XP_PROGRESS_OFFSET,
 			text = "xp_progress_fg.png",
 			alignment = HUD_ALIGNMENT,
-			scale = {x = 0, y = 1}
+			scale = {x = 0, y = 2.3}
 		})
 	end
 
+	data.info = player:hud_add({
+		hud_elem_type = "text",
+		position = HUD_POSITION,
+		offset = {x = 2,   y = 41},
+		text = "",
+		alignment = HUD_ALIGNMENT,
+		scale = {x = 100, y = 100},
+		number = 0xFFffFF
+	})
+
 	hud[playername] = data
 
 end
@@ -177,7 +177,7 @@ xp_redo.update_hud = function(player, xp, rank, next_rank)
 	if has_hudbars then
 		hb.change_hudbar(player, "xp_progress", progress)
 	else
-		player:hud_change(data.progressimg, "scale", { x=progress, y=1 })
+		player:hud_change(data.progressimg, "scale", { x = progress, y = 2.3 })
 	end
 
 	if not xp_redo.disable_nametag then
@@ -214,3 +214,4 @@ minetest.register_on_leaveplayer(function(player)
 	local playername = player:get_player_name()
 	hud[playername] = nil
 end)

@S-S-X
Copy link
Member

S-S-X commented Apr 4, 2023

Without the background, player has no visual idea when the bar is actually full. Since the text is over the progressbar, players will probably expect the bar to go to the end of the text :/

Make it display percentage of next rank on right hand side instead of absolute value of XP (there's no way to determine maximum).
Or could add SI prefix like k,M,G but I guess percentage would be better.
Does not remove problem completely but should make a lot it easier to manage and you still have good clue about exact next rank amount by looking at your total XP, especially when you're very close to next rank.
(this to make it bit easier to fit text inside background area, max for percentage counter can be 99% which is 3 characters)

So instead of
49,821 / 50,000
It would be
49,821 / 99%

Saved space can be significant especially when it comes to high amounts of XP:
25,549,821 / 40,000,000
Would be
25,549,821 / 63%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants