Misunderstood-Wookiee / Mules-and-Warehouses-Extended

Compliation and Maintenace for the famous mule mods.
Creative Commons Attribution 4.0 International
12 stars 12 forks source link

[Potential Bug]: Supply Mules cause stuttering #76

Closed FormBurden closed 4 years ago

FormBurden commented 4 years ago

Hello again, So after quite a lot of rigorous testing, thinking it was some other mod, or TaterTrader, but sadly it was the Supply Mules. So what happens is flying around in a ship, like moving the screen (to pretty much cause screen tearing) around viciously, the game stutters. How it happens is if you have around 7+ ships, and the more ships you have the more frequent the stutters happen, plus if it matters I'm using Civilian Fleets. I would try to recreate this issue by manually doing each one without Civilian Fleets, but that would be tedious. I'll probably try tomorrow.

And essentially when I get rid of the fleet and remove all orders, the stuttering stops completely. I haven't tried the other Mules yet to see if they're effected as well. What I use the Supply Mules for is when I build a base and the supplies are needed, they go out and get them. And that's why I use like 7+. I have one with MxTrade 3 and MxTrade 2.

In a longer play through that had a LOT of stations and building a lot as well, I had probably a total of 25+ supply mules with MxTrade 2/3, and there were no stuttering at all from the previous update. So I think the cause is this current update you just released a few days ago.

Hopefully I gave enough details to recreate it on your end.

X4: 3.2 patch Mules Extended: Most current

I'll be continuing all sorts of different scenarios and probably the other mules too tomorrow. So I'll update accordingly.

Vectorial1024 commented 4 years ago

As a bit of extra information, to prevent stuttering when syncing orders, Civilian Fleets made it such that, when order sync occurs, for each sync pair (from ship + to ship), it waits a random time (from 0.1s to 5s) before actually doing the sync. This should help a bit when the trading/mining fleets get larger, when perhaps a commander has 50+ ships working under it with the same command, and that 50+ sync pairs would shop up when the commander invokes the order sync from their side.

Misunderstood-Wookiee commented 4 years ago

Strange I never had any screen tear like this before even when the supply mule was running the older less friendly code base.

On my current system I have a supply mule on two stations and half dozen trader mules and it doesn't seem to make performance any worse when I'm flying around maybe I'll re assigned the 40 or show regular auto trader's to supply between two stations in same sector and see if it does anything odd. I am also using Civilian Fleets.

What you're describing sounds like something else but what happens if you have no mules running at all does it go away?

On Sun, 7 Jun 2020, 6:17 pm Vincent Wong, notifications@github.com wrote:

As a bit of extra information, to prevent stuttering when syncing orders, Civilian Fleets made it such that, when order sync occurs, for each sync pair (from ship + to ship), it waits a random time (from 0.1s to 5s) before actually doing the sync. This should help a bit when the trading/mining fleets get larger, when perhaps a commander has 50+ ships working under it with the same command, and that 50+ sync pairs would shop up when the commander invokes the order sync from their side.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Misunderstood-Wookiee/Mules-and-Warehouses-Extended/issues/76#issuecomment-640176073, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFH3SZ33SKKWDAIR33QNELLRVNEKRANCNFSM4NW2WQ4A .

bhayden53 commented 4 years ago

@Vectorial1024 can you clarify, are you saying that there is a civ fleets issue that needs addressed still, or that we need to do something in mules?

bhayden53 commented 4 years ago

Also, worth noting that the timestamp when you opened this issue was prior to the civ fleets patch that supports the new supply mule params. Can you make sure civ fleets is up-to-date and test again?

FormBurden commented 4 years ago

Yes, when the Supply Mules are not doing their thing, the stuttering goes away. Like I said, the stuttering doesn't happen if I have a handful of Supply Mules running their thing, but as soon as around 7+ Supply Mules, whether idling or working, the stuttering starts.

FormBurden commented 4 years ago

Ah, I noticed he updated, I'll update and try to recreate.

FormBurden commented 4 years ago

No, it would seem the stuttering still happens even with the updated Civ Fleet. Like I said, I'm going to create a bunch of supply mules without being in a fleet to see if it is even a Civ Fleet thing. Stay tuned.

FormBurden commented 4 years ago

Hmm, after quite a bit of testing and different scenarios it would seem disbanding the fleet and re-building the fleet has fixed the issue. Possibly from the update to Civ Fleets that came out today. Yesterday I was doing the same: disbanding, and re-building fleet, and the stuttering would be the same.

Anyway, I'm now going to actually play the game instead of troubleshoot, so I'll see if I see any other issues at all as I play.

bhayden53 commented 4 years ago

Thanks, and sorry you spent so much time debugging.

FormBurden commented 4 years ago

Thanks, and sorry you spent so much time debugging.

No worries, I find it fun, it's teaching me a lot. Plus giving me some insight while I slowly learn coding and how this game works with the XML code.

FormBurden commented 4 years ago

So after some playing I noticed that the stutters are still there. So I did something different, I reverted back to your 6.0.3 and there are no stuttering at all. So it would seem that the issue is in 6.1. Not sure if any of you have been playing 6.1 and have noticed anything?

Anyway, for the time being I'll continue to use 6.0.3

If you need any kind of info from me, let me know.

bhayden53 commented 4 years ago

Is it still the case that it's happening when using a large civ fleet? Just need to know for trying to reproduce.

bhayden53 commented 4 years ago

I'm not really seeing any particularly bad performance with supply mules in 3.2 and 6.1.0. I have about 40 of them assigned to stations and 10 of them in a civ fleet assigned to a sector.

It could be that my CPU is better than yours. I will try building something into the library that evaluates trade offers, it's part of one of our tickets anyway.

bhayden53 commented 4 years ago

Also what max distance setting are you using? I personally never really go above 10.

Vectorial1024 commented 4 years ago

As a bit of clarification, what I meant some days ago was that the most performance heavy part of Civilian Fleets is at the order-syncing process, where potentially a lot of cues can be instantiated to handle the order syncing process. Other than that, the mod is pretty much non-existent. So, unless there is a very large civilian fleet we are talking about (e.g. 50+ members, which I am doing in my ongoing save), then it probably is not Civilian Fleet's problem.

This fact may be important in weaker computers, but if the computer in question can handle graphics smoothly then I guess the order-syncing pressure would not be much of a concern.

FormBurden commented 4 years ago

Hmm, I'll try doing the max distance lower than maxing it.

Computer is of no issue. Ryzen 7 2700x - Overclocked GTX 2080 Super 32GB of RAM

I'll download 6.1 again and try what you stated to see if I see anything.

bhayden53 commented 4 years ago

Generally speaking you should be evaluating the same number of trades in 6.0.3 as you are in 6.1.0, so the main difference is that we separated trade evaluation out into a different library and are now checking trade rules on every pair of offers. I don't know exactly which one of those might be causing the performance issue, or if it's somewhere else entirely.

Let me know what you find, I'm swamped with real work and not sure when I'll have the time and energy to get something into Dev that you could test for me.

Galaxy-Spam commented 4 years ago

How many player owned stations do you have? What did you set as max gate distance? Could you provide a screenshot of the supply mule options or a save?

FormBurden commented 4 years ago

OK, I have found the culprit.

I have troubleshooted every kind of possibility and scenario, re-installed my game, got a clean thing of my Mods. As well of going from vanilla game, with a select amount of mods, and adding on few by few to find the issue. Mostly to no avail. However, I have finally found the issue. https://www.nexusmods.com/x4foundations/mods/317

That mod right there, was the issue. And it had to do with Blacklists as well. On one of my main saves that I play, I was having the Scavenger faction blacklisted, mainly because I was using TaterTrader and didn't want to trade with their stations. Just wanted the cool mod I guess. Their stations were taking up a HUGE amount of trades. Anyway, I found out that TaterTrader doesn't have a blacklist for the mod since the blacklist is within the mod itself vs using the in-game blacklist method. Found that out, then gave up. But the blacklists in-game were still there.

Well, it turns out that in 3.1 and 3.2 beta 3 I think? or whatever before final release of the patch (on beta), everything worked. But when they released the patch, they changed something I guess (didn't find any patch notes for it), and it made the Scavenger Mod incompatible for some-type of things. Such as the Blacklists I think.

Anyway, I thought it was the logs that were the culprit, because right when a stutter happened, there was a log entry of something (police scan, trade complete, etc.), but as I was troubleshooting the log, I noticed some blacklists, and read what they were. Turns out whatever code that Scavenger had was still there, even after uninstalling the mod, so you have to delete the blacklists that I put the Scavengers in, and re-do the fleets. And from that, no Stuttering whatsoever. But this was with Faction Enhancer not there. Turns out FE was a culprit as well, just slightly. Doesn't have anything to do with the Blacklists, so I'm not sure. BUT, the stuttering with FE turns into a rare occasion now, instead of literally every 1-3 minutes. So that's good.

So, I think what's happening here, is something to do with how your Blacklists were doing their auto-thing with the in-game blacklist. And Scavenger being in the blacklists caused those issues. From above I did state that TaterTrader nothing happens, even with Civ Fleet. And that is because the blacklists are in the mod itself. I guess the author didn't code it to where they read the in-game blacklists. So that is why nothing happens when Tater is being used. But like I said, with the issues of Scavenger, and FE (now that it's a rare stutter), it does come from your mod. Scavenger was from the blacklists, but FE idk what causes the rare stutter now. When I was troubleshooting Scavenger, I didn't have FE installed at all. So no stutter whatsoever, when I figured out what was wrong with Scavenger. But When I installed FE and troubleshooted that so I could be sure it was not that, turns out FE still has some kind of conflict with your mod. I honestly can't troubleshoot what. However, FE is I think four mods, and I haven't troubleshooted which specific one is causing the issue. I'll do that later.

Damn, long post lol. The troubleshooting took like ten hours. I burned myself out of playing the game, and that is why I haven't replied in several days. But, I have found the issue, letting you know, will see which specific mod of FE is causing the rare stutters when using the Supply Mules.

Oh, and the settings that you told me to edit, with the stuttering gone (and when it was happening), had nothing to do with it. Everything works fine, no matter what settings I have. Was just that Scavenger mod causing ALL the issues.

Anyway, if you need more details on anything, even after this lengthy post. Let me know.

Galaxy-Spam commented 4 years ago

Since this seems to be a more complicated setup, can you provide a savegame?

Misunderstood-Wookiee commented 4 years ago

Can you test Mules with no other mods running and then maybe test with FE only? I am having trouble trying to figure out if this is a real thing as I cannot produce this on my end yet with a 3700X Ryzen and 3600mhz 32GB DDR4

I run FE and VRO, XR Skippack, etc But if I am going to test Mules for a bug I don't run some 20 other mods, I only run Mules and maybe Mules + FE + Civ Fleets just the bare-bones as its kinda pointless to test any mod for consistency if the methodology of your testing (adding more or fewer variables) changes per run as this throws the entire test out the window, as it could be any number of other variables changed.

Trust me I would fix this issue if I could replicate it but atm a couple of us cannot even replicate this and it would be more reliable to investigate if the testing on your end was done with as minimal of mods possible and not changing the variables too much between runs.

As yous said TaterTrader does not use vanilla blacklist calls they make their own blacklist overrides. so for all, I know this could be an issue with some other mod, or an issue with certain mods on your end causing delays in general (cpu lag)

or some bug with vanilla blacklist code that only happens under specific use cases in which case that is a thing we cannot fix.

bhayden53 commented 4 years ago

Having played modded games for many years, I feel the pain you went through with all of that testing.

FormBurden commented 4 years ago

Eh, it would seem there are other mods that are supposedly causing this conflict. Now it's quite rare like I stated earlier, but it's still there. Obviously the Scavenger mod caused a lot of issues due to whatever they changed in the game from the recent patch. Oh well, I decided not to look into it for now, possibly in the future when I have the stamina to kill myself with troubleshooting lol.

I personally think it's a 3.2 issue, like I said, the last beta version of 3.2 worked, but when they released it finally they must have changed something in the complete final version. Anyway, I guess it doesn't happen to everyone. Maybe it's specifically with my computer specs:

Windows 10 GTX 2080 Super 32GB of RAM Ryzen 2700x

Anyway, I've gotten past the stutter every once in a while, and just continuing playing the game. Might be a mod out of the 20 mods I have, but like I said, I'm dried out and am not looking into it for now. Plus I rather not play Vanilla since it sucks lol.

Anyway I'll close this for now until I decide to do more troubleshooting. But it definitely won't be for a while.