remiX- / QualityCompany

MIT License
4 stars 0 forks source link

Allow to be fully client-sided #4

Closed throwitaway99 closed 6 months ago

throwitaway99 commented 7 months ago

Currently, as it stands, if you are using the mod you cannot join a host who lacks the mod - even after disabling all host related config options. If nothing else, this could perhaps be implemented with a networking toggle in config (akin to what is used in darmuhsTerminalStuff, which features a ModNetworking toggle in config to allow for fully client-sided use).

remiX- commented 7 months ago

Hey @throwitaway99,

I have added an experimental option for disabling networking via NetworkingEnabled in 1.2.2.

It is experimental as we did briefly test it and it should allow for joining hosts who do not have the mod, BUT any action / command that requires it will error out.

This will most likely be part of 1.3.0 as it will require some host/client testing with different scenarios and all :)

throwitaway99 commented 7 months ago

Hello @remiX-

I know it's currently experimental, but I thought I'd report a serious bug for the feature currently: if you disable networking, and host a game, you'll be unable to quit the match through the menu (I was forced to ALT+F4). However, if you are not the host, then you can quit normally (at least in my testing in LAN - though I tested the hosting part both online & in LAN with no other mods installed).

throwitaway99 commented 6 months ago

@remiX-

The issue seems to be deeper than I had tested initially. When disabling networking, if you join a host who lacks mod, upon making the ship leave the moon & return to orbit, the game will become soft-locked and nobody playing will be able to land the ship. The lever will be stuck on 'the ship is currently landing'. Unfortunately, this means, with networking disabled, that playing sessions isn't really possible, unless the host leaves & remakes the game every time the game auto-saves after the results screen.

remiX- commented 6 months ago

Hey @throwitaway99.

I have just released a v1.3.0 which should show up in 10-20 mins

I know it's currently experimental, but I thought I'd report a serious bug for the feature currently: if you disable networking, and host a game, you'll be unable to quit the match through the menu (I was forced to ALT+F4)

Lol yep, sorry XD! I only noticed this now (an hour ago as of this post) and hadn't checked this post as I've been quite busy :(

It was due to SaveGame triggering and trying to save file for the host but that won't occur with SaveFile being tied to the one Networking instance - this has been disabled now as of 1.3.0.

However, if you are not the host, then you can quit normally (at least in my testing in LAN - though I tested the hosting part both online & in LAN with no other mods installed).

Oh wow this is good to know, thanks! I've never thought of actually trying LAN for local testing... I'll start doing this.

The issue seems to be deeper than I had tested initially. When disabling networking, if you join a host who lacks mod, upon making the ship leave the moon & return to orbit, the game will become soft-locked and nobody playing will be able to land the ship. The lever will be stuck on 'the ship is currently landing'. Unfortunately, this means, with networking disabled, that playing sessions isn't really possible, unless the host leaves & remakes the game every time the game auto-saves after the results screen.

Hmm, this is interesting. Will test this tomorrow asap, thanks for the headsup. The initial tests I did with a friend we didn't even think of hitting the lever I think lol :/

If you get to try v1.3.0 let me know pls :D

throwitaway99 commented 6 months ago

Hello, @remiX- - I thought I'd add some more stuff I've learned through testing on the latest v1.3.0.

It appears that the quitting / soft-locked bugs are now completely fixed, which is awesome! However, I have some additional bugs / suggestions to offer based on my testing w/ networking disabled. For instance, the additional monitors do not seem to work properly, especially as a host. Here is what I have discovered (QC = QualityCompany, and GeneralImprovements = GI):

QC (while hosting) = LootCredits monitor displaying normally, Info monitor pitch black (however, with networking enabled, it seems to all work just fine - although the Info monitor seems to show me on Day 1 despite being on Day 23 (with 0 days left regarding quota), and I would perhaps like some clarification on what the 'Gained' value refers to)

QC + GI (while hosting) = both monitors pitch black (this seems to be the case even with networking disabled)

However, when not hosting (even if connected to a host who lacks the mod, which is how I tested), it seems that both combinations display the monitors - though the Info monitor will display 'Disabled', despite the Info monitor option being enabled. I presume it is not working because networking is disabled. If so, it would be nice if the Info monitor worked fully client-sided with networking disabled, since it is a really cool unparalleled monitor feature that GeneralImprovements does not offer. Speaking of GeneralImprovements, perhaps it would be good to look into how they implement these sorts of features, since I've noticed that they implement everything pretty seamlessly without the need for a network toggle for fully client-sided use, although of course this mod offers features that GeneralImprovements does not, so I don't know how feasible such an implementation would be.

remiX- commented 6 months ago

Thanks @throwitaway99

QC (while hosting) = LootCredits monitor displaying normally, Info monitor pitch black (however, with networking enabled, it seems to all work just fine - although the Info monitor seems to show me on Day 1 despite being on Day 23 (with 0 days left regarding quota), and I would perhaps like some clarification on what the 'Gained' value refers to)

Yep so the Info monitor when not at the company displays info about the current run - I should probably add this into the docs somewhere lol

On day: x - how many days into current quota Quota start: x - how much you started the current quota at (since last time selling and meeting quota) Gained: x - how much you have gained in the current quota (i.e. currentTotalLoot - quotaStart)

The issue is that this is saved via a file on the Hosts' side, and clients receive it for that save. Clients joining don't have 'their own save' so it would be a bit tricky as I am not sure on what the Client can use to uniquely identify the host's save etc - so I just marked it as 'disabled'.

image

The reason it's black in the beginning as nothing updates it in the beginning

QC + GI (while hosting) = both monitors pitch black (this seems to be the case even with networking disabled)

Will need to run with GI again myself. I've noticed when I have GI enabled sometimes QC monitors do not show at all, it could be timing related and how GI controls the monitors as it does have way more expansive monitor operations xD

We do (possibly) want to move away from the monitors and move into a separate HUD - at least for the 'InfoMonitor'. Loot & Time make sense in the ship but can have many conflicts as a lot of mods do that (I think).

However, when not hosting (even if connected to a host who lacks the mod, which is how I tested), it seems that both combinations display the monitors - though the Info monitor will display 'Disabled', despite the Info monitor option being enabled. I presume it is not working because networking is disabled.

Yep as per screenshot above, it uses a persistant file on the host's side for this. Will be a bit tricky to get this info on the clients side with networking disable / host not having the mod :( The initial intent behind 'InfoMonitor' was purely for selling but had no use when doing actual runs - so I had added some little info which was primarily QuotaStart and Gained to give it some life.

Let me know if you have any ideas on how we could make it work for clients with networking disable ^^

If so, it would be nice if the Info monitor worked fully client-sided with networking disabled, since it is a really cool unparalleled monitor feature that GeneralImprovements does not offer.

Are you talking about the InfoMonitor info during run or info @ company for selling needs? :)

Speaking of GeneralImprovements, perhaps it would be good to look into how they implement these sorts of features, since I've noticed that they implement everything pretty seamlessly without the need for a network toggle for fully client-sided use, although of course this mod offers features that GeneralImprovements does not, so I don't know how feasible such an implementation would be.

Will have another look at GI, I know they have a lot of monitor options in config so will see what they use - do they have a day saving?

throwitaway99 commented 6 months ago

Hello, @remiX-

Thank you for clarifying everything. I was a bit too quick with my testing, and I hadn't realized just how the InfoMonitor worked. I did more testing afterward and found that it seems to work perfectly (it was the selling part in particular that I liked). What I found odd, though, is that the behavior where the LootCredits and Info monitors are completely black w/ GeneralImprovements only seems to occur when hosting. If I am connected to another player that's hosting, then the monitors work perfectly. If you do end up switching to a HUD for the InfoMonitor, it would perhaps be nice to keep a config option to have it as a monitor for those who want it (hopefully with the bugs worked out), though a HUD that persists on-screen when at the company would be incredibly useful.

Also, I need some clarification: how exactly does the target work, at least when it comes to the 'needed' value? For instance, I am at the company building with a quota of 706, with 874 credits currently in possession. If I set the set the target to 874 (the exact amount of credits I have), it gives me a needed value of 706, which is exactly quota. If I set the target to 875 (so a single credit beyond what I already have), it gives me a needed value of 131. I find that this is rather confusing, and I do not know how it works.

remiX- commented 6 months ago

Hey @throwitaway99

Thank you for clarifying everything. I was a bit too quick with my testing, and I hadn't realized just how the InfoMonitor worked.

No problem haha :) And sorry, we haven't explained it at all anyway. This mod initially was just made for me and a couple of friends but then we thought we may as well make it available. The automated selling + target + overtime calculations are intended for quicker runs so you don't have to spend too much time @ The Company selling. Like when you reach 10k quota it takes forever to sell manually.

What I found odd, though, is that the behavior where the LootCredits and Info monitors are completely black w/ GeneralImprovements only seems to occur when hosting.

I can't get this to happen on my side :( What is your GI config setup as?

If you do end up switching to a HUD for the InfoMonitor, it would perhaps be nice to keep a config option to have it as a monitor for those who want it (hopefully with the bugs worked out), though a HUD that persists on-screen when at the company would be incredibly useful.

Yep we'd definitely keep an option to keep it as a Monitor :)

Also, I need some clarification: how exactly does the target work

Haha, I've made a note to explain this more. I'll also add an explanation upon setting target <amount> in the terminal.

If I set the target to 875 (so a single credit beyond what I already have), it gives me a needed value of 131. I find that this is rather confusing, and I do not know how it works.

Loool nice find! So this is a bug that we've never noticed. It seems to occur when target is above quota needed but you also have a lot of current credits in possession (we usually try to spend all after selling, so we usually never have any money to have noticed this XD) Offhand, the issue is most likely it's trying to calculate the needed amount but then subtracting how many credits you have currently. So it should be an easy fix: if needed < quota then needed = quota

EDIT nvm, it seems to be more complex than I thought. The calculations don't seem to take these into account correctly: * how much the group has sold already to the company in the "current session of selling" * how many credits the group currently has.

Will need to look into this more deeper xD

Can replicate this easily in my modding save with a much higher quota as well:

image

throwitaway99 commented 6 months ago

Hello @remiX-

I can't get this to happen on my side :( What is your GI config setup as?

I figured out how to reproduce the issue. With UseBetterMonitors set to true, and every ShipMonitor number filled out except for 3 & 4 (in this case, I tested by filling every empty monitor with ProfitQuota, and I left 3 & 4 blank for QC's LootCredits and Info monitors), you should be able to see that the LootCredits and Info monitors are pitch black when hosting. The GI config file is otherwise set to the defaults. Additionally, I had QC's Time monitor disabled. Here are the config files:

ShaosilGaming.GeneralImprovements.cfg.txt umno.QualityCompany.cfg.txt

remiX- commented 6 months ago

I have now added an explanation to the target when using it from the Terminal. Check it out when I do the next release 📦

A simple example is looking at very first quota:

In the end your current credits plus the calculated overtime should equal the desired target. ALTHOUGH, selling with > 0 days remaining seems to have the calculations off by 1 lol - due to the Company only buying at 33% / 77% (or whatever it is) value etc.

image

I figured out how to reproduce the issue. With UseBetterMonitors set to true, and every ShipMonitor number filled out except for 3 & 4 (in this case, I tested by filling every empty monitor with ProfitQuota, and I left 3 & 4 blank for QC's LootCredits and Info monitors), you should be able to see that the LootCredits and Info monitors are pitch black when hosting.

I'll have a look at this sometime, I had only tested without "UseBetterMonitors" disabled :D
GI is probably doing some hiding of existing monitors when spawning up the additional 4.

EDIT:

Ah okay, so it seems when using "UseBetterMonitors", GI completely scraps the assets and creates a whole new MonitorGroup.

You can see this in this screenshot, the MainContainer with HeaderText and qc_monitor_x are the 2 game monitors + QC monitors. Even though they are enabled, they are just completely invisible as GI hides the TextMeshProUGUI components on all.

The MonitorGroup is GI's "UseBetterMonitors" feature. So in essence, GI probably won't be compatibility with any Mod that does monitor things - unless they check if GI is a mod for the User and then try append to their groups.

image

If I manually go through the tree and enable the TextMeshProUGUI components on the 2 QC monitors, then they will pop back in.

image

remiX- commented 6 months ago

Letting this auto-complete after the PR as a lot has happened in this issue and a lot has come out of it, so thanks a bunch :D

It is quite interesting how we can solve the thing with GI disabling the text on non-GI owned monitors.

That said, I've released the latest 1.3.1 which should resolve a couple of the teething networking issues you brought up after 1.3.0.

Let me know if you still find anything strange :D This was all done with just me host and solo-testing so hopefully all is well!