-
Notifications
You must be signed in to change notification settings - Fork 146
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
[WIP] feat: UE3 LAN query support #638
base: master
Are you sure you want to change the base?
Conversation
-1 for putting non-standard query output into the main object. all of that should be in raw, or else it becomes part of the promised standard which is impossible to maintain cross-game. |
Thanks for your feedback.
That's applicable in a sec. Good to know.
If the game-entry (in games.js) corresponds to a client, isn't it the same game ID then, or am I missing something? By looking at Minecraft how it is set up, each entry would require a different client to connect to a given game ID (same with GTA 5 what I can see). Whereas with UT3, you are still bound to the game, same client, same connection method even when having the subsystem. Both response data (for
In various tests the LAN servers for UT3 didn't respond to unicast query. That was/is the goal of this feature. Currently, my testing server running on localhost responds to a unicast using the same subsystem with the option Adding support for discovery was just a small change (7b16301). The only critical change in that would be the non-standard response by receiving 1:n server responses. I likely split the settings-resolver part from this pull request since that can be an additional one. How I can continue changing some bits of the PR? |
Having two game entries for the same game, like The pro of having two GameIDs is that it’s more visible for the user that there are two different approaches for the game. Which means when user setup gamedig and seeing the gamelist they don‘t have to look deep into the documentation or notes. Con is that, at least for me, it would be more „clean“ to handle. Having one gameID and a sub parameter makes more sense. On different games are multiple parameters necessary as well, like nadeo with Userlogin. |
Same opinion as @mmorrisontx, but to extend some stuff:
Hope I got your question right, #608 would benefit from exactly what you describe but introducing something like
Strongly agreed, #484 is similar to this, and it would be something separated from the query api.
For now at least, this could be written in the protocol implementation (or let that be a base protocol). |
… protocol for generic logic Core protocol now has three methods run, prepareRun and finishRun (+ createState and populateState) for custom handling of multi responses on a single (broadcast) query. Changes: ======== Query/Core - User-Options are prioritized over any default/game/protocol options - New method core:updateOptionsDefaults(..), passed with final options to core/protocol to handle given options before the protocol runs - Added core:getOptionsDefaults(outOptions) to provide default options per protocol - Added core:getOptionsOverrides(outOptions) to provide overriding options per protocol - New method core:prepareRun() to run before core:run(state) - New method core:finishRun() to run after core:run(state) - New method core:createState(), for custom handling of creating initial state - New method core:finishState(), for custom handling of finishing the state - New method core:populateState(), for populate the state with queried data (moved from core:run() - Method "setupOptions" to handle build up options list ( New Core protocol for LAN-protocols - Defaults address to 255.255.255.255 - Defaults givenPortOnly to true - Enables broadcast mode based on resolved/given address UnrealEngine3/LAN protocol: Provides basic functionality of parsing UE3 LAN packets send over UDP broadcast - LAN query data does not contain player data - UE3 UDP packet definition is compatible to most UE3 based games, some newer engines support Steam which adds an additional 4-byte value (see packetVersion) - Games can be added by providing packetVersion and gameUniqueId (+ port, see config for [IpDrv.OnlineGameInterfaceImpl] and property LanAnnouncePort) - Some games are using the same LAN port and unique game id (such as UDK SDK or Toxikk), these games need to be differentiated on consuming client) UT3 LAN protocol: - Added query port to be 14001, and sets specific query options for a proper LAN (broadcast) query - Sets packetVersion to 5, and gameUniqueId to 0x4D5707DB Reader: - Added method to read 8-bit double values - Added peek parameter for reader:remaining(..) to check if the reader can read the additional data
/** | ||
* Returns the remaining byte array from the current position | ||
* @returns the remaining bytes | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate a lot the addition of docs comments, but they should come in a separate PR to this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate a lot the addition of docs comments, but they should come in a separate PR to this one.
Right. I was just using that logic specifically and just added the JSDoc comment.
2185b4e
to
1365535
Compare
I've rebased the pull request's source branch as I reduced the complexity, based on the given feedback
I reply to some of your messages. The current codebase for this PR has changed a bit so you guys may need to review the changes. It is still not fully tested with additional games LAN query. tl;dr The current PR will result into such queries:
(1) I thought about that a bit. There is some smaller issue with that regarding providing the data. Even by knowing the server's IP (on a LAN environment), the single query can lead to (receiving multiple or) just a single random respone since you query the IP using the "LanAnnouncePort" which is shared across any instance on the same system. (from the same game). A LAN setup where a single machine would host several instances of the same game (if supported) could be the norm.
It was opt-in. Out of interest, could you elaborate what could be considered breaking? All existing protocol wouldn't be affected. That subsystem logic could be seen as a set of properties, specified on a game level, to be ready to use. For convience it was auto-resolving the subsystem (when set) to a given protocol, which could be seen as breaking.
I see what you guys mean by splitting any Discovery API from Query, but having a setup like mentioned in (1), the query would be incomplete since you cannot specifiy a single system on such LAN setup. That would require various filter options (like only responding to given ports). All game instance (of UT3, and various UE3 games) use the same "query" port. Since the single query call and response for the LAN protocol is the same with having gamedig being set as broadcast, I would guess query would fit for getting data from LAN servers. When using the unicast address for a network address/machine which may have/run multiple servers, you won't receive additional ones, only one random (although it seems to be the first one bound to the port). So the goal of this PR i basically fixing the query of single IP:Port on a local network. The discovery of instances on another network address could be seen as bonus 😁 I had breaking changes in mind that's the reason of But at the end I might not see the broad system to actualy judge how breaking a change could be. 🙃 |
And that is one of the reason that there is the need of a check if the received Package is from the server you query. Querying ingame uses the same system, the gameclient sends the broadcast to the beacon Port. Imagine the following scenario:
Of course the server should sends two times, but it could be an timing issue and GameDig will receive a Answer Package from a different gameserver, or even of a different game if the unique LANID is different 😐 |
The initiated query/lookup by a game or GameDig will only receive-and-process the response(s) meant for each specific client instance (for UE3). That's what the nonce is for which is not static but generated for each client (UE3 engine wide and in this PR). node-gamedig/protocols/unrealengine3lan.js Lines 32 to 33 in 2ce6690
node-gamedig/protocols/unrealengine3lan.js Lines 283 to 287 in 2ce6690
Receiving responses from different games than expecting (due to the games having wrongly used game ids) isn't a problem of Gamedig, the broadcast or the current UDP broadcast implementation of this PR. |
It isn't a breaking change in the sense that the existing protocols wouldn't be affected, but rather than how all the games are currently being handled by some users, for example Homepage selects their game solely by the GID, introducing this in v5 would leave some entries in being unreachable by them (although this could be solved by also adding GIDs for these?). |
This will add support for querying LAN servers for UE3 based games as issued by #631. But before merging this pull request, I like to support respectively work on another game, like Toxikk and/or Renegade X.
This request has also various changes which might be be revised/checked. This pull request should be compatbile to all other protocols, but as the core is changed, it's a slightly critical change.
Additional related issues: #629 #628
By default the LAN query will provide the same structure as a (master/online) server does. However as the query provider is different with a LAN query the data is limited and will not provide any player data.
There is an additional settings resolver in
patterns/ue3pattern.js
which currently holds the structure defined by UT3 and allows parsing the data in a more structured way and also providing being able to customize any given payload/pattern by a simple JSON passed as parameter (WIP).A setup for a query looks like this (for now) + some options for configuring the output:
An example response with the options
usePattern: true
andoutputAsArray: true
:Warning
Outdated json response. See here for an updated https://gist.github.com/RattleSN4K3/55958bfc0639c4ce2347f5298cd70c6a
The UnrealEngine3 protocol will serialize all provided data. Most of that data is also provided with a master/online query.
Note
Some changes are removed due to a rebase of this PR.
Changes:
Code
Protocols are now imported and re-exported inprotocols/index.js
for better maintainabilitySubsystem protocols are searched by appending it to the giventype
with some common delimiters ($
,_
,:
or nothing) which should be compliant to naming rulecore:run
to provide overloadingQuery/Core
subsystemoptionscore:updateOptionsDefaults(..)
, passed with final options to core/protocol to handle given options before the protocol runscore:getOptionsDefaults(outOptions)
to provide default options per protocolcore:getOptionsOverrides(outOptions)
to provide overriding options per protocolcore:prepareRun()
to run beforecore:run(state)
core:finishRun()
to run aftercore:run(state)
core:createState()
, for custom handling of creating initial statecore:finishState()
, for custom handling of finishing the statecore:populateState()
, for populate the state with queried data (moved from core:run()setupOptions(..)
to handle building up options list (should not be overloaded)New Core protocol for LAN-protocols
address
to255.255.255.255
givenPortOnly
totrue
UnrealEngine3/LAN protocol:
Provides basic functionality of parsing UE3 LAN packets send over UDP broadcast
packetVersion
andgameUniqueId
(+port
, see config for [IpDrv.OnlineGameInterfaceImpl] and property LanAnnouncePort)UT3 LAN protocol:
packetVersion
to5
, andgameUniqueId
to0x4D5707DB
Reader:
double()
)peek
parameter forreader:remaining(..)
to check if the reader can read the additional data