Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

River code organization

Zeno410 opened this issue ยท 8 comments

commented

Right now the rivers are created with a complex system where both the biome and the chunk provider have to cooperate to make acceptable rivers. In river areas, the chunk provider always slaps down a river and if the nearby terrain is too high you can get some really ugly banks. Also the biome can't really control the shape and character of the banks, or suppress a river entirely, because the chunk provider drastically alters the banks and always puts down the river.

I think this responsibility should go entirely to the biome. So as not to have to rewrite every one of several hundred terrain routines, my idea is to have the chunk manage call a rErodedNoise routine in RealisticBiomeBase instead of the rNoise routine. The default behavior for rErodedNoise will be to call rNoise and then apply the river transformation, so every biome will work as it does now initially. However, it will be possible for a biome to override rErodedNoise for its own bank shapes or to completely turn off rivers.

I plan to turn off rivers for some mountain biomes, which will create some tendency for rivers to flow "mountains to the sea". This probably wouldn't include any vanilla biomes, but I've got some Highlands biomes which I think would be better off with no rivers.

Eventually we can do lakes in rErodedNoise although that may be a while. Lakes are basically the same problem as rivers and I think would be benefitted by doing them that way. It's possible we can combine the river and (future) lake noises into one function and cut down on the net work although a lot of terrain routines will still need to be modified (to take out the old way of doing lakes)

commented

I'm a little out of my depth with noise in general, but +1 for implementing rErodedNoise as described in the OP. It would be great if biomes had the ability to disable rivers and customize their banks, and from a practical implementation perspective, having rErodedNoise call rNoise initially feels like a good strategy.

As for lakes... another +1 from me. If this could somehow be used as a replacement for the vanilla water surface lakes (WorldGenLakes), that would be a bonus because the current WorldGenLakes wreak havoc on surface decorations (floating trees, etc.), and they're also quite ugly in my opinion, looking more like small ditches filled with water. We would still post a PopulateChunkEvent.Populate.EventType.LAKE event for mods that might need it, but RTG's default behaviour could be to cancel the event in favour of generating more beautiful and non-destructive surface lakes via rErodedNoise.

commented

@Zeno410 Is this still work-in-progress? I know you've implemented this in quite a lot of biomes, so just wondering how much is left to do.

commented

Yes, still work-in-progress. I'm struggling with issues about how wide the rivers and lakes should be. There's a painful tradeoff between excessively wide rivers and lakes squashing terrain in huge areas and excessively narrow ones creating hideous river banks. I've tried normalizing to (0,1) and multipliers, without success so far. I actually have my private version ripped apart right now generating fake terrain from the river noise rather than the actual terrain.

commented

I just made a change to the banks in my private. There's two stages; it's just a matter of balancing them. The problem has been that the river banks are steeper than the lake shores so I haven't been able to get them both balanced. But I have plans.

commented

Ooh, this is basically done! I just have some tweaking on the banks and I'll close it.

commented

I was going to ask you about the banks actually... what is it that you're going to be working on? Cuz I was thinking they could do with some surfacing, but that might be a project of its own.

commented

Yes, this is done - there's a system, it at least mostly works, and it's been going for weeks. If there's some bug or inadequacy it should probably be a new issue.

commented

I think we can close this one, unless you're still tweaking?