Jump to content

[1.7.2] How do you spawn big veins


ianno1993

Recommended Posts

You're going to want to write your own gen code rather than using WorldGenMinable, especially since WorldGenMinable is not very optimized for use with large veins. Not only that, but keep in mind that Minecraft's generation code is handled chunk by chunk, and a chunk is only 16x16 blocks in area. If you try to create a vein of 1024 using WorldGenMinable, your gen code will find itself trying to access coordinates in a chunk that is not yet loaded. When that happens, the new chunk will be forced to load, calling your ore generation for that chunk as well, which then forces yet more chunks to load, and so on until your game crashes because it's caught in an infinite loop.

Link to comment
Share on other sites

If you're doing this in such a large scale, consider using one of Minecraft's 3D perlin noise generators.

Iterate through every block in the chunk, and check the perlin noise for each coordinate. If the block at the coordinate is stone, and the noise meets a certain condition (for example above 0.75), place your custom block at the coordinate.

Link to comment
Share on other sites

There are random walk maze generator algorithm might might just make great vein generators. The idea is:

[*]pick a spot (x,y,z) in chunk

[*]push location on stack

[*]then pick a random direction from spot (of 6 or 5)

[*]if that location is stone:

  • place block, decrement count
  • If all blocks are placed: return
  • select that new location
  • goto step 2

[*]if there are open directions (where there is stone): goto step 3

[*]pop a location off stack.

[*]If stack is empty then you've probably filled the whole chunk: abort

[*]goto step 3

 

This would work best if the direction selection were weighted based on twistiness of veins desired. Less twisty mazes weight last direction as 60%, and 10% for each side direction.

Link to comment
Share on other sites

There are random walk maze generator algorithm might might just make great vein generators. The idea is:

[*]pick a spot (x,y,z) in chunk

[*]push location on stack

[*]then pick a random direction from spot (of 6 or 5)

[*]if that location is stone:

  • place block, decrement count
  • If all blocks are placed: return
  • select that new location
  • goto step 2

[*]if there are open directions (where there is stone): goto step 3

[*]pop a location off stack.

[*]If stack is empty then you've probably filled the whole chunk: abort

[*]goto step 3

 

This would work best if the direction selection were weighted based on twistiness of veins desired. Less twisty mazes weight last direction as 60%, and 10% for each side direction.

 

We have fixed it with our current code. We just needed change some things in the code. Like the percentages. But that's fixed. it was spamming the ore and stuff like that :P

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.