How can I make new trees?

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

How can I make new trees?

by burli » Fri Aug 12, 2016 15:08

I want to create a more bush like tree from default wood an leaves including saplings. How can I do this? Can I use some of the code from trees.lua or do I have to write my own code?

Image
Attachments
screenshot_20160812_165554.jpg
screenshot_20160812_165554.jpg (137.31 KiB) Viewed 5203 times
 

User avatar
lisacvuk
Member
 
Posts: 165
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: How can I make new trees?

by lisacvuk » Fri Aug 12, 2016 15:15

Of course you can use the default game stuff, as long as you respect the licence. You should probably start with reading Rubenwardy's modding book :D
400 character limit? Am I writing a book?
I'm a Minetest player, 'learning' C++ and OpenGL, listening to Blind Guardian, Nightwish, Amon Amarth. Administrator on Craig's server. Likes cookies.
I live in Serbia.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Fri Aug 12, 2016 15:19

I don't mean copy and paste the code. I know that I can do that. I mean calling the existing code
 

User avatar
lisacvuk
Member
 
Posts: 165
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: How can I make new trees?

by lisacvuk » Fri Aug 12, 2016 15:24

http://dev.minetest.net/minetest.place_schematic
Create some schematics, save them, and give a random chance to place each of them.
400 character limit? Am I writing a book?
I'm a Minetest player, 'learning' C++ and OpenGL, listening to Blind Guardian, Nightwish, Amon Amarth. Administrator on Craig's server. Likes cookies.
I live in Serbia.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Fri Aug 12, 2016 15:37

Never worked with schematics. How can I create them?
 

User avatar
lisacvuk
Member
 
Posts: 165
Joined: Sat Jul 19, 2014 11:52
GitHub: lisacvuk
IRC: lisac
In-game: lisacvuk

Re: How can I make new trees?

by lisacvuk » Fri Aug 12, 2016 16:03

I think you can use the worldedit mod. There's a manual for it :D
400 character limit? Am I writing a book?
I'm a Minetest player, 'learning' C++ and OpenGL, listening to Blind Guardian, Nightwish, Amon Amarth. Administrator on Craig's server. Likes cookies.
I live in Serbia.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Fri Aug 12, 2016 16:40

Ok, but with a schematic I just get one tree. I want more random leaves. And worldedit seems to save the schematic in a different format
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: How can I make new trees?

by KCoombes » Fri Aug 12, 2016 17:43

are you using //mtschemcreate (tree name)? you could save several, slightly different trees (tree_1, tree_2, etc) and randomize the decoration placement in mapgen.
Last edited by KCoombes on Fri Aug 12, 2016 20:11, edited 2 times in total.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Fri Aug 12, 2016 18:02

found this. It's working now.

viewtopic.php?f=12&t=9400

Will they be randomly selected if I use _# like other media files or do I have to generate the filename myself?

What I don't like is that I can only use the corner to place schematics, not the center.
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: How can I make new trees?

by KCoombes » Fri Aug 12, 2016 20:14

burli wrote:found this. It's working now.

viewtopic.php?f=12&t=9400

Will they be randomly selected if I use _# like other media files or do I have to generate the filename myself?

What I don't like is that I can only use the corner to place schematics, not the center.


you would need to create the filename yourself for each tree schematic you save, but the random generation is handled by code in the mapgen file
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Fri Aug 12, 2016 21:16

KCoombes wrote:you would need to create the filename yourself for each tree schematic you save, but the random generation is handled by code in the mapgen file

I know that I have to enter the filename myself. I just want to know if multiple files with _# ending will be loaded randomly like with textures or sound files or if I have to code this myself

For example: I have the files tree_1.mts, tree_2.mts, tree_3.mts

can I use the code

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
minetest.place_schematic(pos, "tree.mts", rotation, replacements, force_placement)


and one of the three files is selected randomly?
 

twoelk
Member
 
Posts: 1092
Joined: Fri Apr 19, 2013 16:19

Re: How can I make new trees?

by twoelk » Sat Aug 13, 2016 01:07

Somebody else once asked "How to make Trees?"
Sokomine started a trees_lib
Vanessa's plants/biome library plants the stuff for More-Trees and others.
Duane's Schematic Saver might be useful
 

KCoombes
Member
 
Posts: 278
Joined: Thu Jun 11, 2015 23:19
In-game: Knatt or Rudilyn

Re: How can I make new trees?

by KCoombes » Sat Aug 13, 2016 01:18

burli wrote:
KCoombes wrote:you would need to create the filename yourself for each tree schematic you save, but the random generation is handled by code in the mapgen file

I know that I have to enter the filename myself. I just want to know if multiple files with _# ending will be loaded randomly like with textures or sound files or if I have to code this myself

For example: I have the files tree_1.mts, tree_2.mts, tree_3.mts

can I use the code

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
minetest.place_schematic(pos, "tree.mts", rotation, replacements, force_placement)


and one of the three files is selected randomly?


Try this:
Adapted from Ethereal NG - WTFPL

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
local add_schem = function(a, b, c, d, e, f, g, h, i)

   minetest.register_decoration({
      deco_type = "schematic",
      place_on = a,
      sidelen = 80,
      fill_ratio = b,
      biomes = c,
      y_min = d,
      y_max = e,
      schematic = f,
      flags = "place_center_x, place_center_z",
      spawn_by = h,
      num_spawn_by = i,
   })
end

local path = minetest.get_modpath("modname") .. "/schematics/"

-- Basic Tree
add_schem({"a"}, 0.02, {"b"}, 3, 80, path .. "tree_1.mts", nil, nil, nil)
add_schem({"a"}, 0.02, {"b"}, 3, 120, path .. "tree_2.mts", nil, nil, nil)
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: How can I make new trees?

by Sokomine » Sat Aug 13, 2016 03:17

Saving schematics for trees can also quite easily be done with my handle_schematics mod.
A list of my mods can be found here.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Sat Aug 13, 2016 06:39

KCoombes wrote:Try this:
Adapted from Ethereal NG - WTFPL


Thx, I will try this
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: How can I make new trees?

by paramat » Sat Aug 13, 2016 07:16

Saving schematics with Worldedit has problems, you cannot set per-node probability for "air" or per-node force-place.
For full control and often faster working create schematic files using tables in this way https://github.com/minetest-mods/saveschems
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Sat Aug 13, 2016 07:41

twoelk wrote:Sokomine started a trees_lib
Vanessa's plants/biome library plants the stuff for More-Trees and others.


They both use L-Trees, which is buggy as far as I know. moretrees causes ugly shadows. Don't know how it is with trees_lib

paramat wrote:Saving schematics with Worldedit has problems, you cannot set per-node probability for "air" or per-node force-place.
For full control and often faster working create schematic files using tables in this way https://github.com/minetest-mods/saveschems


Thx, will take a look
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: How can I make new trees?

by Wuzzy » Sat Aug 13, 2016 08:43

Using schematics for tress has the huge drawback that they always look the same. Also, I heard that schematics were originally intended for small decorations and not full trees and entire buildings and such.

You may want to look into L-system trees, look here:
http://dev.minetest.net/Introduction_to_L-system_trees

L-system trees have the benefit that they can be more random. L-systems are really powerful tools IMO.

I even wrote a mod for helping people creating new L-system trees (to save your time and sanity):
viewtopic.php?f=11&t=9458
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Sat Aug 13, 2016 08:53

Wuzzy wrote:Using schematics for tress has the huge drawback that they always look the same.


This sounds like there as some randomization

Sokomine wrote:Not exactly true, although most schematics are used that way and most of us don't care about the random factors that can be applied. Hmmm was a bit upset when learning that his schematics where used for storing houses and the like instead of the decorations he intended the file format and decorations mechanism to be used for :-)


Wuzzy wrote:Also, I heard that schematics were originally intended for small decorations and not full trees and entire buildings and such.

But as far as I can see the default mapgens use schematics for trees. And they don't look equal

Wuzzy wrote:You may want to look into L-system trees, look here:
http://dev.minetest.net/Introduction_to_L-system_trees

L-system trees have the benefit that they can be more random. L-systems are really powerful tools IMO.

I even wrote a mod for helping people creating new L-system trees (to save your time and sanity):
viewtopic.php?f=11&t=9458


I thought L-System is buggy and causes the ugly shadows in moretrees
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: How can I make new trees?

by Wuzzy » Sat Aug 13, 2016 12:03

Has “L-system trees are buggy” been proven yet? Like, is there an issue on that or something?

OK, schematics are not completely static, some randomization is indeed possible. I checked it in documentation.

Let's just say L-system trees and schematics are both possible ways to make random trees.
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: How can I make new trees?

by burli » Sat Aug 13, 2016 12:18

I have this with l-system from this thread
viewtopic.php?f=6&t=14194

Can you post a link to schematics doc plz? Didn't found one yet
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: How can I make new trees?

by Sokomine » Sat Aug 13, 2016 15:13

burli wrote:They both use L-Trees, which is buggy as far as I know. moretrees causes ugly shadows. Don't know how it is with trees_lib

trees_lib just offers all known methods of placing trees - be it an algorithm, L-System or schematics (either file or table) The lib can optionally register all the necessary nodes and grow trees from saplings on suitable grounds. It is possible to provide several growing methods per tree type.

Wuzzy wrote:Using schematics for tress has the huge drawback that they always look the same. Also, I heard that schematics were originally intended for small decorations and not full trees and entire buildings and such.

You can use more than one schematic, make each schematic have a variable height and rotate them automaticly. That's usually more than enough. In addition, trees placed by mapgen often overlap. And if I'm not mistaken, decorative trees where definitely something hmmm wrote the decorations for. He just got a bit annoyed when I started using them for houses :-)

burli wrote:Can you post a link to schematics doc plz? Didn't found one yet

They're sometimes called "decoration" in lua_api.txt
A list of my mods can be found here.
 

User avatar
azekill_DIABLO
Member
 
Posts: 3458
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO

Re: How can I make new trees?

by azekill_DIABLO » Sun Aug 14, 2016 09:47



omg thank you so much i'm searching this since one month
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
Hi, my username is azekill_DIABLO and i'm an exelent bug-maker(yeah...i know...i have a bad reputation)

azekill_DIABLO said: Mineyoshi+ABJ+Baggins= TOPIC HIJACKED.
My Mods and Stuff | Voxellar | VoxBox on GITHUB | M.I.L.A Monster engine
WEIRD MODDING CONTEST !!!
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: How can I make new trees?

by paramat » Mon Aug 15, 2016 14:06

> I thought L-System is buggy and causes the ugly shadows in moretrees

Yes it has always created subtle shadows in water, but more recently it creates dark shadows in all non-mgv6 mapgens. Something about l-system code triggers extreme lighting bugs in core 'updateLighting', both need work.
To only get subtle shadows make sure to grow l-system trees from saplings, don't create trees at mapgen time.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron