Page 1 of 1

Post your L-system trees here!

PostPosted: Mon Jan 26, 2015 19:55
by Wuzzy
I want to kick off a community effort to build a collection of L-system trees which serve as good examples or can be re-used in mods. No matter if simple or complex, ordinary or weird, anything goes!

If you want to post your L-system tree, please:
  • Make sure your tree actually works
  • Provide the tree definition table (2nd parameter of minetest.spawn_tree) of your tree in Lua code

It is not neccessary, but it would be nice if you:
  • Optionally show a screenshot (4:3 aspect ratio preferred)
  • Optionally leave a comment or description of your tree
  • Optionally assign a name to the tree; you could use the title of your post for this

Eventually I want to list the best examples in this wiki page:
http://dev.minetest.net/L-system_tree_examples

Useful links:

Apple tree

PostPosted: Mon Jan 26, 2015 19:58
by Wuzzy
I start the collection with an example: The apple tree found in lua_api.txt.

Tree definition:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
treedef = {
   axiom="FFFFFAFFBF",
   rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
   rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
   trunk="default:tree",
   leaves="default:leaves",
   angle=30,
   iterations=2,
   random_level=0,
   trunk_type="single",
   thin_branches=true,
   fruit_chance=10,
   fruit="default:apple"
}


Screenshot:
Image

Re: Post your L-system trees here!

PostPosted: Wed Jan 28, 2015 19:57
by Krock
\o/

Great stuff! I'll try to make some trees in the next days.

Re: Post your L-system trees here!

PostPosted: Wed Jan 28, 2015 20:23
by Linuxdirk
I din’t know … Wow. This looks like something to dig in to! Since it does not need any mods and since I’m not that deep into “Minetest internals” how do I actually make a tree spawn?

Do I need to create a simple mod doing nothing more than spawning a tree and doing it all over again and again with quitting the game, modifying the mod and starting the game again while testing?

Re: Post your L-system trees here!

PostPosted: Thu Jan 29, 2015 03:46
by Wuzzy
@Linuxdirk: No. You can use the L-System Tree Utilty, a mod programmed by me. If you install this mod, you can enter all the values using a nice formspec, you can save your definition for later use and plant it at an absolute or relative position. You can also request a special sapling of that treedef, which, when placed, will spawn the tree at that position 5 seconds after you placed it.

When you are happy with your tree definition, you can then finally use the tree definition in your mod. Or post it here. :-)

However, you do have to understand how L-System trees work in Minetest, see the other links in 1st post. But don't worry, the tool comes with a simple built-in help system including above example tree to help you get started.
Comments about this mod should go into the other thread, please.


Another possibility which is closer to Lua would be to use the luacmd mod. This mod allows you to enter Lua commands from inside the game. You could say in chat “/lua treedef = --[[ your treedef goes here ]]”, followed by something like “/lua minetest.spawn_tree({x=1,y=3,z=4234}, treedef)” in the chat. You can use the up and down keys to cycle through the command history. It is probably more complicated than using the other mod, but luacmd can be great if you already have data coming from existing mods, and you want to examine or modify it.

Re: Post your L-system trees here!

PostPosted: Sat Jan 31, 2015 18:53
by Linuxdirk
Wuzzy wrote:However, you do have to understand how L-System trees work in Minetest, see the other links in 1st post.

I just checked them. Seems like the usual turtle drawing thing :) I learned COMAL in 5th or 6th grade. Even if it’s a long time since then I still know how this basically works, only the syntax differs a lot :)

Wuzzy wrote:Another possibility which is closer to Lua would be to use the luacmd mod.

I just overlooked your mod – I think I’ll stick with that. Thanks!

Re: Post your L-system trees here!

PostPosted: Tue Mar 31, 2015 20:57
by VanessaE
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
moretrees.acacia_model={
   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="moretrees:acacia_trunk",
   leaves="moretrees:acacia_leaves",
   angle=45,
   iterations=3,
   random_level=0,
   trunk_type="single",
   thin_branches=true,
}

PostPosted: Thu Apr 02, 2015 15:32
by Hybrid Dog

Re: Post your L-system trees here!

PostPosted: Tue May 19, 2015 02:00
by luizrpgluiz
pos = {x=230,y=20,z=4}
stone_tree={
axiom="FFFFFAFFBF",
rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
trunk="default:mese",
leaves="default:stone",
angle=30,
iterations=2,
random_level=20,
trunk_type="single",
thin_branches=true,
fruit_chance=10,
fruit="default:wood"
}
minetest.spawn_tree(pos,stone_tree)

Re: Post your L-system trees here!

PostPosted: Fri May 20, 2016 15:13
by Nyarg
I am not familiar with L-System, but really want l-system rule for tall tree like here Image

Re: Post your L-system trees here!

PostPosted: Thu Dec 01, 2016 07:38
by lordfingle
Image

A rare Savannah tree to provide some variety for all those acacias...

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Boabab Tree
exotictrees.boabab_tree_model={
axiom="ATTTTTTc",
rules_a="[&&&G^^^TTTTTTF][&&&+++G^^^TTTTTTF][&&&---G^^^TTTTTTF][&&&-----G^^^TTTTTTF]",
rules_b="",
rules_c="[&--TF][&++++TF][&-----TF]",
trunk="moretrees:oak_trunk",
leaves="exotictrees:boabab_leaves",
angle=30,
iterations=3,
random_level=0,
trunk_type="crossed",
thin_branches=true,
}
exotictrees.boabab_tree_biome = {
   surface = { "default:dirt_with_grass", "default:dirt_with_dry_grass" },
   avoid_nodes = exotictrees.avoidnodes,
   avoid_radius = 10,
    check_air = true,
   seed_diff = 339,
   min_elevation = 1,
   max_elevation = 200,
   near_nodes_size = 15,
   near_nodes_count = 10,
   temp_min = 0.1,
   temp_max = -0.15,
   rarity = 40,
   max_count = 2,
}
minetest.register_node("exotictrees:boabab_planks", {
   description = "Boabab Planks",
   tiles = {"exotictrees_boabab_wood.png"},
   is_ground_content = true,
   groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
   sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("exotictrees:boabab_sapling", {
   description = "Boabab Sapling",
   drawtype = "plantlike",
   tiles = {"exotictrees_boabab_sapling.png"},
   inventory_image = "exotictrees_boabab_sapling.png",
   paramtype = "light",
   paramtype2 = "waving",
   walkable = false,
   selection_box = {
      type = "fixed",
      fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
   },
   groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
   sounds = default.node_sound_defaults(),
})
minetest.register_node("exotictrees:boabab_leaves", {
    description = "Boabab Leaves",
    drawtype = allfaces_optional,
    tiles = {"exotictrees_boabab_leaves.png"},
    paramtype = "light",
    is_ground_content = false,
    groups = {snappy=3, flammable=2, leaves=1, --[[moretrees_leaves=1]]},
    sounds = default.node_sound_leaves_defaults(),
})
 
biome_lib:register_generate_plant(exotictrees.boabab_tree_biome, exotictrees.spawn_boabab_tree_object)

Jacaranda Tree

PostPosted: Thu Dec 01, 2016 07:42
by lordfingle
We use these in our game to highlight where dungeons (mossycobble) are...

Image

I'm rather fond of Jacaranda trees because I come from Grafton in Australia ;):

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Jacaranda Tree
minetest.register_node("exotictrees:jacaranda_trunk", {
   description = "Jacaranda Trunk",
   tiles = {
      "exotictrees_jacaranda_trunk_top.png",
      "exotictrees_jacaranda_trunk_top.png",
      "exotictrees_jacaranda_trunk.png"
   },
   paramtype2 = "facedir",
   is_ground_content = true,
   groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
   sounds = default.node_sound_wood_defaults(),
   on_place = minetest.rotate_node,
})
minetest.register_node("exotictrees:jacaranda_planks", {
   description = "Jacaranda Planks",
   tiles = {"exotictrees_jacaranda_wood.png"},
   is_ground_content = true,
   groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
   sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("exotictrees:jacaranda_sapling", {
   description = "Jacaranda Sapling",
   drawtype = "plantlike",
   tiles = {"exotictrees_jacaranda_sapling.png"},
   inventory_image = "exotictrees_jacaranda_sapling.png",
   paramtype = "light",
   paramtype2 = "waving",
   walkable = false,
   selection_box = {
      type = "fixed",
      fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
   },
   groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1},
   sounds = default.node_sound_defaults(),
})
minetest.register_node("exotictrees:jacaranda_leaves", {
    description = "Jacaranda Leaves",
    drawtype = "allfaces_optional",
    tiles = {"exotictrees_jacaranda_leaves.png"},
    paramtype = "light",
    is_ground_content = false,
    groups = {snappy=3, flammable=2, leaves=1, --[[moretrees_leaves=1]]},
    sounds = default.node_sound_leaves_defaults(),
})
exotictrees.jacaranda_tree_model={
   axiom="FFFFFFFAFFBF",
   rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
   rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
   trunk="exotictrees:jacaranda_trunk",
   leaves="exotictrees:jacaranda_leaves",
   angle=30,
   iterations=2,
   random_level=0,
   trunk_type="single",
   thin_branches=true,
}
exotictrees.jacaranda_tree_biome = {
   surface = { "default:dirt_with_grass", "default:dirt_with_dry_grass" },
   avoid_nodes = exotictrees.avoidnodes,
   avoid_radius = 10,
    check_air = true,
   seed_diff = 339,
   min_elevation = 1,
   max_elevation = 100,
    near_nodes = {"default:mossycobble"},
   near_nodes_size = 15,
   near_nodes_count = 10,
   temp_min = 0.1,
   temp_max = -0.15,
   rarity = 90,
   max_count = 1,
}

 
biome_lib:register_generate_plant(exotictrees.jacaranda_tree_biome, exotictrees.spawn_jacaranda_tree_object)