r/valheim•
FFSnipe

Reducing lag - find a sweet spot before you build

discussion

One of the biggest things I read about is the lag and high instances in and around bases. I have some tips that might help, and an explanation of how the game-engine works.

Valheim maps are divided into 64 x 64 "tiles" or "sections". After some extensive testing, I have concluded multiple things.

  1. at any given time, 25 of these 64x64 sections will be fully loaded. The one you are standing in, and the surrounding 2 rings of sections.

  2. the max draw distance for player built things is 180 units. HOWEVER, objects are still loaded if they are within the confines of point number 1. (i dont know about non-player built things. trees seem to have a higher distance)

  3. even with the lowest draw-distance settings, those 25 sections will still load, they just dont render.

  4. every fish, bird, rock, tree, enemy, etc etc adds to the instance count. Fish seem to have a limit as to how many will spawn but I cannot be sure of this. (In the ocean my instances would drop when moving to a new grid but quickly rise to match the previous number, new fish spawning in to compensate.)

So picking your base location is very important.

Water doesnt really affect things since fish have a low max spawn. however, there are a plethora of rocks and logs underwater that you cannot get to to remove which can cause hundreds of instances that are permanent.

The most important thing is to limit your base to be completely within a small number of the map sections. I have my 2nd base limited to a single 64x64 section and there is absolutely no lag whatsoever. No pc hang when walking through the base while another section loads. just perfectly smooth.

The easiest way to find these sections is to turn the settings to their lowest and look at the ground texture. You should see the seams between sections. Pop open the info box (f2) and look at the instances. now cross that seam and watch the number magically change. This can cause major loading issues and stuttering while simply walking through a base.

my original base was built in 5 sections (dunno how i managed to do that). so the game was constantly loading and unloading over 20 extra zones as I traveled from one part of the base to another. major stutter to say the least.

Posted Mar 28, 2021, 11:24 PM UTC

10916
jordienormous•

This is extremely interesting. Thanks for all the due diligence. I'll try it next time I build.

17
FFSnipeOP:bow: Hunter•

finding the most barren, empty, large section of the ocean to test this in was the hardest part. got my instances down to about 30 (which i assume were just all fish)

9
PogoRed•

Interesting. My base isn't all that big, and doesn't have much terraforming done to it, and seems to get laggy in certain parts even though all the assets are obviously loaded. I'm have to try looking at the F2 info and see if those numbers jump when crossing certain parts.

7
FFSnipeOP:bow: Hunter•

even if there isnt a big difference in the number of instances in each area, it will still cause lag and hang when switching sections.

if you go from a section with 5k instances to one with 3k, it will still need to load the new and unload the old.

6
hearse223•

Very very good find, this will most certainly save a lot of headache for people.

Maybe a mod could be made to show the borders of sections rather than relying on janky seams.

3
Bowez•

what biome do you believe to be the best place to build? is the best idea to clear absolutely everything within a single 64x64 square and then each square that connects to it?

2
FFSnipeOP:bow: Hunter•

Plains. As much as I hate to say it cause the Fuling spawns can get annoying as hell especially at night, the plains seem to have the least number of instances.

The boulders are rather large and can be mined out, and the pillars can be popped completely. most plains areas have no trees or small rocks, and if you get lucky you can find an area pretty damn flat.

most people would say Meadows but good lord the number of rocks and trees in the meadows.... its a nightmare to clear out, believe me I have done a few large areas. plus, enemy spawns in the meadows are more frequent and more types. boar, deer, greydwarfs, necks, skeletons, fulings at endgame. plains has fulings, lox, and squitos.

edit:

yo thanks for that helpful award. i try my best.

edit 2:

actually if you wanna go to the extreme, go build in the deep north. find a nice flat 64x64 section and build on it. hell the number of instances up there is so low, you could actually build on several sections and it probably wouldnt be that bad.

11
[deleted]•

[deleted]

2
Spembleterry•

(Psst- Minecraft chunks are 16x16)

3
Nightmare1990•

Shit, you're right. I have been thwarted

2

The technical term is either chunk or page. Minecraft didn't invent the idea, just introduced it to a lot of people.

2
Throttle_Kitty•

I've come to a similar conclusion working on making large bases. My first base was... a disaster zone. Even having cleared 70% of the built structure from the area it lags horribly. There's a clear "seam" in the middle of the base that makes you lag spike really bad every time you walk through it.

My second is a lot better, but has a pretty steady stutter. I realized, I have a bunch of trees and stuff in the area! The FPs is worse on the side of the base near the trees. I've been clearing them and the FPS has been climbing. It takes... a long time to manually clear it out, every rock, bush, and tree.. but I can confirm, it works.

While I can't confirm any of your specific details myself, I can say that I've been applying this general method to building my last base, and it's allowed me to make a fairly large base with fairly stable FPS. Even with a decent amount of terrain editing in the area!

I also know enough to tell, I think I could do better with more exact understanding of how it works though!! Glad to see someone actually went through the effort to figure this stuff out!

2
FFSnipeOP:bow: Hunter•

every rock, bush, and tree..

the rocks man.... oh god the rocks. small rocks are just one mine and done. the bigger rocks are 5. and the boulders are such a pain in the ass cause they are sunken into the ground so far and take ages....

i would rather chop down 500 trees than 50 rocks.

1
Throttle_Kitty•

I already have the iron pick axe, and am a pretty patient person, so it's not to bad...

​

Anything that goes beneath the earth I leave though, since digging up the ground to get at it will cause more lag then removing the instance will... I THINK

2
FFSnipeOP:bow: Hunter•

you are correct. digging around a large rock to pop it will cause more instances than just leaving the rock there.

3
carmipa•

me and my base locking and look that I took something

​

https://www.twitch.tv/videos/967710543

0
PolarSage•

but i mena you should not really have to to through all this to play the game, hopefully the next update fixes things...

-3†