Idea for optimization

Is Valheim coming

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!

Source: https://www.reddit.com/r/valheim/comments/1778j50/idea_for_optimization/

leave a comment

Your email address will not be published. Required fields are marked *