Aberrant trees

Post Reply
Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Aberrant trees

by Astrobe » Post

Aberrant trees is an enhancement of RND's trees.
It adds an API that makes it easier to define the parameters of a tree. Parameters include trunk and leaves material, optional fruits, average size, rate of growth... One can programmatically define various tree types. The "aberrant sapling" will select randomly one of the registered models.

The trees do not replace existing nodes like in the original, but it still does not check for protections. So it is still a bit grief-y.

The mod is made of two files: lib.lua which contains the code that make the trees grow and the "documentation", and init.lua which uses the API to register the models shown below. All are commented except for the default model.

There's no crafting recipe for the aberrant sapling.

source and download

Below are screenshots of an "aberrant forest" from various angles. I got every type once by commenting in and out all models but one in turn.

Image
Center background: all default parameters. On the left: with fruits (apples). I chose a pretty low density because with an MTG-based game they regrow anyway.

Image
On the left: aspen tree. They tend to grow vertically. Background: a failed aspen tree. Shit happens. This model's parameters probably needs some tweaking.
On the right: a pine tree. they tend to create a dense network of branches.

Image
On the left: a jungle tree. This specimen is not really good. They tend to grow tall.
On the right: an acacia tree. They are generally short and tend to spread, but this specimen decided to grow more up instead.

Center: an alien tree made of steel blocks, glass and mese lamps. More on this in next post.
Attachments
capture3.png
capture3.png (450.98 KiB) Viewed 1118 times
capture2.png
capture2.png (584.05 KiB) Viewed 1118 times
capture1.png
capture1.png (514.75 KiB) Viewed 1118 times
Last edited by Astrobe on Sun Feb 09, 2020 15:27, edited 2 times in total.

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

Image
The really aberrant trees.

On the left: a glass-and-steel tree, mese lamps are its fruits. A generally small tree.

Center: a desert stone "petrified" tree. The model specifies "air" as leaves.

On the right: a stone tree with cobble leaves and coal ore as "fruits". I imagine this type of tree would take a looong time to grow, especially if one chooses rare ore types as fruits instead. I imagine they are also good for "house in a tree" builders.
Attachments
capture4.png
capture4.png (694.98 KiB) Viewed 1118 times

User avatar
voxelproof
Member
Posts: 1087
Joined: Sat Aug 05, 2017 08:13
Location: Europe

Re: Aberrant trees

by voxelproof » Post

Super-magnificent, thanks a lot :)
To miss the joy is to miss all. Robert Louis Stevenson

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

I have added a definition parameter, "slanty", to control the slant of the trunk. Available in the repo.

Here is an ice tree with snow leaves, fresh water "fruits" and slanty=2:

Image

FYI, the snow blocks in my game are defined as falling blocks.
Attachments
icetree.png
icetree.png (394.45 KiB) Viewed 1118 times

CalebJ
Member
Posts: 407
Joined: Sat Dec 29, 2018 19:21
GitHub: KaylebJay
IRC: KaylebJay
In-game: CalebJ
Location: Tunnelers' Abyss

Re: Aberrant trees

by CalebJ » Post

Woow, this is really useful. Good job!

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: Aberrant trees

by j0j0n4th4n » Post

How one can use this mod? I've been trying to get an Acacia tree to be smaller than 10 nodes high and more or less as wide as 6 nodes, but it simply doesn't work.

The impression I got is that this mod is ignoring my settings. For example, setting the tree height to '1' does nothing to stop the tree from growing into gargantuan 30+ nodes high trees. I'm fairly sure this shouldn't be happening.

Here is my registered tree:

Code: Select all

a_trees.register
{
	trunk="default:acacia_tree",
	leaves="default:acacia_leaves",
	branchy=2,
	height=1,
	width=6,
	pace=1
}
On a side note, this mod could really use some documentation. I've notice some problems using the mod, they aren't bugs but were confusing in how it work:
- 'pace' works backwards, the smaller the pace the faster the tree grows.
- The Aberrant tree sapling is not a sapling for a single registered tree, rather it pick one at random from the list of registered trees.
cdb_894a100ddd76

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

Hi,

Funny cause this mod is part of my game (mf_atree there), and I've added some trees just recently.

First, please note that the original algorithm is from "Rnd" - all I really did was to turn hard-coded constants into parameters. So I might not be very helpful on the details.

Generally speaking, the parameters are interpreted as probabilities, so height=1 should result in a tree with a "small" trunk, but not exactly 1; now 30 is indeed excessive for this value, the chance for this to happen is quite dim.

Compared to similar definitions I use, where height is 1-2 and that typically produce short trunks (and by this I mean the "+" shaped base part, not the whole tree), your definition is missing a "size" parameter, which interacts with the height parameter in the code, and is by default 30. The "scale" parameter seems to apply to whole tree; when I set it to 5 I get (from memory) trees that are a dozen of node high.

Try:

Code: Select all

a_trees.register
{
	trunk="default:acacia_tree",
	leaves="default:acacia_leaves",
	branchy=1,
	height=2,
	width=10,
	pace=1
}
... For a "medium" height and wide acacia tree, one of my favorites.

For trees made of valuable or dangerous nodes, I typically use these parameters:

Code: Select all

a_trees.register
{
	trunk="default:stone",
	leaves="mobs:cobweb",
	fruit="default:copperblock",
	size=5,
	height=2,
	width=5,
	pace=1
}
This model usually looks like a big mushroom, about the height of a pine tree.

> - The Aberrant tree sapling is not a sapling for a single registered tree, rather it pick one at random from the list of registered trees.

Yep, and funny things can happen when you register a new tree when some are still growing in your world, because it uses the "param2" of the node to index the list and find the nodes to use when a growth tick happen; so if the order in the list changes...

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

PS:
You were kind of lucky I saw your post, if you are expecting answers, quote the person, so they'll be notified of your post/question.

Also, I realized my sig settings were incorrect - should fixed now ;-)
My game? It's Minefall.

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: Aberrant trees

by j0j0n4th4n » Post

You were kind of lucky I saw your post, if you are expecting answers, quote the person, so they'll be notified of your post/question.
Oh, I didn't know that. Thanks! Also thanks for explaining some of the stuff I've struggle with, the size parameter really helped a lot, my trees are working now =)
First, please note that the original algorithm is from "Rnd" - all I really did was to turn hard-coded constants into parameters. So I might not be very helpful on the details.
I see, you did a great job. My only complain is some parameters are ascending while others are descending ('size' vs 'slanty' for example) which is confusing.

I have a few suggestions if you wanna expand the mod, it could have a 'reverse' growth node which would start really numerous and generate less and less as the tree grow to simulate the '/\' shape of pine trees instead of the '\/' shape of the other trees.
cdb_894a100ddd76

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

j0j0n4th4n wrote:
Thu Jan 26, 2023 23:50
I have a few suggestions if you wanna expand the mod, it could have a 'reverse' growth node which would start really numerous and generate less and less as the tree grow to simulate the '/\' shape of pine trees instead of the '\/' shape of the other trees.
Well, I'm a lazy bum. It does what I need, maybe I will make it available on CDB "someday", but that's about as far as I'll go. But if you want to take over and publish an improved version, you'll have my help (if needed).
My game? It's Minefall.

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: Aberrant trees

by j0j0n4th4n » Post

Well, I'm a lazy bum. It does what I need, maybe I will make it available on CDB "someday", but that's about as far as I'll go. But if you want to take over and publish an improved version, you'll have my help (if needed).
Sorry for the late reply, I'm kind of lazy too and life can get busy. I'm thankful for the offer but I will have to decline. To give a bit of context, I was planning on creating a modpack to create more dynamic forests with trees that would thrive or wither depending on external factors like humidity and light (it is a large project, will probably take a while), I cooked up some ideas of how it might work and which mods I intend to use.

a_trees adds a nice randomness to the trees and I that caught my attention, but for my purposes it is a bit too random so I plan on tweak around with the mod to allow a few features:
- constrains to the randomness
- upside down growth.
- different tree thickness

This sounds nice and dandy but since I'm lazy and not very skillful with coding it will take a while, that is why I don't few like maintaining the mod but if I get anywhere with the idea I can send you the file =)
cdb_894a100ddd76

Astrobe
Member
Posts: 570
Joined: Sun Apr 01, 2018 10:46

Re: Aberrant trees

by Astrobe » Post

j0j0n4th4n wrote:
Mon Jan 30, 2023 21:34
I was planning on creating a modpack to create more dynamic forests with trees that would thrive or wither depending on external factors like humidity and light (it is a large project, will probably take a while), I cooked up some ideas of how it might work and which mods I intend to use.
I had this sort of idea too - planting a-tree saplings at mapgen time - but besides technical issues I wouldn't recommend it, as the forest would grow before the eyes of the player for each newly generated map chunk. I think another tree mod does this, and although their saplings grow instantly, the fact that the world is being populated with trees is noticeable in "bad" (IMO) way. With a-tree it'd be even worse.

You gotta start with existing trees. In my game, I made the choice to start with sparse trees, and then mobs plant (normal) saplings (using Mob Redo's features). It works well, the forests evolve without the player's direct action. I don't have the withering part, though, as "undoing" a tree is a bit expensive. In my game, players need a lot fuel for furnaces and wood is the primary source, so forest decline can happen due to player actions.
My game? It's Minefall.

User avatar
j0j0n4th4n
Member
Posts: 249
Joined: Tue Jan 26, 2021 06:45

Re: Aberrant trees

by j0j0n4th4n » Post

I had this sort of idea too - planting a-tree saplings at mapgen time - but besides technical issues I wouldn't recommend it, as the forest would grow before the eyes of the player for each newly generated map chunk.
But I wasn't planning planting them at mapgen time, that would bring massive lag and the problem of walking new chunks you said, my idea was to leave mapgen untouched, I would just replace the default schematics with a few of my own so they would have the proper nodes but that would be it. The meat of the thrive and wither system would happen in the same way a_trees grow the trees. But it would have a condition on the surrounding area of the tree, if it's good it would grow otherwise(bad conditions) it would wither*.

wither may be either replacing tree nodes with 'dead' tree nodes or shrinking the tree. I still didn't decide on that.
cdb_894a100ddd76

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests