Categories: GuidesValheim

Idea for optimization

im no coding pro i just had this idea after looking into the way valheim loads instances

It seems like it calculates structural stability whenever you enter an area with instances, and recalculates it whenever you move or break a piece. I feel this system, while good, could be better.

For starters, rather than calculating stability of a previously existing structure every time you enter an area, maybe the stability could be saved to the actual world upon saving, or after the buidling isn't touched for a while. That way when entering an area with a large amount of instances, the cpu has that much less work to do.

Secondly, the way it calculates stability actively could play off of this. The game already knows how stable the structure is, so rather than calculating EVERY piece over and over again when placing new ones, it sees the stability of an already "hard saved" piece, and calculates pieces attatched to it accordingly. This way the game is only actively calculating the stability of new pieces being placed.

Lastly, this might allow pieces that are unseen by the player to be culled out. Take for instance a large, solid cube of stone. The game renders, calculates, and loads EVERY stone brick within that cube, because it has to calculate the stability accurately. By saving the stability to the hard drive and having it be part of the world file, the game already knows the structure is stable, and how stable it is. The game also knows that the pieces underneath are there, but doesn't "pull" that information out unless it needs to, further saving on cpu usage.

Again, im no developer, but i like looking into how games work and function, and the way valheim does this seems counterintuitive, especially considering how bad performance gets in large builds. It's possible this idea sounds completely stupid too, but thats okay, I'd rather say it and have it work than be scared of sounding dumb lol

EDIT: Valheim heard my cries! Thank you Irongate!

Gamer

Share
Published by
Gamer

Recent Posts

Ledx have been so hard for me this wipe

Not being able to craft them sucks. Especially when everyone I talk to about it…

5 months ago

My interesting and unfortunate Gwent life

First I'd like to say I absolutely love this game it's quality. Basically I first…

5 months ago

Teacher Tuesday 12/Dec/2023 – ask your questions here!

Welcome to Teacher Tuesday, a thread where anyone can ask any type of question without…

5 months ago

This games balance is confusing

I’m kind of new/returning to gwent I played beta and obviously it’s a lot lot…

5 months ago

Summary of 10 Days of Draws from Chaffee’s Bundles

Level 1 Bag (Free with Atmosphere Level 2) 6 small consumable (First Aid, Repair, Fire…

5 months ago

Why is my crew at 135%?

Here's my crew - T34-85M - for the life of me I cant figure out…

5 months ago