How minetest actually works ("There is no tree, Neo")
(taking the conversation out of the mapgen thread viewtopic.php?p=248379#p248379)
Yes it is.
No they don't. There's an added script that runs at regular intervals on each leaf node. That script checks to see if there's a tree trunk node anywhere nearby. If there isn't, there's a randomized chance for the leaf to disappear.
Each leaf node runs this script from its own point of view. It's called the Active Block Modifier.
http://rubenwardy.com/minetest_modding_ ... /abms.html
Just because a node is independent doesn't mean it can't have code to affect other nodes. On the contrary, this is exactly how the world works.
No dependency. When you dig a papyrus node, that node has an added script that checks for additional papyrus leaves above. It's registered specifically against the node you dig.
That script runs from the point of view of the one single papyrus node. There's no such thing as a papyrus plant.
Because it is registered as an attached node. Even if used for leaves, leaves would still be attached to eachother I would wager... and since it's implemented as a group, I expect, like everything else, there's an ABM that runs for it, or it is triggered depending on the an action on a specific neighbouring node. So. Still independent.
Read the modding manual. It will answer a lot of your questions and give you a better idea of how the game actually works.
Sergey wrote:But if I fell that tree, not all its leaves will decay! Some of them will stay hanging in the air being connected to another pine! Amazing! There is no tree anymore, but "its" leaves changed their mind and deserted to another pine! That's all because leaves will not decay if there is pine tree no further than 4 block!
taikedz wrote:Sergey wrote:Tree's leaves are tree's leaves.
That's not how this world works... there is no such thing as "a tree" that ties together multiple nodes into a single conceptual item. This is a voxel game. Each voxel node exists as an individual thing, this is the core nature of the game.
There are tree trunk nodes and tree leaf nodes arranged to look like a tree, that is all. There is no "tree" just "some nodes in a 3d space." When you remove a trunk node, you are just removing an individual node. No such thing as a tree to remove it from. Just a an independent node.Sergey wrote:Simple array (in programming language). No tree — no leaves. Delete this array.
There was never an array in the first place, and I doubt there ever will be (an actual engine dev would have to assert that one themselves). Imagine an array for every. single. tree ever produced by the mapgen. Not efficient. But if you want to make that kind of mod yourself, you're welcome to do so. As you say - it's a Simple array.
Sergey wrote:You said that all blocks in game are individuals with independent behavior. But it is not true.
Yes it is.
Why leaves decay if there is tree trunk nearby? It means leaves depends on tree.
No they don't. There's an added script that runs at regular intervals on each leaf node. That script checks to see if there's a tree trunk node anywhere nearby. If there isn't, there's a randomized chance for the leaf to disappear.
Each leaf node runs this script from its own point of view. It's called the Active Block Modifier.
http://rubenwardy.com/minetest_modding_ ... /abms.html
Just because a node is independent doesn't mean it can't have code to affect other nodes. On the contrary, this is exactly how the world works.
Why when you cut one block of papyrus, you cut them all? It means they are dependent.
No dependency. When you dig a papyrus node, that node has an added script that checks for additional papyrus leaves above. It's registered specifically against the node you dig.
That script runs from the point of view of the one single papyrus node. There's no such thing as a papyrus plant.
Why torch falls down if there no supporting block anymore? Again, dependence. Why does not it hang in the air like other blocks? (I have complained about it before)
Because it is registered as an attached node. Even if used for leaves, leaves would still be attached to eachother I would wager... and since it's implemented as a group, I expect, like everything else, there's an ABM that runs for it, or it is triggered depending on the an action on a specific neighbouring node. So. Still independent.
Read the modding manual. It will answer a lot of your questions and give you a better idea of how the game actually works.