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

Update to DDNet HUD and OPD (On Player Displays) #6724

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

C0D3D3V
Copy link
Contributor

@C0D3D3V C0D3D3V commented Jun 9, 2023

Hello everyone, I hope you are all doing well.

Main goal for this PR is to add an option to restore countdowns using stars for Unfreeze time and Ninja time. Doing this I also updated the HUD and OPD.

It would be good if someone familiar with the tick states on the client side could take a look at the new star generator in countdown.cpp. I'm not sure if there is a better solution.

The tick I use should be the same as the original star counter design, so switching to the client sided star counter should be without complications.

PR includes:
Changes to the server:

  • m_FreezeStart is updated after the player unpauses, so that freezebar is correctly displayed after unpause
  • m_FreezeStart is also updated after server unpauses.
    This should have no effect on physics, since the only effect is, that a player can not get instantly refrozen if he sits in freeze after unpause, Instead, the refreezing occurs only after the second that has already started.

Graphics changes:

  • Freezebar is smaller than before.
  • Ninjabar is now below players and rendered for every ninja player
  • Ninjabar is always below Freezebar; but if there is no freezebar it is at the same position as the freezebar
  • Keystroke indicators have new arrows, they are smaller than before.
  • Jump Indicator no longer displays ground jumps (except for m_Jumps == 1); and it displays an extra symbol if the player has no jump at all
  • arrow.png, strongweak.png and hud.png moved inside extras.png made by ravie.
  • weapon armor moved also into extras.png and changed texture.

Checklist

  • Tested the change ingame
  • Provided screenshots if it is a visual change
  • Tested in combination with possibly related configuration options
  • Written a unit test (especially base/) or added coverage to integration test
  • Considered possible null pointers and out of bounds array indexing
  • Changed no physics that affect existing maps
  • Tested the change with ASan+UBSan or valgrind's memcheck (optional)

@heinrich5991
Copy link
Member

Very cool that you tackled this. Haven't reviewed it yet.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 9, 2023

Ops, I wanted to merge master into this, to resolve the merge conflict. Accidentally rebased on master, sorry!

@heinrich5991
Copy link
Member

I like rebasing better anyway.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 9, 2023

I like rebasing better anyway.

Mostly me too, mainly if I do an error in my commit and want to do a quick fix via rebase (like my last commit, I would like to rebase this). But then it is not so nice if someone is reviewing... But I have bad experiences in rebasing PR on master, like here, it was just to confusing to fix the conflict correct.

Note: This PR should not be merged until we are fine with the used tick variables...

@C0D3D3V C0D3D3V force-pushed the pr_old_design_toggle branch 3 times, most recently from 6c46fde to 82c10c5 Compare June 9, 2023 10:28
@heinrich5991
Copy link
Member

This seems to change some graphics? The freeze bar looks different in the new extras.png file. Is that intended?

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 9, 2023

Yes, sorry I have not finished the description of the PR yet. I will complete this later (for now please have a look at the commit messages).
:D long time ago (before I went afk) We discussed how we can make the freezebar more general acceptable, less standing/sticking out. And more usefull, in a way that the seconds get somhow highlighted (not yet implemented). That was one of the results. We can discuss if that is a good change here and on discord. Actually I Implemented this part month ago (last year) and played with that since then, I think that is a good improvement.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 12, 2023

I have made a few tests with debug / monitoring functions, I came to the conclusion that using GameTick is the best option. If someday someone comes up with a better solution, it is welcome. Using gametick should be pretty stable (as stable as your ping, I guess), so pro players that relay on stable counters should be satisfied.

@C0D3D3V C0D3D3V changed the title Add option to restore countdowns using stars Update to DDNet HUD and OPD (On Player Displays) Jun 12, 2023
@VoxelDoesCode
Copy link
Contributor

Not going to lie, this is just making image management messier than it already is. Cramming everything into one image doesn't sound very intuitive for the future. Like, if we were to tackle rearrangement of images, I think we should organize everything properly.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 15, 2023

The idea was that we have one png for all stuff that we have added for ddnet Game, HUD and OPD. The idea was that someday we could maybe expand the loading mechanic of extras.png, so that for other mods that require other textures cloud be another texture be loaded. The discussion we had about the changes are long time ago, so please, all changes I have made here are open for discussion.
Code wise it is not a problem to expand this image on any side for more free space in future if we need any (its just a one line change).

@Learath2
Copy link
Member

When you have a minute it'd be nice to see some screenshots for these changes

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 15, 2023

I will do some later tomorrow.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 16, 2023

Video showing / testing the new Jump Display Indicator
https://odysee.com/@c0d3d3v:9/jump_display-2023-06-16_13.27.44:3
Video showing the new ninja /freeze time countdown
https://odysee.com/@c0d3d3v:9/ninja-and-freeze-counter:2

Sorry for the lags. :/ I do not know why the recording is so bad

m_FreezeStart is now corrected by the ticks the character was paused
Possible physical changes: Until now it was possible if you sit inside freeze to re-freeze instant
after unpause. Now you re-freeze after the second that was dawned before
the pause. I do not excpect that this is used on any map, and it did not
bring any benifit.
Renamed freezebars.* to countdowns.* because it will contain different types of countdowns with different display styles. That will be at least a countdown for freeze time and ninja time, in form of stars as in vanilla and progress bars. Alternative name for the class could be: "on_player_display" so it can include also different future displays that are not countdowns, but also are displayed on the player.
Renamed option cl_show_freeze_bars to cl_show_freeze_countdown, because it now includes the switch between freeze bar and freeze stars.
Added void CreateDamageInd to client component to create multiple damage stars in the way it is done on the server.
Fix alpha calculation of damage indicator, so that we can use a lower alpha than 1 for other players.
Added setting menu for toggle between freeze stars and freeze bars
Move arrow.png, hud.png, strong_weak.png inside extras.png
Todo: Remove weapon armor from game.png (it is now included inside extras.png)
Now the Strong/Weak Indicator Texture has a color (instead of hardcoded collor in code), so customization is easy
Removed HUD Assets Tab and all related code
Renamed cl_show_freeze_countdown to cl_show_state_change_countdown; so it is a more general name because it now includes also the coutdown for ninja move time
Simplefied the rendering of countdown bars a lot, by just using two seperate textures, one for full bar; one for empty bar
Implemented client sided star emitation for ninja move time
Moved ninja countdown bar from top left to bottom of the player. Ninja bar moves below the freeze bar if there is any, because freeze time is normally lower.
Removed ninja bar from HUD
Updated settings page for new countdown option

Server Changes:
Also Increase m_Core.m_FreezeStart if server is paused; so that Clients get correct FreezeStart for countdown calculations; This should have no effects on game physics (as mentioned in the commit before).
We no longer want to display ground jumps, because it is anoying for
many players to see a frequently change in the HUD. Most of the time
the player knows when he has ground jump (because he stays on ground) or it is implicitly indicated via the
air jump display.
The idea is now as following:
m_Jumps == -1 (255): Tee has only ground jump => display nothing
m_Jumps == 0: Tee has no jump at all => display air jump disabled symbol
To make it easier for the player to distinguish the two cases above, the "air jump disabled" symbol is used. Even tho in the first case the player also has no air jump; he can associate the no air jump symbol with no jump at all; and since we do not display ground jumps he should not be confused in the first case to make a ground jump.

m_Jumps == 1: Tee has one ground jump or one air jump => display one air jump symbol that also gets empty on ground jump
m_Jumps >= 2: Tee has one ground jump and (m_Jumps - 1) air jumps => display (m_Jumps - 1) air jumps
- remove s_StarsCountdownToolTip
- use mem_zero in init of countdowns
- use const Reference instead of pointer for CCharacterCore in
  countdowns
- use const pointer for CCharacterCore in HUD
@Learath2
Copy link
Member

Discuss: Should we maybe generate the new snowflake particles instead of damage indicator stars for the countdown? People obsessed with the stars can just replace it in the hud png.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 19, 2023

@Learath2 So you do not mean stopping the freeze animation if you have turned on the stars countdown, but using a different texture for the stars countdown? One that is default different than the damage stars, more like the snowflake particle, but different so that you can distinguish it from the freeze animation?

@Learath2
Copy link
Member

Yes, we can make them bigger and give them an outline to make them stand out. Iirc the freeze animation ones are tiny. Idk if it would look better, though. Maybe stars are the way. I was interested in trying it when I first accepted to add the stars back.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jun 20, 2023

I have talked with Ravie about this. He has added a good thought, with that I agree. We only add the Star countdown back for player that loved them and do not want any changes to them. So changing the texture, would not satisfy these people. Ravie also means the option to switch back to star countdown should be a hidden option, not in ingame setting menu.

Even adding an extra textur to the set, that is identical to the old star, just that you have the option to change the countdown star without changing the damage indicator star, is also nothing we should do (at least not without having people that would like to have that). And it wouldn't be easy to reacreate the identical star as vector image.

Update DDnet entities with new Shields design
@C0D3D3V C0D3D3V marked this pull request as draft June 28, 2023 11:59
Update weapon armor in entities clear
@C0D3D3V C0D3D3V marked this pull request as ready for review July 4, 2023 13:10
@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jul 4, 2023

For me, this PR can be merged. Could everyone who had criticism look over it again? Maybe I lost sight of something that was under discussion.
The thing with the textures #6753 I would not prioritize now necessarily so hard. I intend to keep trying to implement it, but I don't see any urgent reason to make this PR dependent on it.

@heinrich5991
Copy link
Member

heinrich5991 commented Jul 4, 2023

If we don't want to do asset handling in this PR, I propose not changing the layout with this PR.

To expand: Every change in assets causes churn for all people having custom assets. If we do a change, I want to do it right, so we don't have to cause work for the community twice.

@C0D3D3V
Copy link
Contributor Author

C0D3D3V commented Jul 4, 2023

If this is so high prio; I guess we can put this back to draft, and I do my best to finish the work faster...

Arguments against staying with the old layout (if the asset handling is not high prio):
This PR does break compatibility with the old layout anyway, because I simplified the rendering of the bars; that increases the rendering speed (there is still potential to even increase this). The Texture of the freezebar and ninjabar changed; before we had only half full, half empty; now we have textures for complete full bar and complete empty bar. There is at least the missing icon for "air jumps disabled". We have currently no fallback mechanism implemented; players that use old textures would just see no icon.
We did create a concept back then, for sorting the texture atlas extras.png

concept_extras

Combining the textures as I did, makes it easier for designers to create a full HUD/OPD texture set (at least for now).

But I'm fine with putting it back to queue

@C0D3D3V C0D3D3V marked this pull request as draft July 4, 2023 15:49
@Robyt3
Copy link
Member

Robyt3 commented Jul 10, 2023

CC #5699.

@heinrich5991
Copy link
Member

Status: Blocked on #6753.

@heinrich5991
Copy link
Member

Status: Still blocked on #6753. :/

@furo321
Copy link
Contributor

furo321 commented Mar 15, 2024

I know the PR's graphic changes is blocked on #6753. But could we at least get the server fix merged in a different PR? This commit that is:

fix freeze bar not being correct after returning from pause
ddba810

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

Successfully merging this pull request may close these issues.

None yet

6 participants