Realistic Terrain Generation

Realistic Terrain Generation

3M Downloads

Request for help: conflict with Galacticraft

radfast opened this issue ยท 7 comments

commented

Hi guys,
I'm one of the Galacticraft developers and we have a problem with RTG.
See here:
micdoodle8/Galacticraft#2175

Our relevant code is here

This code slowly, over about 50,000 ticks, builds up an internal (used by Galacticraft only) map of the world, mapping biomes and world height. The map covers a large area, around 16kx16k blocks, around spawn. It is used by Galacticraft for zoomed-out views of the world in the rocket launch sequence, and will have extended uses with future satellite mapping features in Galacticraft.

Our code reproduces vanilla Minecraft worldgen code. Our code causing the issue with RTG is getHeightMap(). That's intended to be an exact mirror, with some optimisations, of net.minecraft.world.gen.ChunkProviderGenerate.func_147424_a()

As far as I can see it, the specific problem is RTG is sometimes returning an array containing null biomes when WorldChunkManagerRTG.getBiomesForGeneration() is called. More generally RTG does not use an equivalent of net.minecraft.world.gen.ChunkProviderGenerate.func_147424_a() so I'm not sure this method even gives a valid height map when RTG is active, even if we ignore the null biomes.

What's the best way for us to get a heightmap out of RTG, here?

commented

Crickets are chirping in this issue. Seems to be resolved?

commented

By height map i assume you mean an array of the terrain heights at coordinates, pre decoration etc. No, using your getHeightMap will 100% certainly NOT return the correct heights, you would need to use some RTG functions that i am not certain exist in 1.7.10.

About the null biome arrays, we may have an idea for a fix that we are working on

commented

The best way, which would require some work on our part, would be for you to get a ChunkLandscape from ChunkProviderRTG, which has our height map. We'd have to do some work because it's all private right now. We might be able to write a func_147424_a() to cough up a height map.

Null biomes is some odd bug - does this happen with just Galacticraft and RTG?

commented

Thanks guys, much appreciated. Yes, I mean an array of the basic terrain heights pre decoration, the same as the vanilla Minecraft worldgen uses internally. In practice, this gives an "accurate enough" guide to terrain height for satellite mapping purposes - the key point being whether terrain is above or below height y=63, so we know whether to give it a water color. (We also lighten terrain at high elevation and use white for very high altitude where the game makes it snow - this preview may give you an idea.)

Preview

What I'm really looking to do is reproduce the heightmap generation from your 1.7.10 chunk generator, without calling the full chunk provider - so I don't want to create all the blocks in the world. Galacticraft runs mapping code in the background, generating a biome and height map for around 1 million chunks in around 1 hour after a server first starts, without creating noticeable server lag (it helps that players will not have huge complex bases in the 1 hour after a server first starts...). It would be too slow if we had to do the full chunk generation for 1 million chunks, and that would take too much disk space on the server.

What would really help me is if you can guide me through your code, the process used to generate the internal height map in your chunk gen. Or tell me what a func_147424_a() would consist of...

I'm not asking you guys to write fresh code, and I don't mind accessing private methods in your code, we often have to do this in Galacticraft for compatibility reasons. But right now I am not seeing how you produce the height map at all!


Null biomes is the crash reported to me. What's happening is this line is calling WorldChunkManagerRTG.getBiomesForGeneration() and that's returning an array including some null entries. When Galacticraft later iterates through that array, the NPE crash occurs. Note that the getBiomesForGeneration call there is mimicking what vanilla Minecraft does when it is generating a heightmap, see the vanilla func_147424_a().

For a list of other mods, see the crash report here. The guy reporting it has a large range of other mods, including Biomes o'Plenty, Twilight Forest, and a whole load I never heard of. Also FastCraft and Mantle.

I will try testing just GC and RTG.

But even apart from the null biomes issue, when I looked at your code, I saw that we are probably not getting out the heightmap properly - like @topisani said :) . If I get the heightmap properly, I probably don't need to worry any longer about the null biomes issue... :)

commented

I'm pretty sure anything using the height map would do better with the RTG height map.

commented

Thanks very much guys, I'll try it out.

If you override func_147424_a, then we can definitely use that, seems like a great solution from our perspective.

commented

@radfast I believe 1f1d7f2 resolved the null biomes issue in v1.0.1 (although we haven't tested all scenarios).

@Zeno410 Could we just use func_147424_a as an 'alias' and return RTG's height map? Or would that cause compatibility issues with other mods that need the vanilla height map?