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

Display background & moving progress bar on shutdown screen #14597

Merged
merged 18 commits into from
May 21, 2024

Conversation

chmodsayshello
Copy link
Contributor

@chmodsayshello chmodsayshello commented Apr 27, 2024

This Pull Request adds the main menu background to the shutdown screen, and makes the progress bar constantly refill itself indefinitely as long as the game is still shutting down. It does so by using a load screen instead of an overlayMessage.
Fixes #14571

Ready for Review.

shutdown.webm

How to test

  1. launch the game
  2. join either a server or a singleplayer world
  3. quit
  4. verify that said changes apply to the shutdown screen

@Zughy Zughy added @ Startup / Config / Util Feature ✨ PRs that add or enhance a feature UI/UX Supported by core dev Not on the roadmap, yet some core dev decided to take care of this PR labels Apr 28, 2024
@Zughy
Copy link
Member

Zughy commented Apr 28, 2024

Assigning @grorp due to being the author of the issue (unsubscribing)

Copy link
Contributor

@appgurueu appgurueu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works. Simple and effective. I like this. This may not be an ideal "striped" progress bar (and hence slightly confusing when it wraps around), but it's definitely good enough and much better than the status quo.

@grorp
Copy link
Member

grorp commented Apr 28, 2024

and hence slightly confusing when it wraps around

To avoid the confusion without making things overly complicated, I'd suggest this:

progress.bar.mp4

(My implementation of this is at https://github.com/grorp/minetest/commits/shutdownScreen, but the patch is horrible and not meant to be used as is.)

Copy link
Member

@grorp grorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The far edges of the clouds on the shutdown screen are black or sometimes green-ish for me. This doesn't happen on the loading screen.

src/client/game.cpp Show resolved Hide resolved
src/client/game.cpp Outdated Show resolved Hide resolved
@grorp grorp added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Apr 28, 2024
@chmodsayshello
Copy link
Contributor Author

and hence slightly confusing when it wraps around

To avoid the confusion without making things overly complicated, I'd suggest this:
progress.bar.mp4

(My implementation of this is at https://github.com/grorp/minetest/commits/shutdownScreen, but the patch is horrible and not meant to be used as is.)

I've only taken a very brief look at your commits as of right now, but I think at the point where you are modifying the rendering engine itself, it makes more sense to pass a boolean, which is a false by default in order to control wether the loading bar will do it's indefinate loading animation instead of providing the option of drawing a partional bar only.
That way we can avoid having loading animations that look different in case this is done somewhere else at some point in the future.

Anyway, I'll try to actually read through the entire thing and implement your desired changes tomorrow :)

@chmodsayshello
Copy link
Contributor Author

The far edges of the clouds on the shutdown screen are black or sometimes green-ish for me. This doesn't happen on the loading screen.

I have not been able to reproduce that, is it still the case on my most recent commit?

src/client/game.cpp Outdated Show resolved Hide resolved
Copy link
Member

@grorp grorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle, your approach is also ok, but it looks bad at the start and the end of the progress bar because of the way the texture is mapped to the slider. Example:

screenshot of ugly end

I think it would look best if both ends of the slider would always use the ends of the texture.

It's also irritating that the progress bar doesn't start at the beginning but at its last position if you start and shut down multiple games. It should start at the beginning again.

I have not been able to reproduce that, is it still the case on my most recent commit?

Yes, it is.

screenshot: far edges of clouds are black

src/client/game.cpp Outdated Show resolved Hide resolved
src/client/game.cpp Outdated Show resolved Hide resolved
src/client/renderingengine.h Outdated Show resolved Hide resolved
@chmodsayshello
Copy link
Contributor Author

chmodsayshello commented May 9, 2024

I have not been able to reproduce that, is it still the case on my most recent commit?

Yes, it is.

I have now (finally) been able to reproduce this behavior! I noticed that the color of the distant clouds is always the color the sky was before the shutdown, for example, if you run /time 19:00and then exit the game, they will be orange-ish.

Any chance it was night in your game session?

@chmodsayshello chmodsayshello requested a review from grorp May 9, 2024 18:51
src/client/game.cpp Outdated Show resolved Hide resolved
@grorp
Copy link
Member

grorp commented May 9, 2024

It's also irritating that the progress bar doesn't start at the beginning but at its last position if you start and shut down multiple games. It should start at the beginning again.

not fixed

EDIT: also misclicked

@grorp grorp closed this May 9, 2024
@grorp grorp reopened this May 9, 2024
@grorp
Copy link
Member

grorp commented May 9, 2024

This needs an update too:

showOverlayMessage(N_("Shutting down..."), dtime, 0, false);

@chmodsayshello
Copy link
Contributor Author

chmodsayshello commented May 9, 2024

It's also irritating that the progress bar doesn't start at the beginning but at its last position if you start and shut down multiple games. It should start at the beginning again.

not fixed

EDIT: also misclicked

The only solution I can think of is passing a pointer to a variable the position value is stored in then, are you fine with that?

src/client/clientlauncher.cpp Outdated Show resolved Hide resolved
@chmodsayshello chmodsayshello requested a review from grorp May 9, 2024 21:17
@chmodsayshello
Copy link
Contributor Author

chmodsayshello commented May 9, 2024

At this point, I've made way more commits than I feel like is reasonable for a PR of this scale, so, now may be a good time for a squash.
Thanks a lot for your effort by the way :)

@chmodsayshello
Copy link
Contributor Author

chmodsayshello commented May 9, 2024

To be honest, I think in the long term it might be better altering Game::showOverlayMessage (see https://github.com/chmodsayshello/minetest/blob/shutdownScreen/src/client/game.cpp#L4369) so by default it shows the sky and uses the indefinite loading added by this PR if no percentage >= 0 is given... Though, on the other hand, that might be something I'd do in another PR, as that would slowly push this pull request from it's purpose of well, "adding something that moves to the shutdown screen"… On the other hand, some of the changes I made around line 1200 wouldn't be necessary anymore.

Edit: here is a patch (I had to change the file extension so GitHub allows me to upload it) for the said change, since it ended up being a minor change, maybe it's worth applying it to the PR?
0001-make-overlayMessage-support-indefinite-loading.patch.txt


fps_control.reset();
f32 timer = 0.0f;

while (!client->isShutdown()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, this loop will never run anyway. client->Stop() above sets m_shutdown to true ...

void Client::Stop()
{
m_shutdown = true;

... and client->isShutdown() returns true as soon as m_shutdown is true:

bool Client::isShutdown()
{
return m_shutdown || !m_mesh_update_manager->isRunning();
}

Anyway, that's out of scope for this PR to investigate and fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accordingly, I've removed the changes to this loop again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, assuming that boolean is not volatile, shouldn't the entire loop be removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not remove it without investigating first:

  • what's the purpose of the code?
  • did it ever work?
  • why doesn't it work (anymore)?
  • is there a bug because the code doesn't work?

which is likely out of scope for this PR

Copy link
Member

@grorp grorp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've applied some cleanup to this PR, also including your patch for showOverlayMessage. It looks good to me now.

At this point, I've made way more commits than I feel like is reasonable for a PR of this scale, so, now may be a good time for a squash.

You don't have to squash, the PR will be squashed automatically when merging.

@grorp grorp removed the Action / change needed Code still needs changes (PR) / more information requested (Issues) label May 10, 2024
@grorp grorp merged commit ab783b9 into minetest:master May 21, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature ✨ PRs that add or enhance a feature @ Startup / Config / Util Supported by core dev Not on the roadmap, yet some core dev decided to take care of this PR >= Two approvals ✅ ✅ UI/UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add something that moves to the shutdown screen
5 participants