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

[1.20.4/5] Improved ModMismatchDisconnectedScreen and clientside handling of channel mismatches in general #672

Merged
merged 14 commits into from
May 28, 2024

Conversation

RedstoneDubstep
Copy link
Contributor

@RedstoneDubstep RedstoneDubstep commented Feb 28, 2024

This PR aims to improve the user experience of getting disconnected from a NeoForge server due to channel mismatches, mainly by improving the usability of the ModMismatchDisconnectedScreen (the screen that shows instead of the default DisconnectedScreen if a NeoForge server disconnects the client due to channel mismatches) and also two other related changes. The ModMismatchDisconnectedScreen was previously adapted as part of the network refactor and its changes to handling channel mismatches, and this PR finalizes these adaptations to bring back most of the design elements and advantages that existed before the network refactor.

Changes to the ModMismatchDisconnectedScreen:

  • Re-added "Connection Lost" message at the top of the screen, to clarify why the screen is shown
  • Fixed the actual disconnection message possibly going outside the screen, now it will fit within the screen's dimensions
  • Re-added alternate coloring for subsequent table entries, to be able to distinguish them better
  • The channel mismatch reason is now automatically appended (either on the server or on the client) by the information of what mod likely owns the mismatched channel (based on the channel's namespace), so users have an easier time finding out which mod they might need to install or remove to fix their connection issues
  • The channel list now merges channel mismatch entries with the same mismatch reason component into one singular entry (by default displaying one exemplary channel id and the amount of channels with an identical reason), to reduce list repetition and length; this also means that only entries of channels that are deemed to likely be owned by the same mod (based on the channel's namespaces) get merged
  • Removed the assignment of the homepage URL of the mod of which the id matches a channel's namespace to that channel, mainly due to inconsistency (the URL could only be displayed when the mod was installed on the client)
  • Added an "Simplified view" option button to the screen which controls if only one (default) or all channels that have the same reason component should be listed in the screen
  • The channel list now displays a maximum 30 instead of 10 entries before showing the "[xyz additional, see latest.log for the full details]" message. This was done partly to bring back parity with the MMDS before the network refactor, in which the channel list had two parts (missing channels and mismatched channels) that showed 10 entries each, and partly because I felt that if we have a scroll list, we might as well include more stuff in it (since more entries don't take up more screen space).
  • Fixed too early wrapping of the "Reason" component, and increased its size to half of the list (previously that table column stored a version string, which was a lot shorter than the reason components now are, which warrants the increased width of that column)
  • Renamed some variables and updated some javadoc to reflect the recent changes made to this screen during the Network Refactor

Other changes:

  • Configuration and play channels now store the id of the mod that registered them (the id is retrieved through the ModLoadingContext); this information is not sent over the network (to prevent this PR from potentially becoming a breaking change), and so only available on the side that the channel was registered on Edit: This was decided against by maintainers
  • The client will now print a warning log message for all channels that failed to connect
  • Fixed error message due to the packet handler trying to parse the ModdedNetworkSetupFailedPayload like a normal packet

Further points to discuss:

  • Should we rename the current "Channel name" header to "Mod name" or something similar? This is because, in my opinion, users shouldn't concern themselves about what a channel is and thus the concept of channels should be mentioned as little as possible. This proposition is no longer relevant.
  • Before the network refactor, the server sent all of its installed mods to the client so the client could use these mod names and particularly other metadata like version and URL for a more informative list of errors on the disconnected screen. Is that possible/feasible to add in the new protocol?
  • The channel mismatch reasons sent from the server to the client are great for modders, but can be ambiguous to inexperienced mod users. Is it worth hardcode-checking the reason components (to know whether the channel was missing or mismatching) and adding a "Suggested actions: ..." text/button somewhere that shows players more user-friendly messages?

Visual comparison between the previous and updated ModMismatchDisconnectedScreen:

(Edit: the updated MMDS's design is outdated, for the current version see further below)
image
image
(Also of note in this example: the previous MMDS had 107 entries corresponding to the 107 mismatching channels, of which only 10 were actually displayed, while the updated MMDS has 5 entries corresponding to the 5 mismatching mods.)

@neoforged-pr-publishing
Copy link

  • Publish PR to GitHub Packages

@Matyrobbrt Matyrobbrt added enhancement New (or improvement to existing) feature or request 1.20 Targeted at Minecraft 1.20 labels Mar 1, 2024
- PlayRegistrations and ConfigurationRegistrations now store the id of the mod they were created from, which is retrieved via the ModLoadingContext
- This mod id is used to enhance the channel mismatch reason component to always include the mod name (this enhancing is done on the side that the channel was registered on)
- Since some of that reason component enhancing is done in the constructor of the MMDS, the logging of channel mismatch entries has been moved to there as well
- There is now also a button that toggles listing only one (default) or all channels with the same reason component
@RedstoneDubstep
Copy link
Contributor Author

Alright so after these recent changes, channels are now properly grouped by their owning mod. This is achieved through the owning mod always being included (= mentioned) in the channel's mismatch reason, and because mismatched channel entries only get merged if their mismatch reasons are identical (note that in the new implementation, the channel namespace gets ignored in that merging logic, only the reason is checked), channels are strictly only merged if they were registered by the same mod.
Of note: There were some internal changes made to properly store and keep track of the mod id that owns the registered channel, however these changes have all been made in classes annotated as @ApiStatus.Internal, so none of the changes should be breaking ones.
Additionally, there is now a new button which controls if only one (default) or all channels that have the same reason component should be listed in the screen. Below is a visual comparison between the so-called "Simplified View" being active or not.
A re-review based on these new changes is greatly appreciated.
Screenshot 2024-03-06 153842
Screenshot 2024-03-06 153934

For this solution to work, the verification that a registered payload's namespace needs to match the mod id of the registrar had to be removed, in order to allow mods passing their proper mod id to the registrar while still being able to register payloads for any namespace they desire using that registrar (as has been one of the ideas of the Network Refactor).
Suggestion: put a duplication check in NetworkRegistry#setup where the channels are built, since currently duplicate payload ids just seem to be silently overwriting each other, which doesn't feel intentional.
@RedstoneDubstep
Copy link
Contributor Author

Hello, I know you are currently busy with the new snapshots and (if I understood that right) an internal network api refactor by Shadows, but a continuation of the conversation above would still be greatly appreciated. With my latest commit, I've now removed all usages of the static ModLoadingContext, as requested by Shadows, the (in my opinion even beneficial) side effect of this change is stated in the commit's description.

@Shadows-of-Fire
Copy link
Contributor

To summarize the discussion surrounding this:

We have collectively decided the ownership-tracking approach (through the loading context) is not stable enough to warrant using, nor do we apply it for any of the other types of objects that are synchronized. We will be pursuing a new solution which better permits mods to declare their network compatibility and provide the user with actual information instead of relying solely on channel and registry compatibility.

That said, we are still interested in receiving the improvements to the Screen and the channel mismatch handling, so we can move forward here.

As far as the current change set goes, the modid params in ConfigurationRegistration, PlayRegistration, and NegotiableNetworkComponent should just be replaced with the actual registration ID (effectively making the modid in the IPayloadRegistrar defunct). If necessary, the ResourceLocation id can be added as a parameter to the *Registration classes, but NegotiableNetworkComponent should need no change.

@RedstoneDubstep
Copy link
Contributor Author

Hello, thank you for the information! So to clarify, does that mean that no form of channel mismatch entry merging (even through tracking the owning mod of the channels) is going to get accepted (even though it has significant usability benefits compared to just listing all entries in my opinion)? If so, I can remove the relevant code from the PR to only make it consist of screen formatting fixes.

@Shadows-of-Fire
Copy link
Contributor

We can still do the merging. Realistically the unmerged version is mostly useless to an end user due to the volume of information.

@RedstoneDubstep
Copy link
Contributor Author

RedstoneDubstep commented Mar 30, 2024

I agree, the unmerged information is just too vast and confusing for the general end user. However, I'm now confused about which criterion should be used to merge the channel mismatch entries, if both merging based on channel namespaces as well as merging based on owning mods (through mod ownership tracking) is off the table. Is there another option that allows for a usable and logical merging of channel mismatch entries that I have missed?

@Shadows-of-Fire
Copy link
Contributor

Grouping by the registered namespace should be sufficient. This screen should basically be a last-effort fallback (same for the registry entry mismatch), as we will be expecting that mods providing networked components (registry entries, channels, data maps, etc) use the new system.

The new pipeline will be something akin to the following:

  1. A declarative network version range, checked automatically as the first step of the connection.
  2. Invocation of custom network compatibility checkers (for advanced handling beyond declarative version ranges).
  3. The original checks, if no mods provide an explicit reason for the disconnect.

@Shadows-of-Fire Shadows-of-Fire self-assigned this Mar 30, 2024
@RedstoneDubstep
Copy link
Contributor Author

Alright, thank you for your explanation, I don't think I completely understand it (since I haven't fully kept track of maintainer discussions regarding these changes), but I will re-add grouping of channel mismatch entries based on channel id namespaces. Should I also re-add the logic that tries to find (and display the name of) the mod of which the mod id is the same as the merged channel namespace?

@Shadows-of-Fire
Copy link
Contributor

Yeah we can retain the modid->name lookup feature.

- The name of the mod which id matches the mismatching channel namespace is displayed in the channel mismatch entry's reason component, so users have a potential mod candidate to add/update/remove
- The feature of tracking the mod that registered a channel has been removed again
- Re-added the exception that occurs when a channel gets registered to a registrar with a mod id which is different to the channel's namespace
@RedstoneDubstep
Copy link
Contributor Author

Alright, the prior channel-namespace-merging logic has been restored. The visual appearance of the screen doesn't differ from the previous screenshot sent into here, so I'll not post another screenshot this time. I'll resolve the open review above, please tell me what else needs to be changed.

@RedstoneDubstep
Copy link
Contributor Author

Hello, I've now resolved the merge conflicts with the 1.20.5 NeoForge changes and updated some code to make the MMDS work in 1.20.5 (the screen looks really cool with the main menu panorama background). Since Shadow's Network Refactor is now merged and there are (hopefully) no more major changes to the network architecture, I'd really like to know if/how to move forward with this PR. Since this PR does not introduce a breaking change, it doesn't need to be merged during the beta window, so if you have other priorities (which you probably do) those can always go first.

@Shadows-of-Fire Shadows-of-Fire self-requested a review May 7, 2024 19:45
@Shadows-of-Fire Shadows-of-Fire added last call Planned to be resolved by the end of the week, awaiting any last-minute comments 1.20.6 Targeted at Minecraft 1.20.6 labels May 17, 2024
@Shadows-of-Fire Shadows-of-Fire merged commit 4459a18 into neoforged:1.20.x May 28, 2024
4 checks passed
RedstoneDubstep added a commit to RedstoneDubstep/NeoForge that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20 Targeted at Minecraft 1.20 1.20.6 Targeted at Minecraft 1.20.6 enhancement New (or improvement to existing) feature or request last call Planned to be resolved by the end of the week, awaiting any last-minute comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants