Faeryn / OutwardBetterInventory

GNU General Public License v3.0
0 stars 1 forks source link

Inventory lag #4

Open TikiMisala opened 1 year ago

TikiMisala commented 1 year ago

After a couple hours of playing, the game begins to lag when browsing through the inventory and this is extremely disruptive when in combat. A temporary fix I have found is to close the game and re-open it, though the lag comes back yet again after a few hours.

output_log.txt Outward Modlist.txt

Gousenfire commented 1 year ago

I'm also experiencing lag when hovering different items very fast. I got insane FPS drops like from 144 to 24

VanillaFiraga commented 1 year ago

Lag seems to be higher if there is more inventory. I rolled back to an older version and have less lag, but it's still squarely there.

Faeryn commented 1 year ago

We're investigating it on the mod discord, it can also be mod incompatibility or whatever other cause. In any case, I will optimize some things and see if that helps.

Gousenfire commented 1 year ago

I use the Shared Stashes mod, it is basically the only mod that messes with inventory as well. Here the full list:

VanillaFiraga commented 1 year ago

We're investigating it on the mod discord, it can also be mod incompatibility or whatever other cause. In any case, I will optimize some things and see if that helps.

Running this as the only mod + its dependencies. FPS drop from 124 FPS to 41 upon opening inventory with default settings on most recent patch. Mousing over objects, more than 1-5 also causes drop going from 41-42 fps down to 20-25. Hyper moving mouse gets down to 8fps.

More items in your inventory the slower it is. Brand new character gets 80fps in inventory with 10 items. Still a lag tho. I'm able to accomplish this with a near zero delay as well. Just loading a character and then viewing an inventory causes an issue. No extended playtime necessary.

Running game unmodded does not have issue. Edit: Running game with just Bepinex and localization extension has no issue.

Faeryn commented 1 year ago

It should be fixed with today's release.

Faupi commented 1 year ago

I'm experiencing said FPS drops as well (v1.2.6), as I'm the mule of items for our playthrough. The only way to circumvent it currently is by turning the price tags off whenever adventuring - I've looked into the code and I might have a good idea why it is, since UpdateValueDisplay is called on every frame, so maybe the best shot would be to have a similar check as the game already does for quantity to avoid unneeded updates? image I'm just throwing quick ideas, I'm not sure if I can find the time to look into it further, but it should be easily reproducible if you just grab the trade backpack and fill it up with as many random items as you can think of - generally the more ItemDisplays you have to update, the lower your FPS goes :p

VanillaFiraga commented 1 year ago

It should be fixed with today's release.

Personally speaking, it was absolutely fixed for me. Thank you.

Faeryn commented 1 year ago

I'm experiencing said FPS drops as well (v1.2.6), as I'm the mule of items for our playthrough. The only way to circumvent it currently is by turning the price tags off whenever adventuring - I've looked into the code and I might have a good idea why it is, since UpdateValueDisplay is called on every frame, so maybe the best shot would be to have a similar check as the game already does for quantity to avoid unneeded updates? image I'm just throwing quick ideas, I'm not sure if I can find the time to look into it further, but it should be easily reproducible if you just grab the trade backpack and fill it up with as many random items as you can think of - generally the more ItemDisplays you have to update, the lower your FPS goes :p

That is possibly because I'm doing object lookup (Transform.Find) in an Update loop which is basically horrible practice. The right way to do it is look it up upon component initialization and then store a reference to it. Except that is a bit more ... involved in mods, as you can't really add a new field, instead you have to use a weak hashtable which is.... basically I was hoping to get away with this. I guess I'm not getting away with this. I will optimize it!

Faupi commented 1 year ago

True, what I proposed is probably not possible due to the fact that the game itself is calling the update each frame. So off the top of my head, it's probably either about finding a way to cache that GameObject, wrapping the vanilla update to only happen when needed (which would have its own set of obstacles like changing quantity and locations), or possibly duplicating that price tag DisplayItem has as your own component and display it when the vanilla one isn't present (which also allows you to have the custom weight styling with possibly your own icon). I had a similar thing I've done like that for SPTarkov, if you want to look at it - granted it's using old Harmony and looks rather ugly. I could probably help with looking into this more, I'd just need to find time to set up a modding environment for Outward haha

Faeryn commented 1 year ago

True, what I proposed is probably not possible due to the fact that the game itself is calling the update each frame. So off the top of my head, it's probably either about finding a way to cache that GameObject, wrapping the vanilla update to only happen when needed (which would have its own set of obstacles like changing quantity and locations), or possibly duplicating that price tag DisplayItem has as your own component and display it when the vanilla one isn't present (which also allows you to have the custom weight styling with possibly your own icon). I had a similar thing I've done like that for SPTarkov, if you want to look at it - granted it's using old Harmony and looks rather ugly. I could probably help with looking into this more, I'd just need to find time to set up a modding environment for Outward haha

DW about it, it was more like I'm not actively modding or playing the game so I only implement requests. I also don't want to spend too much time on them, so might use stuff that is not optimal or perfect. Like I said - caching the reference in a weak hashtable is the usual way to go, I used this solution in my other mods too. As for my own icon... that needs to be actually made first, then SideLoader, etc. Again, too much work for something I'm not actively supporting. Ah also the best way to scare me is to offer help. :) That's like taking away half the fun! I enjoy these challenges and problems that modding often poses and I don't get at work.