-
Notifications
You must be signed in to change notification settings - Fork 12
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
Unreal2: Add extra server info parsing #145
Comments
As per node-gamedig's implementation: I think For the simplicity's sake (as I do not think we will have another game that will also report more fields here), we could just add them to the response (extra info) as
Disadvantages:
Another solution would be to always parse the
Disadvantages:
Thoughts about this? Got any other ideas going? |
2
I'm not sure how well this would work because we don't know how many u32 are before the string and the string is indistinguishable from u32s. I think the extended/killingfloor parsing works best given the remaining I do like the idea the idea of the game-specific impl of killing floor though: maybe I'm not sure the extended impl should be in The problem with game-specific impls here is that by doing so we restrict our ability to do detection of what kind of packet we get at parse time: the caller must know what kind of packet the server will return so they can decide which impl to call.
I do think that specifying what kind of query we want in GatherSettings is simpler than the node-implementation as it means we don't have to implement the server kind detection logic. However it does make our parser more strict than the node one: it would fail for servers that node would work for. I think a good way to do this would be:
enum Unreal2ExtraServerInfo {
Extended {
/* ... */
},
KillingFloor {
/* ... */
},
None,
}
pub struct Response {
pub server_info: ServerInfo,
pub mutators_and_rules: MutatorsAndRules,
pub players: Players,
pub extra_server_info: Unreal2ExtraServerInfo,
} Advantages:
Disadvantages:
I was thinking of doing a trait based impl of this in #148 but that has the same issue of game detection as here, so detection logic would be the same. |
What is this feature about?
Some games that use the unreal2 protocol include extra data at the end of the ServerInfo response. The node version detects this based on the rules/mutators response and goes back to parse the extra data.
We could do the same, or specify which game we are querying in GatheringSettings and decide whether to try to gather this data based on that.
Additional context/references
Node-gamedig implementation
The text was updated successfully, but these errors were encountered: