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

Expose client version information in non-debug builds #15708

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

rollerozxa
Copy link
Member

Closes #14151.

The client version information that has previously only been available in debug builds are now always available. Serialisation version and client status still remain behind the debug check.

To do

This PR is a Ready for Review.

How to test

e.g. worldedit //lua command in singleplayer:

//lua minetest.log(dump(core.get_player_information("singleplayer")))

doc/lua_api.md Outdated Show resolved Hide resolved
@sfan5 sfan5 added @ Script API Feature ✨ PRs that add or enhance a feature labels Jan 24, 2025
doc/lua_api.md Outdated Show resolved Hide resolved
doc/lua_api.md Outdated Show resolved Hide resolved
@SmallJoker SmallJoker added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Jan 27, 2025
@rollerozxa
Copy link
Member Author

The PR has been changed to only expose the version string field now.

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.

I'm fine with the PR in the current version (pun intended)

@appgurueu appgurueu added One approval ✅ ◻️ and removed Action / change needed Code still needs changes (PR) / more information requested (Issues) labels Jan 27, 2025
@sfan5
Copy link
Collaborator

sfan5 commented Feb 3, 2025

I think what we should do to further discourage doing version comparisons is to actually provide documentation on which protocol version maps to which engine version (or perhaps just link to networkprotocol.h?).
As it is now the docs tell you to use the protocol version but there isn't a single word on how.

@sfan5 sfan5 added this to the 5.11.0 milestone Feb 3, 2025
@sfan5
Copy link
Collaborator

sfan5 commented Feb 5, 2025

IRC:

17:21 		<luatic> "I think what we should do to further discourage doing version comparisons is to actually provide documentation on which protocol version maps to which engine version"
17:24 		<luatic> I recall the original suggestion also being the addition of APIs. Could a simple table that maps engine version names to protocol versions suffice? So modders could do something like client_proto_ver >= core.protocol_version["5.9"].
17:55 	sfan5 	@luatic: sure

@grorp grorp added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Feb 6, 2025
@appgurueu appgurueu removed the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Feb 8, 2025
@appgurueu
Copy link
Contributor

appgurueu commented Feb 8, 2025

I took the liberty to implement this. Is it fine now?

One minor question perhaps: We want core.protocol_versions to not contain patch versions, even if they entailed a protocol version bump, correct?

Copy link
Contributor

@y5nw y5nw left a comment

Choose a reason for hiding this comment

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

Makes sense.

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.

One minor question perhaps: We want core.protocol_versions to not contain patch versions, even if they entailed a protocol version bump, correct?

Hmm, I feel like it's inconsistent to leave a protocol version out just because it corresponds to a patch version. The reason to bump the protocol version for a patch version would be to make it detectable on the server, so leaving it out of the mechanism for making detection easier doesn't make sense. In builtin, one of the two cases where the protocol version is used for client feature detection is actually the 45/5.9.1 case.


-- The version information is provided by the client and may be spoofed
-- or inconsistent in engine forks. You must not use this for checking
-- feature availability of clients. Instead, do use the fields
Copy link
Member

Choose a reason for hiding this comment

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

could you make it explicit on core.features and core.has_feature above that they're for server-side feature detection? so we get a clear differentiation between server-side feature detection and client--side feature detection

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

Successfully merging this pull request may close these issues.

Expose MT version to get_player_information()
6 participants