Ground Content Conflict #1395
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-Minecraft feature
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Blocks
#1596 (Another) Portal bug
VoxeLibre/VoxeLibre
Reference: VoxeLibre/VoxeLibre#1395
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Maybe it's mostly Minetest issue, https://github.com/minetest/minetest/issues/11125
Mapgen works using 'chunk in a shell' feature, generating map chunks of 5*5*5 blocks with additional block-sized layer around the chunk to make result smooth.
So in fact mapgen works in 7*7*7 cubes.
Outer layer can overwrite the content of neighbour map chunks!
Mostly it happens with nodes with
.is_ground_content = true
- it means building matherial for the mapgen.Worst example is when some map block of 16*16*16 nodes located at a corner of 5*5*5 chunk - it means after its generation it can be overwritten 7 times!
7 times, Carl! I did my best to illustrate the problem, my painting isn't complete but hope will help to realize what's going on:
Moreover, my logs show me that air nodes are ground content too. Surprisingly. I'd like to be wrong.
We widely use air nodes in many schematics. We use schematics in
register_on_generated
callbacks. That's why these schematics need additional steps to anchor them, make them kinda 'mapgen-resistant', LOL.I don't see clear way to resolve this. I endlessly patch the code but it starts to go too far. I fixed really really many things but it causes new bugs and slowdowns.
What I've tried: placement after the delay, emerge neighbour areas, re-emerge current areas, increase processing areas to 7x7x7 and decrease back to 5x5x5. What would work definitely - reduce the area to 3x3x3 blocks within 5x5x5 chunks, but it would mean the biggest part of the world will be just clean, pure Minetest game.
Let me introduce temporary new label ("ground content conflict") to mark these problems.
If we require emerge of adjacent areas, it's like a chain reaction - they should require emerging next ones and mapgen never stops. So it's wrong way.
If we delay placing structures for some time - adjacent blocks might not be generated in this amount of time.
If we place schematics in shell layer ourselves - we can occasionally replace them ourselves but it doesn't help to protect them from the mapgen.
Etc...
But there is a good condition - when you come really near to some area - all chunks around generate entirely. And in a theory we can track when the generation process is finished.
So maybe I've got an algorithm:
What guys you think about it?
This is why waiting for some seconds (like this in Settlements mod) fixes some central chunks, but doesn't fix next chunks where no players nearby.
Probably we can patch only
place_schematics
,set_node
and something alike - basic things used by MCL2 mapgen:Serialize a structure and split into blocks.
Then wait for adjacent chunks to be generated, for blocks in outer layer of chunk.
I just thought how much correctly it would be to use voxel manipulator to get generation status of such blocks... There are at least two ways to check adjacent chunk status:
First can be slow if the chunk is far, second needs a storage, which can be broken/damaged occasionally.
But the chunk is near! If defaultly generation barrier is 10 blocks, and ground content check&save barrier is no more than 4 blocks, - using the first way seems to be correct for me . And we wouldn't need chunk generation status storage if so, at least currently. Just engine API.
Well, next good step would be figuring out some abstraction, suitable and working fast. Coroutine would be so nice... if no need to flush structures unplaced still to mod storage, but we need it, because MC world should be deterministic
Hi, I've assigned you all just in case, mostly because I'm pretty sure: you can check my investigations and give really good advices which I would appreciate so much
even wuzzy?
@kay27 This seems to involve way more mapgen stuff than I know (which is close to nothing), so if you need help to test something specific, let me know. :)
How does this affect gameplay?
Why have existing mapgen issues been labelled as "ground content conflict"? How is this related to those?
I am quite confused with all of this.
probably you mean finished code?
i'm continuously doing so many tests myself so a bit confused which one would be at least fun for you, so this is very basic one (zipped)
you may unpack it to ./games, run 'Generators' game with 'carpathian' seed 123456789, all checkboxes set,
run
/grantme all
and fly below water level to see these beautiful pictures we don't expect to meet here (because we ordered fresh air nodes only)...and this is expected (!) for Paramat, and this is because of Sokomine places his buildings repeatingly up to 8 times...
there are might be lots of ways to take it into account and wrap around it, we just need one fast and stable
it doesn't, just breaks our structures by cavegen code
because now i know the reason of them really well, and it's on the diagram in the first message
if we place regular nodes instead of marked as ground content, there are no problem absolutely :)
so the first i tried is just put alternative air to the schematics:
and it works - cavegen doesnt touch these nodes when we use them instead of the air
but they behave not like air nodes exactly, i'v seen little differences...
may be we can polish it somehow to remove the differences? or better implement what i suggested a little above?
it affects many things we generate in the real time with engine mapgen simultaneously, that's why elevated priority
map chunks overwrite each other - that's why it's a conflict of mapgen (for the engine - it's okay more likely)
etc
please don't get the assignment too serious
it will be fixed anyway somehow
your thoughts just might be very opportune
What if I just try to optimize near-chunk-dependency function like we optimize digital machines in high schools... have no better ideas still... of course trivial way is 6 nested loops which I don't like but maybe better still start from it because it can be more clear
There are chunks on the diagram, 5 pictures from left to right are the layers, numbers in blocks (cells) are how many adjacent blocks should be generated to be sure it's a good time to place our schematics
Oh, just not to forget, it might be useful too but doubtful :)
I've tried many ideas and algorithms and get a bit tired.
Now I think these 3x3x3 cubes are not so small to be honest
Maybe we should force placement schematics in these safe cubes and allow cavegen.cpp to overwrite other areas as many times as it wants.
But there are some problems too.
E. g. we need to place ocean monument:
Crazy ideas, I know
Okay, I realized my problem.
I thought we might don't do lots of redundant job writing the same content of map blocks again and again up to 8 times. I did all my experiments based on this supposition.
But it has a problem: nodes in partially generated map block interact with adjacent blocks and can change them, and it would be too difficult for me to remove leftovers of such interactions. Like water or lava when they flow down.
So probably Sokomine uses the only way currently possible - write map block content again and again,
69ac3f2691/mapgen.lua (L849)
I've done it :)
Every block 16x16x16 writes only once with this code.
So it would be fast for mapgens.
The only minor problem - I see far blocks, like these, which weren't already passed through out 2nd-level callbacks:
But when I fly nearier - they pass as well.
Oh, and one more minor problem - BLOCKS less than CHUNKS. Blocks are 16x16x16. So I probably shall rewrite mapgen_core of MineClone2 according to this
Nice!
Okay. It seems to be resolved in
mapgen
branch with one minor issue:There is no way to access mapgen objects FOR CHUNKS from safe callbacks (for blocks it is still possible) - need to invent something like:
What is mapgen objects - they are arrays described here: https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L4177
voxelmanip
heightmap
biomemap
heatmap
humiditymap
gennotify
Well... I need further ideas :)
Probably it's still more likely the engine issue.
Here is the code of my safe block/chunk callbacks:
f4a28cfab0/mods/CORE/mcl_mapgen/init.lua (L103)
Closing.
reopening. it was closed in favor of one pr, then another, but they are not merged, so i guess better to have it open.