Tree generation API?

User avatar
y.st.
Member
 
Posts: 38
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: Yst
In-game: Yst

Tree generation API?

by y.st. » Sat Aug 08, 2015 02:13

I'm trying to use the tree generation API, but I'm running into a weird issue. Specifically, the game is adding leaves above and below branches, but *never* beside branches. The sides of branches end up bare. How do I add leaves beside branches?

The attached screenshot shows a tree with only a single enlongated branch to make the oddity easy to see.

EDIT: The forum seems to be having issues accepting image uploads if the image name on my machine has colons in it. Why whould the file name from my machine matter? The forum can rename the uploaded copy as needed.
Attachments
Screenshot - 080715 - 19_11_08.png
No leaves beside branch
Screenshot - 080715 - 19_11_08.png (339.62 KiB) Viewed 1316 times
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Tree generation API?

by benrob0329 » Sat Aug 08, 2015 02:25

I don't think that trees in MT are suppose to have "branches", but i could be wrong. I didn't even know there was a tree API.

Wait, if there is a tree API, then why doesn't Moretrees use it?
 

User avatar
y.st.
Member
 
Posts: 38
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: Yst
In-game: Yst

Re: Tree generation API?

by y.st. » Sat Aug 08, 2015 02:30

benrob0329 wrote:I don't think that trees in MT are suppose to have "branches", but i could be wrong. I didn't even know there was a tree API.

Wait, if there is a tree API, then why doesn't Moretrees use it?

If you are refering to moretrees by VanessaE, I think the tree API was created mostly for use by moretrees. Moretrees and the tree generation API came out at about the same time, if I recall, and I think there was a lot of colaboration between VanessaE and RealBad Angel while those two were being set up. (RealBadAngel built the tree generation API.) In any case, moretrees *does* make heavy use of the tree generation API.
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Tree generation API?

by benrob0329 » Sat Aug 08, 2015 02:44

If Moretrees does use it, then why does it need plants_lib?
 

User avatar
y.st.
Member
 
Posts: 38
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: Yst
In-game: Yst

Re: Tree generation API?

by y.st. » Sat Aug 08, 2015 02:56

I think the plants_lib dependency was added later, but don't quote me on that. As for what it does, I think it maily is used to choose the placement of plants grown on map generation, so the placement code doesn't have to be updated in several different modules every time the code sees improvement. Also, if you look at <https://github.com/VanessaE/plantlife_modpack/blob/master/plants_lib/init.lua#L703>, you see minetest.spawn_tree(), which is the function used to access the tree generation API. If you want to try it, it's documented at <https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L2899>.
 

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

Re: Tree generation API?

by Sokomine » Sat Aug 08, 2015 03:11

Hm, yes, trees are an issue. A function to add trees just by supplying their textures (bark, top of trunk, wood, leaves, fruits, shape, ...) would be welcome. I'd love to see a mod that adds the diffrent wood types by adding trees that look like the default (v6) tree/appletree - just with diffrent bark, leaves, fruit - and with the same shape. Such a mod (or the function thereof) ought to be part of minetest_game. I had to create a copy of default's tree code for the villages which is very annoying as far as maintenance goes but was required due to some changes not beeing possible without.
Moretrees are beautiful but less good as a regular supply of wood. Takes too long to chop them down.
A list of my mods can be found here.
 

User avatar
y.st.
Member
 
Posts: 38
Joined: Fri Mar 20, 2015 01:24
GitHub: y-st
IRC: Yst
In-game: Yst

Re: Tree generation API?

by y.st. » Sat Aug 08, 2015 03:20

Sokomine wrote:Hm, yes, trees are an issue. A function to add trees just by supplying their textures (bark, top of trunk, wood, leaves, fruits, shape, ...) would be welcome. I'd love to see a mod that adds the diffrent wood types by adding trees that look like the default (v6) tree/appletree - just with diffrent bark, leaves, fruit - and with the same shape. Such a mod (or the function thereof) ought to be part of minetest_game. I had to create a copy of default's tree code for the villages which is very annoying as far as maintenance goes but was required due to some changes not beeing possible without.
Moretrees are beautiful but less good as a regular supply of wood. Takes too long to chop them down.


Yeah, I was very tempted to take the tree code from minetest_game, but I want my new game to be free of minetest_game in that I don't have to keep an eye on certain parts of minetest_game, watching in case of updates. The only thing that I might use from minetest_game is the sound effects, but everything else will be completely new.

I'm hoping to generate trees that are about the same size as the Minetest C++ trees, though the shapes will come out differently. The branch in that screenshot is far longer than I want, but it's easier to see what the actual problem is when the branches are long. I've already got working (though simplistic) trees to replace apple trees (mapgen_apple) and apple trees (default:apple), though they don't work as well as they would if I could understand what was causing the leafless sides of branches issue. Jungle trees will probably be next, but pine trees will be a pain to implement.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 7 guests

cron