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

Overhaul the waiting lobby user interface #303

Merged
merged 9 commits into from
Nov 15, 2024

Conversation

haykam821
Copy link
Contributor

@haykam821 haykam821 commented Nov 6, 2024

This pull request introduces a new design for the waiting lobby user interface, replacing the old item stack-based user interface that only appeared during team selection. Games can listen to the GameWaitingLobbyEvents.BUILD_UI_LAYOUT event to add custom elements to the user interface.

User interface elements are dynamically sized; if not enough space is available to provide the extended variants of each element, some elements will condense into their main variant. While this functionality is not implemented currently, the main element will allow players to access the extended variants in another way.

In the future, other user interface elements will be added; currently, only team selection elements are provided by default.

Breaking change: while there are no compile-level breaking changes, the fact that waiting lobbies enforce a hotbar user interface functionally is a breaking change. Games that manage the inventory themselves in the waiting lobby, such as to add a kit selector, should migrate to the GameWaitingLobbyEvents.BUILD_UI_LAYOUT event.

Some API design questions that should be considered include:

  • How can games order the user interface elements? Would an integer or enum priority value resolve ordering issues?
  • Is the current API design sufficient to allow for custom global user interface elements, such as elements to leave the game or open a party management user interface?
  • How can user interface elements trigger a refresh of the user interface if their backing data has changed?
  • Could the API package structure be improved?

@haykam821 haykam821 added feature New feature or request breaking change labels Nov 6, 2024
@haykam821 haykam821 marked this pull request as ready for review November 10, 2024 21:53
@haykam821 haykam821 requested a review from Patbox November 10, 2024 21:53
Copy link
Member

@Patbox Patbox left a comment

Choose a reason for hiding this comment

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

Genrally looks good.
For sorting layouts, you could add identifier based prorities, like fabric events.
Also it might be good thing to check if players can interact with blocks and entities when with this gui, so you don't prevent some in world interactions games might want to use.

@haykam821 haykam821 added this to the 0.6.0 milestone Nov 11, 2024
@haykam821
Copy link
Contributor Author

I worry that computing an ordering graph might be a bit complex for the initial implementation, though the API surface seems reasonably simple: each element would provide a unique identifier, and layouts would allow adding adding elements before or after such an identifier. I suppose unit testing would help validate the mechanics.

@Patbox
Copy link
Member

Patbox commented Nov 11, 2024

Yeah fair. It can be added later down the line in api compatible way so it's nothing blocking. The world/entity interaction is more important thing that needs to keep working

@haykam821 haykam821 requested a review from Patbox November 14, 2024 22:43
@Patbox Patbox merged commit f91f40b into NucleoidMC:main Nov 15, 2024
1 check passed
@haykam821 haykam821 deleted the waiting-lobby-ui branch November 15, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants