PocketRelay / Client

Client for connecting to Pocket Relay servers
https://pocket-relay.pages.dev/
MIT License
5 stars 3 forks source link

Task: Offline enabler plugin #25

Closed jacobtread closed 5 months ago

jacobtread commented 11 months ago

Description

Currently, there is some code in the client side portion of the game (I don't know where) that triggers if you attempt to launch multiplayer when your internet is turned completely off (If you're still connected to a network regardless of it having internet then this wont appear). This is a problem because it means you cant play the game truly offline (Unless you use some hacky solution).

I've marked this issue as help wanted as working in the games code directly isn't super my field of expertise, so if anyone wants to pick this up and give it a shot you're welcome too.

image

I might give this a shot myself if I have a chance but anyone is welcome to attempt it

Mgamerz commented 11 months ago

There is a lot of checks in game code for online connectivity (non-native). The changes to package files (mostly Engine, SFXGame) would be not too hard. The class overrides in TestPatch would be fairly difficult because the modern tools don't work with testpatch as it's a weird package format.

However, most of our tools were never written for properly supporting replication. So these changes would probably break main online multiplayer. ME3 also suffers from package override of these files for popular mods.

jacobtread commented 11 months ago

Is these some shared piece of logic that all of those checks use in order to determine the connectivity. Possibly some native code; Something that could be included in a DLL patch to just always return a "I have internet" state?

I'd assume not all of the checks for connectivity are an issue since im sure a few of them check connectivity with the server not with the device? (I'd hope) So it would be just up to figuring out what checks are determining network connectivity through other means (Not connecting to the game server) and replacing those (ideally at a native level to keep mod compatibility)

levicki commented 10 months ago

The class overrides in TestPatch would be fairly difficult because the modern tools don't work with testpatch as it's a weird package format.

Not only that, but as it has been confirmed through testing with DamageNumbers mod (by STG_Mordin and burningcherry97), any game install with modified TestPatch files is banned from hosting a public match — you can join other public games, people can join your game in progress, but they won't be finding your lobby. This isn't a concern for people who want to play only offline of course but for anyone else who wants to have both abilities any messing with TestPatch would need to be undone when going back to official servers.

Is these some shared piece of logic that all of those checks use in order to determine the connectivity.

There could be.

You might want to open Engine.pcc using Legendary Explorer (part of ME3Tweaks Mod Manager) and look for classes OnlineSystemInterface and OnlineSubsystem which is using said interface.

However, I must admit I have no clue where the native code for that interface implementation is stored, @Mgamerz knows that way better than anyone else.

Mgamerz commented 10 months ago

They are not banned. I have modded MP for a decade. Newer tooling doesn't take into MP specific replication requirements which causes what unreal thinks is a game desync during the initial handshake. The older ways of modding that I used to do did not have this issue but they were also far more limited.

levicki commented 10 months ago

They are not banned. I have modded MP for a decade. Newer tooling doesn't take into MP specific replication requirements.

Not "banned" as in "banned account" but as in "people prevented from joining your public lobby unless there's a game in progress" — if you don't believe me just try installing tajfun403's Damage Numbers mod, try hosting a public game, and see if anyone joins you.

Both me and burningcherry97 had the same problem with that mod (and that mod only), hence the conclusion (assumption?) it is the TestPatch change causing it). Once you uninstall it, people will start joining your lobby again (sometimes it will take a couple of hours after removing it for your lobby to get back to normal).

I am not saying I know how that "ban" works, but it is happening.

Mgamerz commented 10 months ago

I can assure you that there is no bans. The game doesn't even have the capability to report that information to EA. What you saw is a game desync due to package guids. Clients are trying to join the games failing the handshake, and being rejected. As host you don't see it because the player never finished connecting.this is due to newer tooling not handling replication and improper guidcache setup.

We don't have tooling for these cause nobody modded MP but me, there was little benefit to spending the time making it.

On Wed, Jan 10, 2024, 7:49 AM Igor Levicki @.***> wrote:

They are not banned. I have modded MP for a decade. Newer tooling doesn't take into MP specific replication requirements.

Not "banned" as in "banned account" but as in "people prevented from joining your public lobby" — if you don't believe me just try installing tajfun403's Damage Numbers mod, try hosting a public game, and see if anyone joins you.

Both me and burningcherry97 had the same problem with that mod (and that mod only, hence the conclusion it is the TestPatch change causing it). Once you uninstall it, people will start joining your lobby again (sometimes it will take a couple of hours after removing it for your lobby to get back to normal).

I am not saying I know how it works, but it is happening.

— Reply to this email directly, view it on GitHub https://github.com/PocketRelay/Client/issues/25#issuecomment-1884993245, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU4VFHUSFJBFFMOPV6VID3YN2TALAVCNFSM6AAAAABAVZIG7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUHE4TGMRUGU . You are receiving this because you were mentioned.Message ID: @.***>

levicki commented 10 months ago

The game doesn't even have the capability to report that information to EA

So what you are saying is that these flags aren't used in matchmaking at all?

Class OnlineGameSettings extends Settings
    native;

// Variables
var const QWord ServerNonce;
var UniqueNetId OwningPlayerId;
var databinding string OwningPlayerName;
var databinding int NumPublicConnections;
var databinding int NumPrivateConnections;
var databinding int NumOpenPublicConnections;
var databinding int NumOpenPrivateConnections;
var databinding int PingInMs;
var databinding float MatchQuality;
var const int BuildUniqueId;
var databinding bool bShouldAdvertise; <<---
var databinding bool bIsLanMatch;
var databinding bool bUsesStats;
var databinding bool bAllowJoinInProgress;
var databinding bool bAllowInvites;
var databinding bool bUsesPresence;
var databinding bool bAllowJoinViaPresence;
var databinding bool bAllowJoinViaPresenceFriendsOnly;
var databinding bool bUsesArbitration;
var databinding bool bAntiCheatProtected; <<---
var const bool bWasFromInvite;
var databinding bool bIsDedicated;
var const bool bHasSkillUpdateInProgress;
var const databinding EOnlineGameState GameState;

//class default properties can be edited in the Properties tab for the class's Default__ object.
defaultproperties
{
    bShouldAdvertise = TRUE
    bUsesStats = TRUE
    bAllowJoinInProgress = TRUE
    bAllowInvites = TRUE
    bUsesPresence = TRUE
    bAllowJoinViaPresence = TRUE
}

What you saw is a game desync due to package guids. Clients are trying to join the games failing the handshake, and being rejected.

Why would there be a desync between two players using the same mod, which supposedly has the same package guids? We couldn't even join each other's public lobby when we both had the same mod file installed.

And how are those guids communicated between host and client if they can't be reported to matchmaking?

Not trying to argue, just to understand.

Mgamerz commented 10 months ago

Package guids being set wrong will always cause a desync because when the host asks a client to find a package it cannot because the guid was not set. The client will not report it has the file (it is more complicated than this) and the server will reject the connection.

Those are stock UE3 variables. Many of them are not used. This game doesn't even have anti cheat. Advertising is done in the blaze backend, not unreal.

On Wed, Jan 10, 2024, 8:10 AM Igor Levicki @.***> wrote:

The game doesn't even have the capability to report that information to EA

So what you are saying is that these flags aren't used in matchmaking at all?

Class OnlineGameSettings extends Settings native;

// Variables var const QWord ServerNonce; var UniqueNetId OwningPlayerId; var databinding string OwningPlayerName; var databinding int NumPublicConnections; var databinding int NumPrivateConnections; var databinding int NumOpenPublicConnections; var databinding int NumOpenPrivateConnections; var databinding int PingInMs; var databinding float MatchQuality; var const int BuildUniqueId; var databinding bool bShouldAdvertise; <<--- var databinding bool bIsLanMatch; var databinding bool bUsesStats; var databinding bool bAllowJoinInProgress; var databinding bool bAllowInvites; var databinding bool bUsesPresence; var databinding bool bAllowJoinViaPresence; var databinding bool bAllowJoinViaPresenceFriendsOnly; var databinding bool bUsesArbitration; var databinding bool bAntiCheatProtected; <<--- var const bool bWasFromInvite; var databinding bool bIsDedicated; var const bool bHasSkillUpdateInProgress; var const databinding EOnlineGameState GameState;

//class default properties can be edited in the Properties tab for the class's Default__ object. defaultproperties { bShouldAdvertise = TRUE bUsesStats = TRUE bAllowJoinInProgress = TRUE bAllowInvites = TRUE bUsesPresence = TRUE bAllowJoinViaPresence = TRUE }

What you saw is a game desync due to package guids. Clients are trying to join the games failing the handshake, and being rejected.

Why would there be a desync between two players using the same mod then which supposedly has same package guids? And how are those guids communicated between host and client if they can't be reported to matchmaking?

Not trying to argue, just to understand.

— Reply to this email directly, view it on GitHub https://github.com/PocketRelay/Client/issues/25#issuecomment-1885031846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU4VFBO3JLWB5FPN2UQ5PLYN2VQBAVCNFSM6AAAAABAVZIG7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGAZTCOBUGY . You are receiving this because you were mentioned.Message ID: @.***>

Mgamerz commented 10 months ago

As for how are guids communicated, the connection is initially opened via control messages in unreal. It challenges the client version, to which the client responds. The host then sends a list of guids and asks the client to find them and report what they have. Guids are set on package file headers and package exports as to unreal they are the same thing. So you have 20 files but 400 guids for example. Our tooling does not save these guids when porting content or making same named ones.

If the client is missing guids that the server sent to the client, connections will fail, they won't even get to the login step where the client actually begins to join the match. For redemption and rejection this issue was not resolved until I make a guide cache and updated it with the correct info. But I have no idea how that would work with testpatch as it is not really the same system as the rest of the game. It has a guidcache, but it may it may not be used.

On Wed, Jan 10, 2024, 8:10 AM Igor Levicki @.***> wrote:

The game doesn't even have the capability to report that information to EA

So what you are saying is that these flags aren't used in matchmaking at all?

Class OnlineGameSettings extends Settings native;

// Variables var const QWord ServerNonce; var UniqueNetId OwningPlayerId; var databinding string OwningPlayerName; var databinding int NumPublicConnections; var databinding int NumPrivateConnections; var databinding int NumOpenPublicConnections; var databinding int NumOpenPrivateConnections; var databinding int PingInMs; var databinding float MatchQuality; var const int BuildUniqueId; var databinding bool bShouldAdvertise; <<--- var databinding bool bIsLanMatch; var databinding bool bUsesStats; var databinding bool bAllowJoinInProgress; var databinding bool bAllowInvites; var databinding bool bUsesPresence; var databinding bool bAllowJoinViaPresence; var databinding bool bAllowJoinViaPresenceFriendsOnly; var databinding bool bUsesArbitration; var databinding bool bAntiCheatProtected; <<--- var const bool bWasFromInvite; var databinding bool bIsDedicated; var const bool bHasSkillUpdateInProgress; var const databinding EOnlineGameState GameState;

//class default properties can be edited in the Properties tab for the class's Default__ object. defaultproperties { bShouldAdvertise = TRUE bUsesStats = TRUE bAllowJoinInProgress = TRUE bAllowInvites = TRUE bUsesPresence = TRUE bAllowJoinViaPresence = TRUE }

What you saw is a game desync due to package guids. Clients are trying to join the games failing the handshake, and being rejected.

Why would there be a desync between two players using the same mod then which supposedly has same package guids? And how are those guids communicated between host and client if they can't be reported to matchmaking?

Not trying to argue, just to understand.

— Reply to this email directly, view it on GitHub https://github.com/PocketRelay/Client/issues/25#issuecomment-1885031846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU4VFBO3JLWB5FPN2UQ5PLYN2VQBAVCNFSM6AAAAABAVZIG7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGAZTCOBUGY . You are receiving this because you were mentioned.Message ID: @.***>

levicki commented 10 months ago

Thanks for the explanation.

However, that still doesn't answer the question — why two clients with the same mod file (and supposedly same GUIDs if they are saved in that file) can't connect to each other's public lobby but only to game in progress?

Also, what is the difference for GUID checking when connecting to lobby .vs. connecting to game in progress?

levicki commented 10 months ago

Advertising is done in the blaze backend, not unreal.

If by advertising you mean lobby advertising to other players by the matchmaking server (which is what I assumed that bool means, and it is very likely I am wrong on that), then setting it to FALSE would be the easy way for matchmaking server to flag that game lobby as practically invisible (i.e. until the match starts) if file changes are detected (though it still wouldn't explain how the server would know files were changed).

Mgamerz commented 10 months ago

Hosts and clients use different files lookups. It will work for the host but it will not work for the client if it is not properly set. Just because it has the same set of files does not mean it will know how to find it in the networked environment. This game is cooked seek free so the game uses guids to identity content over the network. And as stated before our tooling does not set this information so when you ask a client to find it, it never will.

The list of guids sent is what is currently loaded. Depending on what is changed those guids (packages) may not be loaded. For redemption my issues were the opposite, you could only join the lobby, not in progress because clients did not have proper guids for the new maps, but they had all of the data loaded in the lobby. Once you get past the initial join guids matter less (they are still used sometimes, mostly during map transition).

This isn't really on topic to this issue. When you request a hosted game you tell the matchmaking server you are making a new game. It responds with an onlinegamesettings object that represents your match on the server, and it is data bound to it. This is maintained by the matchmaking server and kept in sync on the clients (all 4 players). The implementation of the MMS is EA specific but this is mostly just standard UE3.

If testpatch modding didn't work modmaker would never be a thing. It edits a ton of files.

On Wed, Jan 10, 2024, 8:28 AM Igor Levicki @.***> wrote:

Thanks for the explanation.

However, that still doesn't answer the question — why two clients with the same mod file (and supposedly same GUIDs if they are saved in that file) can't connect to each other's public lobby but only to game in progress?

Also, what is the difference for GUID checking when connecting to lobby .vs. connecting to game in progress?

— Reply to this email directly, view it on GitHub https://github.com/PocketRelay/Client/issues/25#issuecomment-1885067286, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU4VFCWJPFTUC2EU6SVUY3YN2XTNAVCNFSM6AAAAABAVZIG7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGA3DOMRYGY . You are receiving this because you were mentioned.Message ID: @.***>

levicki commented 10 months ago

If testpatch modding didn't work modmaker would never be a thing. It edits a ton of files.

Sorry for the offtopic.

I didn't say testpatch modding doesn't work with your tooling or that it is impossible, just that it causes join problems for matchmaking. You know, one of the problems that PocketRelay is trying to address.

So basically, I was just warning that testpatch changes CAN affect PocketRelay too. The reason I singled out testpatch is because I never had problems with other mods that don't change it (shotgun delay thing for example).

Mgamerz commented 10 months ago

I don't think this issue is related to pocket relay. This issue is the game, not the matchmaking services.

On Wed, Jan 10, 2024, 8:49 AM Igor Levicki @.***> wrote:

If testpatch modding didn't work modmaker would never be a thing. It edits a ton of files.

Sorry for the offtopic.

I didn't say testpatch modding doesn't work with your tooling or that it is impossible, just that it causes join problems for matchmaking. You know, one of the problems that PocketRelay is trying to address.

So basically, I was just warning that testpatch changes CAN affect PocketRelay too.

— Reply to this email directly, view it on GitHub https://github.com/PocketRelay/Client/issues/25#issuecomment-1885116281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAU4VFGZLABFXKJATNLQHALYN22AXAVCNFSM6AAAAABAVZIG7WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBVGEYTMMRYGE . You are receiving this because you were mentioned.Message ID: @.***>

levicki commented 10 months ago

I don't think this issue is related to pocket relay.

It is in the sense that people would be unable to join PocketRelay hosted games with modified TestPatch so they would be reporting it to Jacob as a bug in PocketRelay.

jacobtread commented 10 months ago

It looks like HasLinkConnection in OnlineSystemInterface appears to be what is dealing with network being connected or not. Thanks @levicki

Edit: maybe not the KismetLogger doesn't seem to show any calls to that function

levicki commented 10 months ago

Edit: maybe not the KismetLogger doesn't seem to show any calls to that function

It must be there somewhere, check the UI classes, they use OnlineSystemInterface, maybe there's some other method used.

jacobtread commented 5 months ago

This doesn't seem to be an issue in the client plugin version, probabbly something to do with the extra hooking behavior I've got going on there to handle resolving the host always. Only an issue for the standalone version since it has to rely on the system hosts file so its probabbly hitting this internet check.

Have found the windows API that checks internet connectivity (Yeah no idea why I was looking in the game since it was probabbly native anyway, it was InternetGetConnectedState) have created a .asi plugin that hooks the function to allow using the standalone client completely offline https://github.com/PocketRelay/me3-offline-plugin