Feature #14

Panel HUD

Added by FruitieX over 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:03/07/2010
Priority:NormalDue date:
Assignee:FruitieX% Done:

100%

Category:HUD
Target version:1.0

Description

TODO:

00:26:03 < FruitieX> - headshot/melee icon code
00:26:43 < FruitieX> - teamcolors shown correctly for spectators (currently only uses the playerslot of the spectator for some reason)
00:27:29 < FruitieX> - menu slider that looks in the skin folder and detects all available border_*.tga and dock_*.tga and adds them to the correct dialogs? or << and >> buttons with previews of the borders/docks(currently those are just hardcoded)
00:28:13 < FruitieX> - correct positioning of the HSL color picker cursor after loading cvars (currently just defaults to bottom right)
00:29:28 < FruitieX> - possibly invent more (random) centerprints for some events
00:29:37 < FruitieX> - telefrag icon needed!
00:30:02 < FruitieX> - teamcolor glow box around names in the notify panel
00:33:46 < FruitieX> - teamcolor testing from the menu needs a cleaner way than being a checkbox to force it on...
- expand and light up weapon in weapons panel at pick up- Would likely just be annoying now with the animated weapons panel
- (not bound) is shown in the vote panel as the binds with a fresh config, but why?-
- could maybe consider integrating cl_showspeed and cl_showacceleration with the panel hud system a bit better
- X enterd/leaved the game/team to notify panel? or as centerprint?
- better handling of mouse cursor skin (i.e. fallback to menu defaults if a skin doesn't exist)
- healtharmor shows incorrect values for health at round end (usually insanely high)
- separate kill message for secondary nade
21:11:16 <@divVerent> - "press team menu to adjust"
21:11:21 <@divVerent> - vote keys appear as "not bound" -

History

#1 Updated by DiaboliK over 4 years ago

  • % Done changed from 20 to 40

What has been done:
Mouse support
Inventory panel
Health/Armor(though this should be more like the inventory one)
Weaponicons (need a way to configure the size)

What needs to be done:
keyboard support(maybe)
Notification area(FruitieX is working on that)
Dialog on double click(DiaboliK)
Highlight Panel when Selected
Check if panels are overlapping(?)

#2 Updated by MirceaKitsune over 4 years ago

Wonderful idea, can't wait :)

#3 Updated by FruitieX about 4 years ago

  • % Done changed from 40 to 70

LOTS has been done, read git log if you're interested.
Currently working on Notify area.

Bugs left to tackle:
- Resizing not working correctly in some situations (especially when upper edge of highlighted panel collides against another panel)

#4 Updated by terencehill about 4 years ago

Hi there,
first I must say u did a great job til now, I like very much this panel hud!

I've tested it, spotted some bugs, experimented some stuff and overall I think u will find interesting that I've fixed the resizing.

Minor Bugs:

  1. missing initial quote in the cvar hud_inventory_bg_padding definition
  2. typo in the exporter code: seta hud_fg_alpha) (note the trailing parentesis)
  3. double click can be produced even clicking 2 times in the very same place (mouse stands still) without a timeout. Btw, u can look at how it's done in the code of the menu ;)
  4. the snap panels to grid checkbox is inverted
Bugs:
  1. for low values of hud_bg_border isn't possible to resize a panel. To fix it maybe show a border thick X pixels on that panel when clicked
  2. Panel resize with collision check
    Seeing your difficulties on the panel resize with collisionss check, I've tried to fix it and in the end, after much work and tests, I came up to a very simple and cheap algorithm that works perfectly. I've also fixed the panel aspect ratio handling because it was causing troubles when resizing.
    It hasn't been easy at all to fix it: I implemented and thrown away 3 other ideas that unlikely didn't work: one had a very cool behavior that I'd call "physical collisions check" (I can't describe it, I hope u can guess it) and was working actually perfectly if only it wasn't for a stupid bug that made flicker the panel size when 2 panels collide near the corners. After much time spent trying to fix it, I sadly realized it was impossible to fix, it was just bugged by design. Pity!
    Now... feel free to insist with your way until u succeed, I know it's hard to throw away your own hard work... if not, then u can find my code in my newpanelhud branch.
I've already implemented these things, I'll upload them if u want, just tell me:
  • checkbox to enable setup of the HUD for team games or "normal" games, hiding the not available options/panels, I've only to port the changes from my old patch in nexuiz tracker and then apply to the panels too.
  • support for shift/ctrl/alt as keys modifiers in configuration mode
  • ctrl+left button drag: move/resizes disabling collisions check

It'd be cool to add also other keyboard shortcuts, to make the layout setup (possibly) entirely by keyboard, I could do it easily, I think.

#5 Updated by MirceaKitsune about 4 years ago

I heard the HUD is getting merged today. Can't wait, it looks wonderful at this point :D There are still a few things that aren't completed in my opinion, most of which are likely known. In case it helps keep track of things, here is my own list of things that I believe need to be done (possibly after the branch is merged):

- If you move the mouse while configuring, you look in a different direction after you exit hud_configure mode. You still look around as you move the mouse pointer, but the editor masks that until you exit. Mouselook input probably needs to be blocked while editing.

- The HUD still shows when a player is dead or spectating.

- The menu mouse pointer and editor mouse pointer are not the same. If you open a menu while editing the hud you even see both pointers at the same time. Two possible fixes could be: Either making a single pointer / using the menu's pointer, which would be best (but I heard that would be difficult to do), or hiding the HUD editor's pointer when the menu is open, so you at least don't see both at a time and only see the cursor fading to somewhere else (this should be easy... I remember there's a float to check whether the menu is open, used for crosshair shrinking / fading effect).

- Bots should not shoot you while you're editing the HUD, and you should have the key symbol above your head (like when you're chatting or in the menu). This is difficult to implement from what I heard... I wonder if we can use the impulse sent by the menu or the chat system when you're typing.

- Add a color picker for each panel in its properties window, as well as in global properties (esc) for default panel and dock color. If a color picker can't be implemented, even 3 RGB sliders are good imo, long as you can edit the color :)

- Minimap properties (double click menu): The minimap panel has a checkbox for On/Off like the other panels. In its case however, there should probably be a slider (or 3 radio buttons) containing: Minimap disabled, Minimap enabled only in team games, Minimap enabled all the time.

- Some checkboxes are inverted, like terencehill mentioned.

- There should probably be "ghost ammo" as well, when disabling "Show current ammo only" for the ammo panel. On the weapon bar each weapon you don't have is just a black shadow, so maybe the same should be done for the ammo panel.

- Since the Fireball now uses fuel for ammo, fuel should perhaps be an ammo type in the ammo list, rather than a bar (or both a bar and ammo in the list, so the Jetpack is happy too). Just an idea, not sure how this would be best to do.

- The Settings -> Input menu should probably contain a (non-custom) keybind for hud_configure. An appropriate default key would he "h". Would make it easier for someone to quickly edit the HUD in a game (of course not while they're playing :P )

- The "Press ESC to show HUD options - Double click a panel for panel-specific options" message might make more sense to be placed at the center of the screen under the crosshair, rather than on the events panel. It would be covered by other panels or be covering other panels then, but I think it would make more sense like that. On the good side, it's unlikely anyone will put a panel there since that's where the crosshair goes. Just a thought.

Just my ideas and list of issues... not trying to bug anyone about them or anything :) Imo this is what that's left for the HUD to be 100% completed.

#6 Updated by FruitieX about 4 years ago

  • % Done changed from 70 to 80

terencehill wrote:

  1. missing initial quote in the cvar hud_inventory_bg_padding definition

Fixed, thank you for spotting :)

  1. typo in the exporter code: seta hud_fg_alpha) (note the trailing parentesis)

Hehe, I spotted that myself some day ago when I moved the default hud cvars into a separate cfg, thanks anyway :)

  1. double click can be produced even clicking 2 times in the very same place (mouse stands still) without a timeout. Btw, u can look at how it's done in the code of the menu ;)

Lies :P The timeout is just a bit long perhaps

  1. the snap panels to grid checkbox is inverted

Menu bugs -> DiaboliK ;)

  1. for low values of hud_bg_border isn't possible to resize a panel. To fix it maybe show a border thick X pixels on that panel when clicked

Hmm, maybe I should force a minimum border size in conf mode

  1. Panel resize with collision check
    Seeing your difficulties on the panel resize with collisionss check, I've tried to fix it and in the end, after much work and tests, I came up to a very simple and cheap algorithm that works perfectly. I've also fixed the panel aspect ratio handling because it was causing troubles when resizing.
    It hasn't been easy at all to fix it: I implemented and thrown away 3 other ideas that unlikely didn't work: one had a very cool behavior that I'd call "physical collisions check" (I can't describe it, I hope u can guess it) and was working actually perfectly if only it wasn't for a stupid bug that made flicker the panel size when 2 panels collide near the corners. After much time spent trying to fix it, I sadly realized it was impossible to fix, it was just bugged by design. Pity!
    Now... feel free to insist with your way until u succeed, I know it's hard to throw away your own hard work... if not, then u can find my code in my newpanelhud branch.

Wow huge thanks for this, after being skeptical for a minute I merged it immediately after testing, boy did it work much better than my implementation! :) BTW I'm removing all aspect ratio forcing as per request by div0, and rewriting some panels to work at any aspect (just center and resize the stuff if aspect is wrong) Aspect forcing was bad anyway, since it causes problems when you use a hud config that was designed with another conwidth... Now (or soon :)) a config should work just fine at any aspect, please merge the latest code into your local branch and test. That way we also won't have to worry about such IMHO messy code.

Another BTW: I fixed the problem you mentioned about panels flickering (or in this case, disappearing!) when they touch another panel and are resized like this: Just check if resizeorigin was within that panel, and then ignore all collision tests against that particular panel :) Problem fixed! It also appeared in your resize code, you see...

I've already implemented these things, I'll upload them if u want, just tell me:
  • checkbox to enable setup of the HUD for team games or "normal" games, hiding the not available options/panels, I've only to port the changes from my old patch in nexuiz tracker and then apply to the panels too.
  • support for shift/ctrl/alt as keys modifiers in configuration mode
  • ctrl+left button drag: move/resizes disabling collisions check

Yeah, these sound neat. Just push the changes into your git branch, and I'll merge if I like them (which I probably will)

It'd be cool to add also other keyboard shortcuts, to make the layout setup (possibly) entirely by keyboard, I could do it easily, I think.

Yes, if you have time feel free to do so. Could be useful to do some fine adjustments with the keyboard.

#7 Updated by FruitieX about 4 years ago

Update: Panelhud merged to master

#8 Updated by terencehill about 4 years ago

Weird, I can't reproduce the doubleclick bug now... Maybe you fixed it and I didn't notice it in the git log, because it was there roughly more than 3 weeks ago. I should have double-checked it (hehe or even double-clicked it!) before posting, sorry :)

FruitieX wrote:

Hmm, maybe I should force a minimum border size in conf mode

Agree, better than my idea.

About the aspect ratio, I arrived to the very same idea div0 suggested u to implement, but only when I tested the same hud config in 2 resolutions with different aspect ratio, I didn't try it before.
After the changes u made these past days, the weapons panel is just perfect, the pressedkeys panel, even if it's working perfectly, now is much less cool :( . There are other panels that need to be fixed.

MirceaKitsune wrote:

Add a color picker for each panel in its properties window, as well as in global properties (esc) for default panel and dock color. If a color picker can't be implemented, even 3 RGB sliders are good imo, long as you can edit the color :)

Wondering why the 3 good old rgb sliders are not there... Are u planning to put directly a color picker?

Oh, and I vote for right click instead of doubleclick to show settings dialogs, IMO it's more intuitive. Maybe use both?

I've pushed some stuff in my branch (arrow keys to move/resize panels), check it out.

Edit: properly quoted

#9 Updated by FruitieX about 4 years ago

Yes they need to be fixed and are WIP, I am aware of the fact that eg. pressedkeys is quite ugly at the moment, but PLEASE don't restore the hacky aspect ratio stuff. The goal is instead to make each panel independent of aspect, and some panels still fail at this (score, inventory, vote, racetimer, notify panel spring into mind). Ideally stuff would just be scaled down and centered, not like the pressedkeys panel at the moment. Feel free to fix some if you feel like it, I'm also trying to get rid of HUD_DrawXNum now that we have freetype fonts. (so start by removing those, merge fruitiex/newpanelhud [currently not compiling due to this])

#10 Updated by terencehill about 4 years ago

but PLEASE don't restore the hacky aspect ratio stuff

I've got the point, do not worry.
If u are referring to the commit ccf538838a3d4026636661723410c4ce4a1c6a0e, maybe u didn't read the 2nd line of the description:

Put back checks of ratio in CheckResize algorithm.

They are used to decide which side limits the resizing, not to keep the aspect ratio.

If u agree on the changes I did, please merge my branch into yours to avoid possible future conflicts (as I write there isn't any).

I'm also trying to get rid of HUD_DrawXNum now that we have freetype fonts. (so start by removing those, merge fruitiex/newpanelhud [currently not compiling due to this])

I really don't get the reason why u made the code not compilable on purpose, since HUD_DrawXNum isn't broken at all.

#11 Updated by FruitieX about 4 years ago

terencehill wrote:

If u agree on the changes I did, please merge my branch into yours to avoid possible future conflicts (as I write there isn't any).

I'll check it out today...

I really don't get the reason why u made the code not compilable on purpose, since HUD_DrawXNum isn't broken at all.

Yeah that was admittedly a little silly :)
Now it's fixed however, and all panels use either drawstring or drawstring_aspect

#12 Updated by FruitieX about 4 years ago

Merged it by cherry-pick, seems like you had forgotten some of your old CA and key fixes in there :)
(divVerent had already merged the latest ones)

Also added returning from keyboard input function in case the mouse is clicked, as doing just that caused some funny behavior (easy way to avoid the bugs)

Overall great patch, huge thanks! :)

#13 Updated by terencehill about 4 years ago

Merged it by cherry-pick, seems like you had forgotten some of your old CA and

key fixes in there :)
(divVerent had already merged the latest ones)

Weird... seeing the git log it seems I haven't forgotten anything. I suppose maybe u had troubles in some way because my misc_bugfixes branch was added to master without a merge commit.

Overall great patch, huge thanks! :)

I'm glad u liked it, just a small contribute for this feature, which is getting better and better ;)

Check out another small feature I've pushed into my branch: Customizable levels and colors for weapons accuracy, I hope u like this one too.

About cvars names, I think you should use better names for some cvar, now there aren't backward compatibility issues:
  1. hud_weaponsicons_number can now indicate even key names too, not only numbers, I'd suggest to rename it into hud_weaponsicons_label.
  2. hud_showbinds (and hud_showbinds_limit) should be integrated in hud_infomessages.
    mmm... wait... it seems the code doesn't support these cvars anymore... well, then in this case they just should be deleted from defaultXonotic.cfg
  3. hud_inventory (what inventory? weapons? ammo?) definitively should be renamed into hud_ammoinventory or just hud_ammo
  4. hud_weaponicons into hud_weaponsinventory or just hud_weapons
  5. For all the panels cvars, I suggest to use hud_panel_name_* instead of hud_name_* so that it's clear from the cvars what's a panel and what's not (for example hud_dock, hud_progressbar). With this change we would get a less messy cvar list.

#14 Updated by FruitieX about 4 years ago

  • % Done changed from 80 to 90

terencehill wrote:

Merged it by cherry-pick, seems like you had forgotten some of your old CA and

key fixes in there :)
(divVerent had already merged the latest ones)

Weird... seeing the git log it seems I haven't forgotten anything. I suppose maybe u had troubles in some way because my misc_bugfixes branch was added to master without a merge commit.

Overall great patch, huge thanks! :)

I'm glad u liked it, just a small contribute for this feature, which is getting better and better ;)

Check out another small feature I've pushed into my branch: Customizable levels and colors for weapons accuracy, I hope u like this one too.

About cvars names, I think you should use better names for some cvar, now there aren't backward compatibility issues:
  1. hud_weaponsicons_number can now indicate even key names too, not only numbers, I'd suggest to rename it into hud_weaponsicons_label.
  2. hud_showbinds (and hud_showbinds_limit) should be integrated in hud_infomessages.
    mmm... wait... it seems the code doesn't support these cvars anymore... well, then in this case they just should be deleted from defaultXonotic.cfg
  3. hud_inventory (what inventory? weapons? ammo?) definitively should be renamed into hud_ammoinventory or just hud_ammo
  4. hud_weaponicons into hud_weaponsinventory or just hud_weapons
  5. For all the panels cvars, I suggest to use hud_panel_name_* instead of hud_name_* so that it's clear from the cvars what's a panel and what's not (for example hud_dock, hud_progressbar). With this change we would get a less messy cvar list.

Ok, merged your changes and implemented the above suggestions.

We still need to:
- Decide on a default skin, then use it, move it's images into the default dir.
- Add a bg textslider to the panel dialogs
- Improve the HUD setup dialog (when you hit ESC)
- Fix weapon death messages, print these to the console when the notify panel is disabled
- Print weapon complain messages to the console if the weapon panel complainbubble is turned off

#15 Updated by FruitieX about 4 years ago

Update. (see opening post)

#16 Updated by FruitieX about 4 years ago

Report any other "nitpicker" bugs you find here.

#17 Updated by FruitieX about 4 years ago

  • % Done changed from 90 to 80

#18 Updated by terencehill about 4 years ago

fps counter doesn't work at low fps, it never goes under 10 fps. U can verify it by setting cl_maxfps to a number lower than 10.
The reason is that in the hud it's not possible to use the function gettime() to get the REAL current time, like in the menu. In the hud u can only use the var time, which is unlikely inaccurate, as time - prev_fpstime is always > 0.1. Neither u can use the var frametime as it's limited to a minimum of 0.1 too. I don't why it's like this.

hud_panel_weapons_fade is missing in _hud_description.cfg/defaultXonotic.cfg.

I fixed another small bug in my branch, aside the new features I added.

#19 Updated by terencehill almost 4 years ago

I have some ideas that I'd like to implement, but first I want to know which ones are good/wanted. Suggestions to improve them are welcome.

1. A dialog with a listbox to select and load a skin. The first item of the list would be called "current settings", to load only the current cvars.
This dialog would be shown by the "HUD Setup" button in "Player Setup" dialog and by a new button in HUDExit dialog

2. Buttons in HUDExit dialog to choose what else configure: scoreboard and map voting screen

To reduce the number of settings in HUDExit dialog:
3a. A button (and a separate dialog) for the dock...
3b. Alternatively make this dialog larger and put the setting in 2 columns, this seems to me the best choice.

4. A Help dialog that displays a brief welcome message and all the available shortcuts (anything else?); the infomessages panel in hud config mode then would display something like:
Doubleclick for ...
ESC for ...
l to load a skin
h to show a help window

5. Panel's border for scoreboard (around each table) and map voting screen (around each map preview). Uncertain whether keep or not the old simple borders...
However I've already implemented locally a patch capable to show both, even at the same time.

#20 Updated by mand1nga over 3 years ago

  • Status changed from In Progress to Closed
  • Assignee set to FruitieX

Also available in: Atom PDF