I know different trees has been discussed. However, the purpose of this post is to suggest a way that can generate a somewhat realistic looking/growing tree and how to store their shape data to allow a somewhat procedurally generated trees.
Goal
To propose a tree generation algorithm that.
1. Require minimum addition of new blocks (only need 1 more).
2. Allow different tree type to exist, without using up existing block-space.
3. Relatively fast.
Current Study:
Assuming the correctness of the Data Values Wiki. This is what's happening.
1. A log still has 4-bits of unused data field (16 discrete values to use).
2. A Sapling has 0-bits left.
Propose a New Block
I propose a new block called the "Growth-shoot" block. The block uses 3-bits to track its current iteration state (0~7).
The growth shoot block is hereby referred to as :Green:.
The growth block will "run/interpret" a state in a state machine using the following criteria.
1. The block is "chosen" to grow (at a random periodic interval, and during day time, a certain percentage of block within a chunk area is checked, if the block checked received sufficient light, it grows).
2. Only one type of adjacent log (if there are two or more different type of logs adjacent, the is "killed" and turns into leaf).
3. The "state" value of the block is valid given the state-machine its supposed to run(this determine which "state" of the state-machine to "run"), else the block is killed.
If the above condition is satisfied, which state-machine (and which state) it ran is determined as followed.
1. The adjacent log block type (determines what type of log the create when it "grows") determines which state machine (unique to each tree-type) to use.
2. The state-value of the block itself (if invalid, the block is killed).
Saplings
When saplings grows into trees, it runs state 16 of the state machine (1~15 is ran by growth block, state 0 indicate that this should be killed). The only difference is that if it is not resting ON a log (it only check below it, not around it), the new tree type is defined by biome, else the log defines which tree it is (and ultimately which state-machines to run).
State Machine definition
Each tree has a state machine unique to each tree, which determines ultimately what shape it grow into.
Each state record in the state machine has the following data:
1. State Number - define which state is the current entry.
2~3. Max/Min Growth - The maximum/minimum numbers of "logs" for the to grow. The direction of growth is always away from the log it is attached to (or, if two or more identical log types adjacent, prioritize growing away from bottom, then side, then top log block). I'll referred to the end of this section of log the "tip".
4. Tip Leaf Size: How big a leaf cluster (radius) to grow at the tip.
5. Axial Next State - What's the state of the next placed on the tip away from the starting point.
6. Lateral Next State - What's the state of a non-axial next placed on the tip parallel to the ground.
7. Upward Next State - What's the state of a non-axial next on the top face of the tip.
8. Downward Next State - What's the state of a non-axial next on the bottom face of the tip.
A state machine can be organized then, as followed.
A zero in any next-state means don't generate a there.
If a didn't grow any new block (Minimum growth is 0, and it rolled a 0), that is "killed" off and no new is generated.
Some visual
Starting Growth Shoot
New Axial
new Lateral
New Upward
New Downward
Say a state machine has a Max/Min Growth of 3 (max is 3, min is also 3).
Side View, before the runs the state machine:
[] [] [] [] [] []
[] [] [] []
[] [] [] [] []
After running the state machine
Side View:
[] [] [] [] []
[]
[] [] [] []
Top View:
[] [] [] [] []
[]
[] [] [] [] [] []
It's a difficult to do that on forum, but here's a few state machine that you can "run" to generate some trees in paper (or even in mine-craft, just follow each state in the state-machine, thou you have to remember which state is a new in).
Remember: 16 is the initial generation, essentially this defines the first section of a tree trunk.
And per C++ standard, // is comment. Standard - This will generate a tree with trunk 4~6 blocks tall, with a 5x5x5 leaf block on top.
16 (6/4:2) - 0:0:0:0 // Grow 4~6 logs, grow a radius 2 leaf cluster, stop.
Christmas tree - This should generate a somewhat pine-tree like tree, each new trunk section generates a top that grows further, and new side/lateral that gets shorter as it gets near the top:
16 (6/5:3) - 15:4:0:0 // Grow 5~6 logs, continue to state 15 on top, 4 sideways.
15 (4/3:2) - 14:3:0:0
14 (4/3:1) - 13:2:0:0
13 (4/3:1) - 12:1:0:0
12 (4/3:1) - 0:0:0:0
//skip...
4 (3/2:2) - 3:2:0:0 // Grow 2~3 logs, continue out using a longer branch, and shorter branch side-ways
3 (2/2:2) - 2:1:0:0
2 (2/1:1) - 1:0:0:0
1 (1/1:1) - 0:0:0:0
Canopy tree - this should generate a flat top tree. The initial trunk grows and spawn new only on the side/lateral face of the tip, and continue to grow sideways 2 times.
16 (6/5:3) - 0:15:0:0
15 (4/3:2) - 14:14:0:0
14 (4/3:2) - 13:13:0:0
Hanging tree - this should generate something similar to a weeping willow. Thou for simplicity purpose, its a canopy with dangling logs.
16 (6/5:3) - 0:15:0:0
15 (4/3:2) - 14:14:0:2
14 (4/3:2) - 13:13:0:1
//skip...
2 (3/2:1) - 0:0:0:0
1 (2/1:1) - 0:0:0:0
Cactus tree: A cactus shape tree, branches out at the top of trunk and each branch grows taller.
16 (6/5:1) - 0:15:0:0 //branch off at top
15 (4/2:1) - 0:0:1:0 // Branch runs for 2~4 logs, before spawning a new on the top face
//skip...
1 (4/1:1) - 0:0:0:0 // Grows a 1~4 logs up and stop
Mutant tree: A really dangerous tree, this tree will never stop growing until you destroyed the entire tree (on the other hand, infinite wood-source without need to replant). Note that this will not instantly fill the whole map with trees, as remember that each transition ONLY happens once per a random interval (which should be at least 1 day), and only a percentage of each will "run" the state machine. Additional limits can be made for this tree NOT such that only block within a biome will run this (so if it propagate out of a biome, it will stop, thou sooner or later it will fill the entire biome with it).
16 (6/5:1) - 15:15:15:15 //Initial growth...
15 (3/2:1) - 15:15:15:15 //Note that it just keep repeating the same state over, and over, and over again.
Addendum
The behavior on contacting a solid surface on growth can vary. A few examples.
Grass/Glass blocks - destroys them and continue.
Dirt/Wood/Sand/Gravel (weak blocks) - a chance of destroying them and continue.
All other - Stops the growth.
Everytime a can grow no further, it will not spawn any new block.
This is more as an idea for Notch, hopefully other individuals with good grasp on the state-machine concept can chime in.
A little clarification on how it grows.
Effectively, the growth-shoot block, operates as followed.
1.Decide which direction to "grow" (away from the log its attached to).
2.Decide how many logs to "grow".
3. Grow a log.
4. If it grows enough log, go-to 7, if not, continue.
5. Move 1 block (if it can't move, the growth-shoot block is killed).
6. Goto 3.
7. Finish the rest of state-machine (spawn leaf, spawn new growth-shoot at where it is now, which should be at the tip of the new branch).
I'd like to see it set up so that tilling the dirt directly around the base of a tree would encourage it to continue growing straight up, and tilling the dirt just to one side would encourage it to grow more to that direction.(if any of these blocks with water would be treated the same as tilled, stone and sand would always be treated as "not" tilled. I'd also like the ability to plant a sapling on top of a log block, and not just dirt. Allowing me to grow trees out of trees to make bigger trees.
Hmm, this is interesting. I'll see if I can write a little simulation to see how well this works, and to play around with the parameters. If this works well, we can email the specs to Notch, as I'm sure he'd be very interested.
I'd like to see it set up so that tilling the dirt directly around the base of a tree would encourage it to continue growing straight up, and tilling the dirt just to one side would encourage it to grow more to that direction.(if any of these blocks with water would be treated the same as tilled, stone and sand would always be treated as "not" tilled. I'd also like the ability to plant a sapling on top of a log block, and not just dirt. Allowing me to grow trees out of trees to make bigger trees.
The difficulty with that addition is that now, each growth-shoot block needs to figure out where its "root" is, which requires it to trace through the log blocks to see where it is (and given the limited storage space per block, this needs to be done every time it needs to "grow").
However, you can "trim" it, bonzai style, by building cobble-stone on the growth shoot blocks (or destroy it) to have it only grow in the direction you want.
Thou arguably, each growth-shoot still needs to check if its connected to the ground (though we can "cheat", by having player's tree chopping action mark surrounding wood as "maybe dead" and only check a few at a time).
Quote from MrTorus »
Hmm, this is interesting. I'll see if I can write a little simulation to see how well this works, and to play around with the parameters. If this works well, we can email the specs to Notch, as I'm sure he'd be very interested.
Thank you, I would really like to see how well it works (currently lack the time and tool to do this).
trees should have a chance of collapsing too, and possibly crushing you, when you just chop them down willynilly. then maybe people will rethink punching every tree they see, and obliterating it. and the thought of a mutant tree scares me. they should act as dungeons, attracting mobs to them, but maybe having chests full of treasure (particularly mob drops) in them.
Rollback Post to RevisionRollBack
Quote from spaz102 »
Actually, that's the best mental image ever. A dying, drowning man stuffing his face from a massive wall of cake, and carving out a monstrous underwater cake picture. I'd pay to watch that irl.
[quote=Rotten194][quote=mcnugget] "Love cabin"[;/quote][quote=mcnugget]creepers.!
trees should have a chance of collapsing too, and possibly crushing you, when you just chop them down willynilly. then maybe people will rethink punching every tree they see, and obliterating it. and the thought of a mutant tree scares me. they should act as dungeons, attracting mobs to them, but maybe having chests full of treasure (particularly mob drops) in them.
That is true. However, that's not the goal for this suggestion.
Suggestion that make tree felling more realistic has been suggested before.
The idea of having some tree with a designation that it should spawn chest and attract/spawn mobs is interesting (the mutant tree as designed is just a tree that grows un-controllably everywhere).
Goal
To propose a tree generation algorithm that.
1. Require minimum addition of new blocks (only need 1 more).
2. Allow different tree type to exist, without using up existing block-space.
3. Relatively fast.
Current Study:
Assuming the correctness of the Data Values Wiki. This is what's happening.
1. A log still has 4-bits of unused data field (16 discrete values to use).
2. A Sapling has 0-bits left.
Propose a New Block
I propose a new block called the "Growth-shoot" block. The block uses 3-bits to track its current iteration state (0~7).
The growth shoot block is hereby referred to as :Green:.
The growth block will "run/interpret" a state in a state machine using the following criteria.
1. The block is "chosen" to grow (at a random periodic interval, and during day time, a certain percentage of block within a chunk area is checked, if the block checked received sufficient light, it grows).
2. Only one type of adjacent log (if there are two or more different type of logs adjacent, the is "killed" and turns into leaf).
3. The "state" value of the block is valid given the state-machine its supposed to run(this determine which "state" of the state-machine to "run"), else the block is killed.
If the above condition is satisfied, which state-machine (and which state) it ran is determined as followed.
1. The adjacent log block type (determines what type of log the create when it "grows") determines which state machine (unique to each tree-type) to use.
2. The state-value of the block itself (if invalid, the block is killed).
Saplings
When saplings grows into trees, it runs state 16 of the state machine (1~15 is ran by growth block, state 0 indicate that this should be killed). The only difference is that if it is not resting ON a log (it only check below it, not around it), the new tree type is defined by biome, else the log defines which tree it is (and ultimately which state-machines to run).
State Machine definition
Each tree has a state machine unique to each tree, which determines ultimately what shape it grow into.
Each state record in the state machine has the following data:
1. State Number - define which state is the current entry.
2~3. Max/Min Growth - The maximum/minimum numbers of "logs" for the to grow. The direction of growth is always away from the log it is attached to (or, if two or more identical log types adjacent, prioritize growing away from bottom, then side, then top log block). I'll referred to the end of this section of log the "tip".
4. Tip Leaf Size: How big a leaf cluster (radius) to grow at the tip.
5. Axial Next State - What's the state of the next placed on the tip away from the starting point.
6. Lateral Next State - What's the state of a non-axial next placed on the tip parallel to the ground.
7. Upward Next State - What's the state of a non-axial next on the top face of the tip.
8. Downward Next State - What's the state of a non-axial next on the bottom face of the tip.
A state machine can be organized then, as followed.
StateNumber (MaxGrow/MinGrow:TipLeaf) - NextAxial:NextLateral:NextUp:NextDown
A zero in any next-state means don't generate a there.
If a didn't grow any new block (Minimum growth is 0, and it rolled a 0), that is "killed" off and no new is generated.
Some visual
Starting Growth Shoot
New Axial
new Lateral
New Upward
New Downward
Say a state machine has a Max/Min Growth of 3 (max is 3, min is also 3).
Side View, before the runs the state machine:
[] [] [] [] [] []
[] [] [] []
[] [] [] [] []
After running the state machine
Side View:
[] [] [] [] []
[]
[] [] [] []
Top View:
[] [] [] [] []
[]
[] [] [] [] [] []
It's a difficult to do that on forum, but here's a few state machine that you can "run" to generate some trees in paper (or even in mine-craft, just follow each state in the state-machine, thou you have to remember which state is a new in).
Remember: 16 is the initial generation, essentially this defines the first section of a tree trunk.
And per C++ standard, // is comment.
Standard - This will generate a tree with trunk 4~6 blocks tall, with a 5x5x5 leaf block on top.
16 (6/4:2) - 0:0:0:0 // Grow 4~6 logs, grow a radius 2 leaf cluster, stop.
Christmas tree - This should generate a somewhat pine-tree like tree, each new trunk section generates a top that grows further, and new side/lateral that gets shorter as it gets near the top:
16 (6/5:3) - 15:4:0:0 // Grow 5~6 logs, continue to state 15 on top, 4 sideways.
15 (4/3:2) - 14:3:0:0
14 (4/3:1) - 13:2:0:0
13 (4/3:1) - 12:1:0:0
12 (4/3:1) - 0:0:0:0
//skip...
4 (3/2:2) - 3:2:0:0 // Grow 2~3 logs, continue out using a longer branch, and shorter branch side-ways
3 (2/2:2) - 2:1:0:0
2 (2/1:1) - 1:0:0:0
1 (1/1:1) - 0:0:0:0
Canopy tree - this should generate a flat top tree. The initial trunk grows and spawn new only on the side/lateral face of the tip, and continue to grow sideways 2 times.
16 (6/5:3) - 0:15:0:0
15 (4/3:2) - 14:14:0:0
14 (4/3:2) - 13:13:0:0
Hanging tree - this should generate something similar to a weeping willow. Thou for simplicity purpose, its a canopy with dangling logs.
16 (6/5:3) - 0:15:0:0
15 (4/3:2) - 14:14:0:2
14 (4/3:2) - 13:13:0:1
//skip...
2 (3/2:1) - 0:0:0:0
1 (2/1:1) - 0:0:0:0
Cactus tree: A cactus shape tree, branches out at the top of trunk and each branch grows taller.
16 (6/5:1) - 0:15:0:0 //branch off at top
15 (4/2:1) - 0:0:1:0 // Branch runs for 2~4 logs, before spawning a new on the top face
//skip...
1 (4/1:1) - 0:0:0:0 // Grows a 1~4 logs up and stop
Mutant tree: A really dangerous tree, this tree will never stop growing until you destroyed the entire tree (on the other hand, infinite wood-source without need to replant). Note that this will not instantly fill the whole map with trees, as remember that each transition ONLY happens once per a random interval (which should be at least 1 day), and only a percentage of each will "run" the state machine. Additional limits can be made for this tree NOT such that only block within a biome will run this (so if it propagate out of a biome, it will stop, thou sooner or later it will fill the entire biome with it).
16 (6/5:1) - 15:15:15:15 //Initial growth...
15 (3/2:1) - 15:15:15:15 //Note that it just keep repeating the same state over, and over, and over again.
Addendum
The behavior on contacting a solid surface on growth can vary. A few examples.
Grass/Glass blocks - destroys them and continue.
Dirt/Wood/Sand/Gravel (weak blocks) - a chance of destroying them and continue.
All other - Stops the growth.
Everytime a can grow no further, it will not spawn any new block.
This is more as an idea for Notch, hopefully other individuals with good grasp on the state-machine concept can chime in.
Effectively, the growth-shoot block, operates as followed.
1.Decide which direction to "grow" (away from the log its attached to).
2.Decide how many logs to "grow".
3. Grow a log.
4. If it grows enough log, go-to 7, if not, continue.
5. Move 1 block (if it can't move, the growth-shoot block is killed).
6. Goto 3.
7. Finish the rest of state-machine (spawn leaf, spawn new growth-shoot at where it is now, which should be at the tip of the new branch).
PLEASE ALSO SUPPORT:
Sabata & Grey Acumen's "New Nether"
Grey Acumen's Minecraft 2.0 Suggestion Series
MINECRAFT FACTS: BIG LIST OF WHAT NOTCH HAS ACTUALLY SAID ABOUT THE PLANNED FEATURES OF MINECRAFT
The difficulty with that addition is that now, each growth-shoot block needs to figure out where its "root" is, which requires it to trace through the log blocks to see where it is (and given the limited storage space per block, this needs to be done every time it needs to "grow").
However, you can "trim" it, bonzai style, by building cobble-stone on the growth shoot blocks (or destroy it) to have it only grow in the direction you want.
Thou arguably, each growth-shoot still needs to check if its connected to the ground (though we can "cheat", by having player's tree chopping action mark surrounding wood as "maybe dead" and only check a few at a time).
Thank you, I would really like to see how well it works (currently lack the time and tool to do this).
I don't want to know.
That is true. However, that's not the goal for this suggestion.
Suggestion that make tree felling more realistic has been suggested before.
The idea of having some tree with a designation that it should spawn chest and attract/spawn mobs is interesting (the mutant tree as designed is just a tree that grows un-controllably everywhere).
a bump yes, but a purposefull bump, someone email this to notch allready!
And why just use the trick to put 4 cobblestone blocks one on top of each other and putting a sapling beside the base?