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

Add a PLAYER_LEFT event #288

Merged

Conversation

ect0s
Copy link
Contributor

@ect0s ect0s commented Feb 17, 2023

In certain cases we do not match on Unetclosed or it is missing from the log, however channel seams to always be called

In certain cases we do not much Unetclosed or it is missing from the log, however channel seams to always be called
@ect0s ect0s linked an issue Feb 17, 2023 that may be closed by this pull request
@ect0s
Copy link
Contributor Author

ect0s commented Feb 17, 2023

Linking to player Left Event because this may fix the issue brought up there.

@ect0s ect0s added core bug Bug related to the core SquadJS API minor Minor Change labels Feb 17, 2023
@werewolfboy13 werewolfboy13 added the Testing Required This requires testing before approval. label Nov 1, 2023
@werewolfboy13
Copy link
Collaborator

PR needs testing to see if this is still valid.

@steelskillet
Copy link
Contributor

Have been using the regex change here for a long time on my squadjs and have had no issues. This is still valid.

@lbzepoqo
Copy link
Contributor

lbzepoqo commented Nov 1, 2023

There are parts of the code that is not always the case:

  • The regex expects the PC to be BP_PlayerController_C_[0-9]+, but some log lines have NULL as the PC.
  • The regex expects the owner to be BP_PlayerController_C_[0-9]+, but some log lines have SQJoinBeaconClient_[0-9]+ as the owner.
  • The regex assumes that the driver name is always GameNetDriver SteamNetDriver_[0-9]+, but this may not be true for all cases

I have sample lines here that says so:

[2023.10.08-04.51.11:883][565]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561199040002274:15000, Name: SteamNetConnection_2147480742, Driver: SteamNetDriver_2147481173 SteamNetDriver_2147481173, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480738, UniqueId: Steam:UNKNOWN [0x1100001405B78E2]

[2023.10.08-04.54.18:763][ 92]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198190408283:7787, Name: SteamNetConnection_2147481553, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147481549, Owner: BP_PlayerController_C_2147481549, UniqueId: Steam:UNKNOWN [0x11000010DB7B25B]

[2023.10.08-04.55.06:094][745]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198190408283:15000, Name: SteamNetConnection_2147480665, Driver: SteamNetDriver_2147481173 SteamNetDriver_2147481173, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480661, UniqueId: Steam:UNKNOWN [0x11000010DB7B25B]

[2023.10.08-04.55.10:188][888]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561199040002274:7787, Name: SteamNetConnection_2147480736, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147480732, Owner: BP_PlayerController_C_2147480732, UniqueId: Steam:UNKNOWN [0x1100001405B78E2]

[2023.10.08-07.18.21:751][948]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198179185811:15000, Name: SteamNetConnection_2147480021, Driver: SteamNetDriver_2147480488 SteamNetDriver_2147480488, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480017, UniqueId: Steam:UNKNOWN [0x11000010D0C7493]

[2023.10.08-07.21.44:684][ 36]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198179185811:7787, Name: SteamNetConnection_2147480015, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147480011, Owner: BP_PlayerController_C_2147480011, UniqueId: Steam:UNKNOWN [0x11000010D0C7493]

[2023.10.08-09.24.15:364][798]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198079899417:15000, Name: SteamNetConnection_2147479330, Driver: SteamNetDriver_2147479796 SteamNetDriver_2147479796, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147479326, UniqueId: Steam:UNKNOWN [0x110000107217719]

@steelskillet
Copy link
Contributor

steelskillet commented Nov 1, 2023

well i can tell you right now i am using the the regex provided to track player times based on log events for the player join and leave and have had no issues with extraneous leave events or missed leave events. while those other lines do seem to happen they are not associated with a player disconnecting from the server and/or a proper disconnect log line happened for that player at another time during the log, in which case we don't want to catch those events anyways.

I have been using this regex for 6 months now without issues.

If you believe otherwise i would advise some testing and real-world scenarios/examples that these log lines come from along with checking for similar log lines from those same events that do match the regex change.

@fantinodavide
Copy link
Contributor

There are parts of the code that is not always the case:

  • The regex expects the PC to be BP_PlayerController_C_[0-9]+, but some log lines have NULL as the PC.
  • The regex expects the owner to be BP_PlayerController_C_[0-9]+, but some log lines have SQJoinBeaconClient_[0-9]+ as the owner.
  • The regex assumes that the driver name is always GameNetDriver SteamNetDriver_[0-9]+, but this may not be true for all cases

I have sample lines here that says so:

[2023.10.08-04.51.11:883][565]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561199040002274:15000, Name: SteamNetConnection_2147480742, Driver: SteamNetDriver_2147481173 SteamNetDriver_2147481173, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480738, UniqueId: Steam:UNKNOWN [0x1100001405B78E2]

[2023.10.08-04.54.18:763][ 92]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198190408283:7787, Name: SteamNetConnection_2147481553, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147481549, Owner: BP_PlayerController_C_2147481549, UniqueId: Steam:UNKNOWN [0x11000010DB7B25B]

[2023.10.08-04.55.06:094][745]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198190408283:15000, Name: SteamNetConnection_2147480665, Driver: SteamNetDriver_2147481173 SteamNetDriver_2147481173, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480661, UniqueId: Steam:UNKNOWN [0x11000010DB7B25B]

[2023.10.08-04.55.10:188][888]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561199040002274:7787, Name: SteamNetConnection_2147480736, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147480732, Owner: BP_PlayerController_C_2147480732, UniqueId: Steam:UNKNOWN [0x1100001405B78E2]

[2023.10.08-07.18.21:751][948]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198179185811:15000, Name: SteamNetConnection_2147480021, Driver: SteamNetDriver_2147480488 SteamNetDriver_2147480488, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147480017, UniqueId: Steam:UNKNOWN [0x11000010D0C7493]

[2023.10.08-07.21.44:684][ 36]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198179185811:7787, Name: SteamNetConnection_2147480015, Driver: GameNetDriver SteamNetDriver_2147482548, IsServer: YES, PC: BP_PlayerController_C_2147480011, Owner: BP_PlayerController_C_2147480011, UniqueId: Steam:UNKNOWN [0x11000010D0C7493]

[2023.10.08-09.24.15:364][798]LogNet: UChannel::Close: Sending CloseBunch. ChIndex == 0. Name: [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 76561198079899417:15000, Name: SteamNetConnection_2147479330, Driver: SteamNetDriver_2147479796 SteamNetDriver_2147479796, IsServer: YES, PC: NULL, Owner: SQJoinBeaconClient_2147479326, UniqueId: Steam:UNKNOWN [0x110000107217719]

This is not exact, Squad isn't the best game to have clear and meaningful logs, and this is a good example.
Considering also the lines with PC set to NULL, or owner set to SQJoinBeaconClient_[0-9]+, or Driver with a different value than GameNetDriver SteamNetDriver_, would also match disconnections from queue, which is not the aim of this PR.

However, some mods use custom PlayerControllers, a better regex to match those would be [^ ]+PlayerController_C_[0-9]+, tested with GC and MEE mod so far.

Copy link
Contributor

@fantinodavide fantinodavide left a comment

Choose a reason for hiding this comment

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

Some mods use custom PlayerControllers, a better regex to match those would be [^ ]+PlayerController_C_[0-9]+, tested with GC and MEE mod so far.

@werewolfboy13 werewolfboy13 changed the title Fix Player-Disconnected Add a PLAYER_LEFT event Nov 2, 2023
@werewolfboy13 werewolfboy13 removed the Testing Required This requires testing before approval. label Nov 2, 2023
@magicoflolis
Copy link

Some mods use custom PlayerControllers, a better regex to match those would be [^ ]+PlayerController_C_[0-9]+, tested with GC and MEE mod so far.

[^ ]+PlayerController_C_\d+

Copy link
Contributor

@fantinodavide fantinodavide left a comment

Choose a reason for hiding this comment

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

looks good to me, this extends support to custom player controllers used by mods, even if it's not possible to guarantee it will match ALL the mods on the workshop due to the nature of a custom controller, which may not follow this naming convention.
Approved as the changes have been tested on custom player controllers used by GC and MEE mods.

@fantinodavide
Copy link
Contributor

Some mods use custom PlayerControllers, a better regex to match those would be [^ ]+PlayerController_C_[0-9]+, tested with GC and MEE mod so far.

[^ ]+PlayerController_C_\d+

This works too, and it's cleaner, a different way to write the same thing.

@fantinodavide
Copy link
Contributor

Some mods use custom PlayerControllers, a better regex to match those would be [^ ]+PlayerController_C_[0-9]+, tested with GC and MEE mod so far.

[^ ]+PlayerController_C_\d+

Are you able to test this change on Node 14 just to make sure? I'll do it tomorrow if you can't do it

@werewolfboy13 werewolfboy13 merged commit db364dd into Team-Silver-Sphere:master Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core bug Bug related to the core SquadJS API minor Minor Change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a PLAYER_LEFT event
6 participants