Team-Silver-Sphere / SquadJS

Squad Server Script Framework
Boost Software License 1.0
166 stars 125 forks source link

Add a PLAYER_LEFT event #288

Closed ect0s closed 1 year ago

ect0s commented 1 year ago

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

ect0s commented 1 year ago

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

werewolfboy13 commented 1 year ago

PR needs testing to see if this is still valid.

steelskillet commented 1 year ago

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

lbzepoqo commented 1 year ago

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

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 commented 1 year ago

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 commented 1 year ago

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.

magicoflolis commented 1 year ago

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+

fantinodavide commented 1 year ago

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 commented 1 year ago

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