Valheim

Valheim

Majorita Nov 12, 2023 @ 4:39am
Why Is The World Pre-Generated?
So today I learned that Valheim's gameworld is not fully randomized, there's a pre-baked heightmap that is the world and when you generate a new world, you get a chunk of that to call your own.

My question is: why? I would love to hear from a developer.
< >
Showing 76-89 of 89 comments
Majorita Nov 19, 2023 @ 2:54am 
Originally posted by Shealladh:
Just comes down to the Floating Point Accuracy and the size of the stored unit.
Hence when a lot of people noticed this was when Kerbal distance issue started as you moved out from the Origin.

Oh wow, so are you saying that this is just like a Unity limitation?
Last edited by Majorita; Nov 19, 2023 @ 2:54am
Shealladh Nov 19, 2023 @ 3:14am 
Originally posted by Majorita:
Originally posted by Shealladh:
Just comes down to the Floating Point Accuracy and the size of the stored unit.
Hence when a lot of people noticed this was when Kerbal distance issue started as you moved out from the Origin.

Oh wow, so are you saying that this is just like a Unity limitation?
It's maths programming issue.

To quote Dave Newson's site :

Read Here [davenewson.com]

http://davenewson.com/posts/2013/unity-coordinates-and-scales.html

Floating Point Accuracy

Unity allows you to place objects anywhere within the limitations of the float-based coordinate system. The limitation for the X, Y and Z Position Transform is 7 significant digits, with a decimal place anywhere within those 7 digits; in effect you could place an object at 12345.67 or 12.34567, for just two examples.

With this system, the further away from the origin (0.000000 - absolute zero) you get, the more floating-point precision you lose. For example, accepting that one unit (1u) equals one meter (1m), an object at 1.234567 has a floating point accuracy to 6 decimal places (a micrometer), while an object at 76543.21 can only have two decimal places (a centimeter), and is thus less accurate.

The degradation of accuracy as you get further away from the origin becomes an obvious problem when you want to work at a small scale. If you wanted to move an object positioned at 765432.1 by 0.01 (one centimeter), you wouldn't be able to as that level of accuracy doesn't exist that far away from the origin.

This may not seem like a huge problem, but this issue of losing floating point accuracy at greater distances is the reason you start to see things like camera jitter and inaccurate physics when you stray too far from the origin. Most games try to keep things reasonably close to the origin to avoid these problems.

As posted in the answer here [stackoverflow.com];

https://stackoverflow.com/questions/49752582/unity-coordinate-limitations-and-its-impact

Unity suggests: not recommended to go any further than 100,000 units away from the center, the editor will warn you. If you notice in today's gaming world, many games move the world around the player rather than the player around the world.
Last edited by Shealladh; Nov 19, 2023 @ 3:16am
magnificent moose Nov 19, 2023 @ 8:00am 
Floating point accuracy has nothing to do with this. Valheim world disc is 10 kilometers in diameter iirc which is big enough for this game. The issue is not the size of the world. The issue is that the world generator recycles a tiny prebaked heighmap for every possible map that can exist, as many people have said in this thread. There is no Unity limitation that would necessitate this. They could randomize the heightmap just fine as far as I can tell. So its an open question why the game was designed this way.
Last edited by magnificent moose; Nov 19, 2023 @ 8:02am
Quintium Nov 19, 2023 @ 11:03am 
Originally posted by magnificent moose:
Floating point accuracy has nothing to do with this. Valheim world disc is 10 kilometers in diameter iirc which is big enough for this game. The issue is not the size of the world. The issue is that the world generator recycles a tiny prebaked heighmap for every possible map that can exist, as many people have said in this thread. There is no Unity limitation that would necessitate this. They could randomize the heightmap just fine as far as I can tell. So its an open question why the game was designed this way.

They use Perlin Noise with a different math algorithm per biome. The seed is used for random offsets in those algorithms.
Perlin noise is known to having problem the larger the offset, why 10000 is a good mark to stop.

Want a walk-through, check out this series of tutorial videos (using Unity): Procedural Landmass Generation
Last edited by Quintium; Nov 19, 2023 @ 11:13am
muchdebate Nov 19, 2023 @ 12:29pm 
Originally posted by SushiJaguar:
Not sure if anyone already said it, but the reason why continents are exceedingly rare in the generation .

Wait - what? I play in three worlds (my world a friend's world and another friend's world) and all three have plenty of continents; in all three total landmass far exceeds watermass.
magnificent moose Nov 19, 2023 @ 1:56pm 
Originally posted by Quintium:
They use Perlin Noise with a different math algorithm per biome. The seed is used for random offsets in those algorithms.
Perlin noise is known to having problem the larger the offset, why 10000 is a good mark to stop.

Want a walk-through, check out this series of tutorial videos (using Unity): Procedural Landmass Generation
Sebastian Lague is awesome, I've watched those videos and I've also implemented different landmass generators myself. Something occurred to me now however. I have no experience with Unity. All this time I have been blindly assuming that you can provide a seed value for Unity's Perlin noise generator. Googling it now and it turns out its possible that they actually do NOT support a seed value at all?

This is pretty crazy to me, but if this is true then I start to understand why the total landmass is so small. If you can't provide a seed then all you can do is offset the sampling locations to get a different result. This is indeed what Dvoid seems to have done. Also in this scenario it is plausible that the quality starts to degrade if you sample too far from the origin.

They should have used a custom noise function that can be seeded instead if this is true. Its 10 lines of code or something. I guess its too late now, we literally have a hundred million savegames out there that all depend on the built-in noise function. Oh well. At least this design decision starts to make some sense to me now, assuming this speculation turns out to be correct.
Quintium Nov 19, 2023 @ 3:06pm 
Originally posted by magnificent moose:
Googling it now and it turns out its possible that they actually do NOT support a seed value at all?

Offset is random from seed to get a delta x and delta y value.
Then they loop for x and y coordinate values, add/multiply depending on algorithm used the offsets and other values (Mathf.PerlinNoise(generated_x * preset_floats, generated_y * preset_floats) * (more Perlin noise calculation)). It is more involved than Sebastian Lague's example for a base height map, but still similar concept. Then biome heightmaps are more Perlin noise with different add/multipliers for offsets and coordinates as well.
In the end, a lot of games use Perlin noise. There are other ways of course (NMS is a mixture, including Perlin noise. Is a YT video explaining it), but if they start with Perlin noise, then they likely won't change. But as they have mentioned Ashlands will be differently calculated than it used to, hence why you should start a new map. Or at least hope the zones around Ashland wasn't calculated if you got near enough (as soon a new zone if generated, it stays like that in the world save "database" (binary) file.
But it is Early Access, nothing stops them from changing. In the end, I think Valheim does an excellent work on generation. And I feel OP is just yelling foul for no good reasons.
magnificent moose Nov 19, 2023 @ 5:19pm 
Originally posted by Quintium:
But it is Early Access, nothing stops them from changing. In the end, I think Valheim does an excellent work on generation. And I feel OP is just yelling foul for no good reasons.
Nothing except the 20 million gamers whose savefiles just broke XD

When Mistlands was introduced they changed the terrain generation a little bit. They tried to patch people's saves but if you were unlucky and you had built near the old Mistlands your buildings might have collapsed because the ground was not where it used to be etc. If they made a total change of terrain gen everything would burn in flames. Feels like they won't be able to do a drastic change at this point.

Valheim's world gen is pretty decent, no disagreement there. Not sure if I would have ever noticed the fact that the landmass is recycled between most seeds, had someone not mentioned it in the Discord. Its not a huge issue for sure, but it is a little disappointing that the world is not unique when you start a new game. Millions of people have seen the same islands and continents (albeit with different biome distribution). Depending on how much you have explored maybe you have too. Not game breaking or anything, just a little unfortunate.
Quintium Nov 19, 2023 @ 10:27pm 
Originally posted by magnificent moose:
Originally posted by Quintium:
But it is Early Access, nothing stops them from changing. In the end, I think Valheim does an excellent work on generation. And I feel OP is just yelling foul for no good reasons.
Nothing except the 20 million gamers whose savefiles just broke XD

When Mistlands was introduced they changed the terrain generation a little bit. They tried to patch people's saves but if you were unlucky and you had built near the old Mistlands your buildings might have collapsed because the ground was not where it used to be etc. If they made a total change of terrain gen everything would burn in flames. Feels like they won't be able to do a drastic change at this point.

Valheim's world gen is pretty decent, no disagreement there. Not sure if I would have ever noticed the fact that the landmass is recycled between most seeds, had someone not mentioned it in the Discord. Its not a huge issue for sure, but it is a little disappointing that the world is not unique when you start a new game. Millions of people have seen the same islands and continents (albeit with different biome distribution). Depending on how much you have explored maybe you have too. Not game breaking or anything, just a little unfortunate.

Well, on the Ashland world recreation, it really is Early Access and people should read what it means. Things can change. Other games have wipes a lot of times, due to those reasons. I think Iron Gate has been nice for a long time already. It had to be expected that a "wipe" would have to happen. Especially those that have explored the whole world already. There it is harder to know what to "wipe' and what not. Either way, some people will get mad no matter what

And the recycled, well. Yeah, but you can also see that in other games. Hell, Starfield is hugely disappointing in how much they recycle.
In the end, I think people shouldn't focus on that. Is the game fun? Yes. Is it re-playable? In those cases, maybe take breaks, so it doesn't feel so obvious :)

Making games is hard.
Mharr Nov 21, 2023 @ 2:17am 
We know from modding efforts that it's possible to overwrite an entire world with a hand crafted heightmap, and that in itself doesn't make the save particularly large. So it's not impossible to add other layers of generation to the existing system without breaking what came before.
ostlandr Nov 21, 2023 @ 3:56am 
Originally posted by Faceplant8:
Seems like this is another case of learning a bit too much about how the sausage is made.

I've played over 3000 hours and never noticed anything related to this. If you don't know about it (and even if you do and ignore it), I can't imagine this really makes any difference. The only way this makes a difference to me is that I have a couple of very tall mountains that I've found, and it's a little disappointing that they might not be entirely random.

What bugs me much more are the fine details that are all the same. Pretty much everything is made up of a few models with very little variation. I know, for example, that if I want to sleep in one of the small towers in black forest, I can clear the interior, put my bed against the back wall, a fire next to the door, with both sheltered even in a rainstorm. The rocks, trees, pretty much everything is cookie-cutter.

I understand why the game is made this way. Good random generation is not an easy problem. For what the game is, I think it's a reasonable balance.

The original German quote is "People who love laws and sausages shouldn't watch either one being made."
ostlandr Nov 21, 2023 @ 4:21am 
Funny- I get so into the visuals that I sometimes just stop to stare across a newly discovered canyon or fjord, or watch the virtual sunset, or the moonrise over the Black Forest. And that's at 1080p at medium-low settings. (When you've been PC gaming since the mid-90s, 1080p is still amazing.)

TL/DR: However it's done, it works for me.

This is where I feel DLC is appropriate. The number of different random buildings or unique rocks doesn't affect gameplay. Not worth it to Coffee Stain or Iron Gate to pay devs to create those. But there have been over 12 million copies of Valheim sold. If a million players want more models, then at $4.99 or so, that's ~$4 million in possible revenue.

I also play a game called "Railroads Online!". When you're laying track bed, the skin/pattern repeats. There just happens to be this one distinctive kidney-shaped rock right in the center of the skin. Players love this rock. To lay track on the roadbed smoothly, just plop the spline points on said kidney-shaped rock, and the tracks are both tidy and centered on the roadbed. Praise the kidney-shaped rock!
Majorita Nov 21, 2023 @ 7:17am 
The game is still in early access which means this is actually exactly the right time for them to continue develop the game... that's the entire point of early access.

That's the entire point of constructive criticism. So we can tell them what we want improved and then they can do it.
blprice61 Nov 21, 2023 @ 8:18am 
While I'm not sure that I care whether or not they have a more 'random' model for generation, I'm pretty sure that there are quite a few people out there who would be really upset if the maps they've spent hundreds or even thousands of hours building on became incompatible with a new format.
< >
Showing 76-89 of 89 comments
Per page: 1530 50

Date Posted: Nov 12, 2023 @ 4:39am
Posts: 89