TIRTAGT / LCDirectLAN

LCDirectLAN is a mod for Lethal Company built around BepInEx that fixes and enhances LAN lobbies without interfering with the Steam-networked lobbies.
MIT License
5 stars 0 forks source link

Host not accept issue when after the first game #2

Closed CoolLKKPS closed 4 months ago

CoolLKKPS commented 4 months ago

image @TIRTAGT so this issue happen, i try to figure it out why, after the first game (no matter play the hole game or not), quit to main menu and create the game again, this happen using 127.0.0.1 and port 7777, no ipv6 listening (old released version) my Dark Hour Modpack code: 018dc3cd-5a10-cdc9-8616-0d9a3b1e4b26 Do not run 2 game programs in the same device, u might will encounter savefile corrupt

TIRTAGT commented 4 months ago

@TIRTAGT so this issue happen, i try to figure it out why, after the first game (no matter play the hole game or not), quit to main menu and create the game again, this happen using 127.0.0.1 and port 7777, no ipv6 listening (old released version), my Dark Hour Modpack code: 018db5f6-c8d3-c090-1da2-fcb97f6b6070

Thank you will try to test this, does this happen if you only have LCDirectLAN enabled too ?

I'm a bit worried that this may be because of MoreCompany that you have, they do not support LAN game and actually breaks joining capability when I'm playing with my community, ended up using BiggerLobby instead.

CoolLKKPS commented 4 months ago

Vanilla with this mod only doesn't have this issue, so that might be MoreCompany issue, recently they add a function to join LAN session using specified IP address, and can use MoreCompany via LAN

CoolLKKPS commented 4 months ago

https://github.com/notnotnotswipez/MoreCompany/issues/11

TIRTAGT commented 4 months ago

Vanilla with this mod only doesn't have this issue, so that might be MoreCompany issue, recently they add a function to join LAN session using specified IP address, and can use MoreCompany via LAN

It looks like I cannot even start the game using your ModPack, stuck on "Waiting for crew..." while TooManySuits are having an error party.

image

TooManySuits is spamming the log more or less about every frame making it hard to even read anything before it getting erased out: image

My log file after a few minutes of "lobby" gameplay had 146k lines 😮


I will try to disable anything except for LCDirectLAN and MoreCompany for testing.

It would also be great if you can provide me with "as little mod as possible to reproduce the issue"

CoolLKKPS commented 4 months ago

@TIRTAGT uh u might need to restart the game once, bc UI interface have something wrong i guess but, will test after a dinner

TIRTAGT commented 4 months ago

@TIRTAGT uh u might need to restart the game once, bc UI interface have something wrong i guess but, will test after a dinner

Tried restarting a few times already, didn't work but after disabling mods one-by-one it looks like the issue I experienced is because of Lethal Admin, specifically the Require Steam configuration.

After disabling that option or disabling Lethal Admin completely, I can start the game ("land the ship").

CoolLKKPS commented 4 months ago

oh i forgot to tell u... sry bc im used to turning that option off so i forgot to tell u, if turn on this option, u will got instantly kicked due no valid steam ID, and that's the reason why u will receive u been kicked that option is for anti-cheat, i installed many measure for anti-cheat in that modpack but that should be not the problem once u get in the game if u still encounter anti-cheat measure issues, disable Host Fixes and Lethal Admin

TIRTAGT commented 4 months ago

oh i forgot to tell u... sry bc im used to turning that option off so i forgot to tell u, if turn on this option, u will got instantly kicked due no valid steam ID, and that's the reason why u will receive u been kicked that option is for anti-cheat, i installed many measure for anti-cheat in that modpack but that should be not the problem once u get in the game if u still encounter anti-cheat measure issues, disable Host Fixes and Lethal Admin

To simplify the investigation process, can you try with as little mod as possible to reproduce the issue ? Because your ModPack contains a lot of mods that I'm not really sure where to start looking for incompatibility.

CoolLKKPS commented 4 months ago

To simplify the investigation process, can you try with as little mod as possible to reproduce the issue ? Because your ModPack contains a lot of mods that I'm not really sure where to start looking for incompatibility.

yes uh a, still working on it, give me an hour

TIRTAGT commented 4 months ago

To simplify the investigation process, can you try with as little mod as possible to reproduce the issue ? Because your ModPack contains a lot of mods that I'm not really sure where to start looking for incompatibility.

yes uh a, still working on it, give me an hour

Thank you, no rush.

Maybe try checking if the issue still exists with just LCDirectLAN + MoreCompany (without any other mods active), I cannot test further at the moment because of work stuff, but if the issue do still exist with just both mods active, then that makes it extremely easy for finding the incompatibility as it rules out any other mods in the ModPack.

TIRTAGT commented 4 months ago

@CoolLKKPS I saw your comment on your MoreCompany issue report, if you are simply looking a way to have a bigger lobby capacity (without Cosmetics and others stuff bundled together), LCDirectLAN have a great compatibility with BiggerLobby.

Hopefully in the future, the LCDirectLAN's Compatibility wiki will be populated with more mods to make it easier to find mods that will work just fine with LCDirectLAN.

So far, me and my community find BiggerLobby to be "it just works", and as a bonus it keeps the original/vanilla Lethal Company looks too.

CoolLKKPS commented 4 months ago

yea, i still testing, pretty sure this is not conflict with MoreCompany, i still try to find the conflict

CoolLKKPS commented 4 months ago

i almost got it, bear with me

CoolLKKPS commented 4 months ago

@TIRTAGT got it, conflict with this mod: https://github.com/NicholasScott1337/RuntimeNetcodeRPCValidator

TIRTAGT commented 4 months ago

@TIRTAGT got it, conflict with this mod: https://github.com/NicholasScott1337/RuntimeNetcodeRPCValidator

Aha, so the issue only seem to occur when you have LCDirectLAN + RuntimeNetcodeRPCValidator ? not related to MoreCompany ?

CoolLKKPS commented 4 months ago

Aha, so the issue only seem to occur when you have LCDirectLAN + RuntimeNetcodeRPCValidator ? not related to MoreCompany ?

yup, only Runtime_Netcode_Patcher

CoolLKKPS commented 4 months ago

still working on my modpack, so if u need me, u can call me again and uh im not sure where's gone wrong but uh, should i create an same issue in there?

TIRTAGT commented 4 months ago

RuntimeNetcodeRPCValidator

Nice thank you, will investigate later when I can :)

CoolLKKPS commented 4 months ago

and to make the things easier: host create a lobby, client join, host pull the lever, and after land the host quit to main menu, and host re-create a lobby, done

TIRTAGT commented 4 months ago

still working on my modpack, so if u need me, u can call me again and uh im not sure where's gone wrong but uh, should i create an same issue in there?

For now, I'd recommend not, because after looking through that mod's README, it is an API which if changed just to be compatible with LCDirectLAN may potentially break a LOT of other mods, which is actually against what LCDirectLAN is targeting.

We'd try to check if it is possible to make it compatible with LCDirectLAN, or if the issue is confirmed to be on their side then we ask them, this is because LCDirectLAN is not 10/10 perfect, in fact I only took a few days to learn Unity Game environments before starting this project lol

CoolLKKPS commented 4 months ago

haha ok, so i going to focus on my modpack now, let's go @TIRTAGT !

TIRTAGT commented 4 months ago

and to make the things easier: host create a lobby, client join, host pull the lever, and after land the host quit to main menu, and host re-create a lobby, done

So basically after the host ~rage-~ quitted the lobby while another client is in, and then trying to host a new lobby, anyone trying to join the new lobby get "The host was not accepting connections" ?

Just to confirm, are you testing with Allow Remote Connection or Local options ? Because I will need to be able to reproduce the problem, basically find the problem and start experimenting why that problem exists in the first place.

I actually have some theory that the problem is because I had [ServerRpc] and [ClientRpc] in LCDirectLAN's RPC, those aren't needed because LCDirectLAN directly manages data transport on its own, but I left it there so I remember which code is Server side and which code is Client side, haha.

CoolLKKPS commented 4 months ago

uh im running 2 clients in the same desktop, so after the ship landed, i just do normal quit to menu, previously i just trying to find compatibility but, yea... this happen, re-create a lobby in LAN mode still, and let the client try to rejoin, and error, no matter Allow Remote Connection is on or off

CoolLKKPS commented 4 months ago

and that take a lot the time to fix compatibility issue, and now i know that modpack have huge issues, can cause savefile corrupt and weather de-sync, and many more... my g...

TIRTAGT commented 4 months ago

uh im running 2 clients in the same desktop, so after the ship landed, i just do normal quit to menu, previously i just trying to find compatibility but, yea... this happen, re-create a lobby in LAN mode still, and let the client try to rejoin, and error, no matter Allow Remote Connection is on or off

Thank you for the information, that will really help when I finally have the time to investigate (which hopefully is soon)

CoolLKKPS commented 4 months ago

Thank you for the information, that will really help when I finally have the time to investigate (which hopefully is soon)

np also enjoy with that >;)

TIRTAGT commented 4 months ago

and that take a lot the time to fix compatibility issue, and now i know that modpack have huge issues, can cause savefile corrupt and weather de-sync, and many more... my g...

Yeah unfortunately when combining a lot of mods, you will eventually find 2 or more mods that will modify/patch a game function. The problem is not because that they modify/patch those functions, but how they modify it.

I've seen some that tries to modify the game's code directly, or even replace the entire function, while sometimes this is required for them to work, doing this may introduce a lot of issues on other mods that didn't expect that change.

LCDirectLAN actually is designed like that at my first try since I just want it to be done as fast as possible and didn't even plan to publish it to the world, but I'm glad I spend more time finding another way to achieve what I want with modifying minimum game code as possible. A bit surprised that after adding LCDirectLAN to my community modpack, "it just works".

So hopefully for other people that uses LCDirectLAN, the usage experience is the same as what I experienced.

CoolLKKPS commented 4 months ago

I've heard about some issues in the game itself, where what the code tells u doesn't equate to what it actually is, so i can completely understand why u will think about that, pretty sure we need some people create major mod like PAYDAY 2 "The Fixes" to fix many game issues, so we can base on that code and tools to create more good stuff without need to think too much

Edit: Oh, and FNF, FNF PsychEngine, PsychEngine is not only a mod

CoolLKKPS commented 4 months ago

anyway, thx for ur mod! really, this mod will keep in my modpack for a long time, as long as it still working, even i know still have something can improve like link 3rd-party account for ID verify, but that doesn't really matter for now

TIRTAGT commented 4 months ago

I have made some progress ruling out the incompatibility, because even after several testing with only LCDirectLAN + Runtime Netcode Patcher, the issue didn't happen but running your setup (imported in r2modman-Plus using your code) does reproduce the issue.

So at least I know that one (or a combination) of the mods included in your modpack is causing the incompatibility, will continue ruling out and then testing later because the BepInEx console is still pretty crowded with a lot of mods, even the log file is constantly spammed with text.

CoolLKKPS commented 4 months ago

...... its More Emotes, uhhhhhhhhhhhhhh, got to sleep now............

Edit: if u can reach that mod dev, tell him update that mod asap, if using AutoTranslator plugin to translate that mod, that can cause keybind won't able to change; that mod also conflict with network things... wow........

TIRTAGT commented 4 months ago

I'm still investigating the issue, that is a bit weird because More Emotes doesn't seem to modify the approval connection at all.

So, I guess it's not, but nothing can be proven yet, a few mods more to go.... image

I also need to check the BepInEx/patchers in case something you added in the mod pack are using direct patchers, and that patchers breaks the approval connection.

CoolLKKPS commented 4 months ago

uh maybe... i really tired, maybe tomorrow

TIRTAGT commented 4 months ago

uh maybe... i really tired, maybe tomorrow

Yup no worries, I'll try investigating the issue. So far it looks like a combination of mods, but I'm trying to narrow down the list further to make it easy for me.

TIRTAGT commented 4 months ago

Found some interesting code that might be cause of the problem, located in BetterLobby, will try to mess with the code a little and see if removing that specific code actually fixes the problem, lol.


I didn't believe that actually worked, let me try adding that BetterLobby code back and see if the issue returns... Performing sanity check to see if I'm on a dream or removing that interesting line of code actually fixed this issue.....

CoolLKKPS commented 4 months ago

Found some interesting code that might be cause of the problem, located in BetterLobby, will try to mess with the code a little and see if removing that specific code actually fixes the problem, lol.

I didn't believe that actually worked, let me try adding that BetterLobby code back and see if the issue returns... Performing sanity check to see if I'm on a dream or removing that interesting line of code actually fixed this issue.....

ok will have a look, starting to update my modpack >:)

TIRTAGT commented 4 months ago

Looks like that fix is confirmed, the problem is because of this patch in BetterLobby:

[HarmonyPatch(typeof(StartOfRound), nameof(StartOfRound.OnDisable))]
[HarmonyPostfix]
static void DisconnectOnDisable()
{
    GameNetworkManager.Instance.Disconnect(); // weeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
}

^I like the fact the code that causes this issue have "weee..." as a comment, I replied with "reee...." in my head


Description of why is that patch breaking LCDirectLAN (and actually the game too)

^atleast on LAN since there's a few extra functions on steam mode that I didn't bother to check....

The Disconnect() temporarily forbids any player to join by setting disallowConnection variable to true, since if the host is trying to disconnect anyone, new players shouldn't join which makes sense.

After the host lobby has been closed/disabled, that variable is set to false so the next lobby the host created will accept connections like usual....

But it looks like due to bad timing, BetterLobby called Disconnect() after GameNetworkManager is already disconnected (the game also calls Disconnect() on its own), the function crashes:

[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
RuntimeNetcodeRPCValidator.NetcodeValidator.NetworkManagerShutdown () (at <0df0f351a5d94cbb9af1af6290fbdcfa>:0)
RuntimeNetcodeRPCValidator.Plugin.OnNetworkManagerShutdown () (at <0df0f351a5d94cbb9af1af6290fbdcfa>:0)
(wrapper dynamic-method) Unity.Netcode.NetworkManager.DMD<Unity.Netcode.NetworkManager::Shutdown>(Unity.Netcode.NetworkManager,bool)
GameNetworkManager+<DisconnectProcess>d__74.MoveNext () (at <af9b1eec498a45aebd42601d6ab85015>:0)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <e27997765c1848b09d8073e5d642717a>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
GameNetworkManager:Disconnect()
Better_Lobbies.Patches.LobbyConnectionFixes:DisconnectOnDisable() (at C:/Users/vispy/source/repos/Better Lobbies/Patches/LobbyConnectionFixes.cs:55)
StartOfRound:DMD<StartOfRound::OnDisable>(StartOfRound)

^looks like the stack trace also leaked the original development path, unlocked a new fear of accidentally revealing my local storage path in a C# stack trace.

so now, the value is not reset, but stays at true, and it affects all lobbies the host will create since GameNetworkManager is re-used, which is why there is a value reset to make sure it's ready for the next lobby.


The way I fixed it (only for my side while testing)

I'm not sure if I can send the compiled DLL here for you to test as I don't think that'd be nice...

Probably it's a good idea if you open an issue on their repository for this incompatibility to be fixed, feel free to reference to this issue which definitely will save some time debugging on their end too!


Additional notes

This can be fixed in LCDirectLAN as additional patches, however I refuse to do it, because if I force to override the disallowConnection variable to be always false, there is a high chance that a conflict may arise in the future if the game changes or another mod controls it.

And personally, I'd like to keep LCDirectLAN as that mod who does not override things that isn't required :)

CoolLKKPS commented 4 months ago

@TIRTAGT i sug don't patch that in ur repository, i will quote this issue and create an issue in there, or u can create a pull request in there really

TIRTAGT commented 4 months ago

@TIRTAGT i sug don't patch that in ur repository, i will quote this issue and create an issue in there, or u can create a pull request in there really

Correct, I didn't feel I should do anything at that variable to avoid further conflicts down the line haha, LCDirectLAN should stay the way it is this time. :)

For a pull request, I'm not really sure I'd like to submit "deleted a few lines" XD. I'd recommend you to open up an issue on their side and quote this issue instead :)

CoolLKKPS commented 4 months ago

ok done >:)

CoolLKKPS commented 4 months ago

weeeeeeeeeeeee

TIRTAGT commented 4 months ago

Thank you for your helping me narrow down the issue, you pointed out RPCs and that's where I started checking all patches injected to the game related to networking, that allows me to skip through a lot of mods in your ModPack that didn't directly deal with the in-game networking stuffs.


Thanks for the Thunderstore profile code too, I accidentally toggled the ship door in orbit while finding the issue, I wasn't expected to see the awesome scenery.

Also, IPv6 support in official release is coming soon, the desync issues have been fixed, just need to fix my logic for designing HideRawJoinData and technically LCDirectLAN should be ready for an update (that isn't compatible with the older version because a lot have been changed....)

CoolLKKPS commented 4 months ago

haha enjoy my modpack! (but a few difficult) "assets great great assets to the company, assets great great great assets to the company" oh and ice cream lol >;D

CoolLKKPS commented 4 months ago

those mods that allow u to see the scenery in orbit, if u really like that

  1. SpaceSunShine, https://thunderstore.io/c/lethal-company/p/CatsArmy/SpaceSunShine
  2. SpaceShipDoor, https://thunderstore.io/c/lethal-company/p/Wolf11221/SpaceShipDoor
  3. ShipWindows, https://thunderstore.io/c/lethal-company/p/veri/ShipWindows
VisualError commented 4 months ago

looks like the stack trace also leaked the original development path, unlocked a new fear of accidentally revealing my local storage path in a C# stack trace.

Lol all fine! This can only happen if you ever include your pdb file in your Plugin or if you have an embedded pdb file inside your dll. This is located here in VS. image

CoolLKKPS commented 4 months ago

Lol all fine! This can only happen if you ever include your pdb file in your Plugin or if you have an embedded pdb file inside your dll. This is located here in VS.

yeeeeeeeeeee >;)

TIRTAGT commented 4 months ago

those mods that allow u to see the scenery in orbit, if u really like that

  1. SpaceSunShine, https://thunderstore.io/c/lethal-company/p/CatsArmy/SpaceSunShine
  2. SpaceShipDoor, https://thunderstore.io/c/lethal-company/p/Wolf11221/SpaceShipDoor
  3. ShipWindows, https://thunderstore.io/c/lethal-company/p/veri/ShipWindows

Thank you, definitely will bundle that to for my community mod pack haha !

TIRTAGT commented 4 months ago

looks like the stack trace also leaked the original development path, unlocked a new fear of accidentally revealing my local storage path in a C# stack trace.

Lol all fine! This can only happen if you ever include your pdb file in your Plugin or if you have an embedded pdb file inside your dll. This is located here in VS.

Ah I see, I disabled Debug Symbols entirely for the release variant.