valheimPlus / ValheimPlus

A HarmonyX Mod aimed at improving the gameplay and quality of life of the game Valheim.
http://valheim.plus
GNU Affero General Public License v3.0
967 stars 236 forks source link

[BUG] Stuttering when near the base #765

Open WeaponsPrime opened 1 year ago

WeaponsPrime commented 1 year ago

Describe the bug When the detection distance is set to large values and the base is large (thousands of builds pieces), all of the automatic pulling features of Valheim+ seem to induce stuttering whenever I'm near. The intensity seems to scale with the total number of build pieces in the detection radius (rather than, say, number of containers).

To Reproduce Apparently:

  1. Have a relatively outdated PC.
  2. Build a large base.
  3. Enable automatic pulling with radius = 50 for the structures present.
  4. See intense stuttering.

Other mods Reproduced with only V+ installed.

Suspected source Judging by a cursory glance at the code, it seems that autopulling works via polling all of the nearby objects in cycle, without any attempts to cache the containers. Apparently, this is enough to cause problems when there are too many objects.

SSimp258 commented 1 year ago

You'll experience either stuttering or FPS drop if you have a lot of build pieces and automation. The big culprit is automation for exactly what you said. The only way to limit auto-fuel/deposit is to limit the range that it looks for chests so it doesn't look at all of them. Set the limit to around 2-3m and put a chest within that range. Your standard build piece is 1 x 1 m or the little single square floor piece. Changing how fast the production is done also causes the FPS drop because it's constantly looking for chests. Also, more than a couple hearths will also cause FPS drop. I also see you have older hardware while not the issue per se but it could be depending on how much video RAM your video card has. My old laptop was 9 years old but could still play Valheim but any more than 2 hearths and my FPS would drop considerably. My new laptop can handle up to like 5 hearths before i start seeing FPS drop. Anyway, all-in-all, you may need to cut back on the automation to prevent the stuttering you're experiencing.