Difference between revisions of "L-system tree examples"

From Minetest Developer Wiki
Jump to navigation Jump to search
m (→‎Giant Dry Shrub: lowercase)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This wiki page is a collection of example L-system trees. The intention is to help newbies better understand L-system trees, but also to provide usable tree definitions which could be used in mods.
+
This wiki page is a collection of example [[Introduction to L-system trees|L-system trees]]. The intention is to help newbies better understand L-system trees, but also to provide usable tree definitions which could be used in mods.
  
 
If you wish to add a tree, please use the template at [[/Template]] and insert the filled-out template into this wiki page. Don't forget to [[Special:Upload|upload]] a screenshot as well.
 
If you wish to add a tree, please use the template at [[/Template]] and insert the filled-out template into this wiki page. Don't forget to [[Special:Upload|upload]] a screenshot as well.
 +
 +
== Giant dry shrub ==
 +
=== Profile ===
 +
Works in any game with basic map generation.
 +
 +
=== Definition ===
 +
<pre>
 +
treedef={
 +
  axiom = "A/A/A/A/A/A/A/A/A/A/A/A",
 +
  rules_a = "[B+B+B+B]",
 +
  rules_b = "[FFFFFFFFFF]",
 +
  trunk = "mapgen_tree",
 +
  angle = 30,
 +
  iterations = 1,
 +
  random_level = 0,
 +
  trunk_type = "single",
 +
  thin_branches = true
 +
}
 +
</pre>
 +
 +
=== Screenshot ===
 +
[[File:Giant Dry Shrub.png|420px]]
  
 
== Apple tree ==
 
== Apple tree ==
 
=== Profile ===
 
=== Profile ===
* '''Subgame used''': Minetest
+
Works in any game with basic map generation. This tree is used as the example tree in the mod “[https://forum.minetest.net/viewtopic.php?f=11&t=9458 L-System Tree Utility]”.
* '''Additional mods used''': ''none''
 
  
 
=== Definition ===
 
=== Definition ===
 
<pre>
 
<pre>
 
treedef = {
 
treedef = {
axiom = {{{axiom}}},
+
axiom="FFFFFAFFBF",
rules_a = {{{rules_a}}},
+
rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
rules_b = {{{rules_b}}},
+
rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
rules_c = {{{rules_c}}},
+
trunk="mapgen_tree",
rules_d = {{{rules_d}}},
+
leaves="mapgen_leaves",
trunk = {{{trunk}}},
+
angle=30,
leaves = {{{leaves}}},
+
iterations=2,
angle = {{{angle}}},
+
random_level=0,
iterations = {{{iterations}}},
+
trunk_type="single",
random_level = {{{random_level|0}}},
+
thin_branches=true,
trunk_type = {{{random_level|"single"}}},
+
fruit_chance=10,
thin_branches = {{{thin_branches|true}}},
+
fruit="mapgen_apple",
fruit_chance = {{{fruit_chance}}},
 
fruit = {{{fruit}}}
 
 
}
 
}
 
</pre>
 
</pre>
Line 30: Line 49:
 
=== Screenshot ===
 
=== Screenshot ===
 
[[File:Apple Tree.png|420px]]
 
[[File:Apple Tree.png|420px]]
 
  
 
== Acacia ==
 
== Acacia ==
 
=== Profile ===
 
=== Profile ===
* '''Subgame used''': Minetest
+
* '''Game used''': Minetest Game
* '''Additional mods''':
+
* '''Additional mods''': ''None''
:* More Trees [moretrees]
 
  
 
=== Definition ===
 
=== Definition ===
Line 62: Line 79:
 
         .."ffffGGG",
 
         .."ffffGGG",
 
   rules_c = "/",
 
   rules_c = "/",
   trunk="moretrees:acacia_trunk",
+
   trunk="default:acacia_tree",
   leaves="moretrees:acacia_leaves",
+
   leaves="default:acacia_leaves",
 
   angle=45,
 
   angle=45,
 
   iterations=3,
 
   iterations=3,
Line 71: Line 88:
 
}
 
}
 
</pre>
 
</pre>
 
  
 
[[Category:Modding API]]
 
[[Category:Modding API]]

Latest revision as of 19:55, 17 May 2018

This wiki page is a collection of example L-system trees. The intention is to help newbies better understand L-system trees, but also to provide usable tree definitions which could be used in mods.

If you wish to add a tree, please use the template at /Template and insert the filled-out template into this wiki page. Don't forget to upload a screenshot as well.

Giant dry shrub

Profile

Works in any game with basic map generation.

Definition

treedef={
   axiom = "A/A/A/A/A/A/A/A/A/A/A/A",
   rules_a = "[B+B+B+B]",
   rules_b = "[FFFFFFFFFF]",
   trunk = "mapgen_tree",
   angle = 30,
   iterations = 1,
   random_level = 0,
   trunk_type = "single",
   thin_branches = true
}

Screenshot

Giant Dry Shrub.png

Apple tree

Profile

Works in any game with basic map generation. This tree is used as the example tree in the mod “L-System Tree Utility”.

Definition

treedef = {
	axiom="FFFFFAFFBF",
	rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
	rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
	trunk="mapgen_tree",
	leaves="mapgen_leaves",
	angle=30,
	iterations=2,
	random_level=0,
	trunk_type="single",
	thin_branches=true,
	fruit_chance=10,
	fruit="mapgen_apple",
}

Screenshot

Apple Tree.png

Acacia

Profile

  • Game used: Minetest Game
  • Additional mods: None

Definition

treedef={
   axiom="FFFFFFccccA",
   rules_a = "[B]//[B]//[B]//[B]",
   rules_b = "&TTTT&TT^^G&&----GGGGGG++GGG++"   -- line up with the "canvas" edge
         .."fffffffGG++G++"               -- first layer, drawn in a zig-zag raster pattern
         .."Gffffffff--G--"
         .."ffffffffG++G++"
         .."fffffffff--G--"
         .."fffffffff++G++"
         .."fffffffff--G--"
         .."ffffffffG++G++"
         .."Gffffffff--G--"
         .."fffffffGG"
         .."^^G&&----GGGGGGG++GGGGGG++"      -- re-align to second layer canvas edge
         .."ffffGGG++G++"               -- second layer
         .."GGfffff--G--"
         .."ffffffG++G++"
         .."fffffff--G--"
         .."ffffffG++G++"
         .."GGfffff--G--"
         .."ffffGGG",
   rules_c = "/",
   trunk="default:acacia_tree",
   leaves="default:acacia_leaves",
   angle=45,
   iterations=3,
   random_level=0,
   trunk_type="single",
   thin_branches=true,
}