Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in rubber tree generation is too rare, and a search optimisation #464

Open
paramat opened this issue Dec 2, 2018 · 8 comments
Open

Comments

@paramat
Copy link

paramat commented Dec 2, 2018

There has been a complaint about finding rubber trees in non-mgv6 mapgens.

if technic.config:get_bool("enable_rubber_tree_generation") then

		if math.random(1, 100) > 5 then
			return
		end

One rubber tree is placed in 1 in 25 mapchunks, an average spacing of 400 nodes, good luck finding it in non-mgv6 dense forests.
That conditional should be removed as an initial workaround, for one rubber tree in every mapchunk with dirt_with_grass.

local pos = minetest.find_node_near(tmp, maxp.x - minp.x,

The radius of this search is too big, it's searching a volume equivalent to 8 mapchunks, that's 4,096,000 nodes which will cause significant server Lua lags. It should be now be (maxp.x - minp.x) / 2 since every surface mapchunk is being searched.
///////////////////////

The current code is crap and about 6 years out of date. It should place rubber trees using the engine's Biome API, which means no need for a huge 'find node near' search. Then multiple rubber trees can be placed in suitable biomes.

Technic shouldn't even place L-system rubber trees during mapgen, because doing so causes lighting bugs, moretrees only places saplings during mapgen which are then quickly grown by ABM.
It shouldn't use L-system trees at all and use schematics, since technic is adding rubber trees itself to mapgens full of schematic trees, L-system trees are inconsistent.
L-system trees are not yet suitable for adding at mapgen time as every one causes it's own lighting update.

It's weird how MT's most popular mods are so intensive, out of date, and poorly coded in terms of mapgen (moretrees, biome lib, technic).

@paramat paramat changed the title Builtin rubber tree generation is too rare, and a search optimisation Built-in rubber tree generation is too rare, and a search optimisation Dec 9, 2018
@Xiong
Copy link

Xiong commented Jan 16, 2019

This issue is trouble indeed. It's not clear how to say with confidence that rubber trees spawn very rarely or will never spawn. But at some point the alternatives converge. Rubber is essential to technic; without it, there's only a crippled game.

There are two questions. (1) How to fix technic's backup rubber gen; and (2) When to invoke the backup. I think (2) must be resolved before (1).

That opens questions of whether moretrees rubber is broken and if it will be fixed.

@paramat
Copy link
Author

paramat commented Jan 16, 2019

In the first post i clearly said with confidence they are too rare:

One rubber tree is placed in 1 in 25 mapchunks, an average spacing of 400 nodes

The fixes are also detailed in the first post, it should use the Biome API and place schematic rubber trees instead of L-system trees.

I think it's best to fix this in technic as this mod has the need for rubber. Moretrees uses L-system trees throughout so changing rubber trees in that would be inconsistent.
Moretrees still needs a complete rewrite though.

@Chrozayis
Copy link

Rubber trees are nonexistent with technic + moretrees running on the v7 and carpathian mapgens. (I've spent hours flying around, maybe there was 1 rubber tree on a v7 map, but I never found another).
Because I only use those mapgens, I've tweaked my init to always invoke the backup rubber.lua.
After doing this rubber trees became much more abundant, almost too abundant.

I propose always invoking the backup when on v7, carpathian or flat (I'm not sure about river), at least until moretrees is fixed. The problem with moretrees seems to affect all water-bound trees. Rubber, apple and the palm trees are hit the hardest.

@edwinsage
Copy link

I ran in to a similar issue with no rubber trees on v7, and in investigating in the code found that rubber trees have no vertical distance on the water block check, meaning they will only spawn on land that is level with the water. Seeing as how most of the coasts I encountered were sandy, this left very few viable spawn locations. I added near_nodes_vertical = 10 in the moretrees biome_defs.lua, and started finding rubber trees at a reasonable rate on newly generated mapblocks.

I think this might have been an oversight in moretrees, and possibly an easy fix there?

@paramat
Copy link
Author

paramat commented Apr 28, 2020

The 'find nodes in area' checks that biome_lib does are very intensive, mostly unecessary and a large reason why moretrees is extremely intensive and slow.

All the mods that use biome_lib, such as moretrees etc., are unsuitable for use with mapgens other than mgv6.
biome_lib and the related mods need a complete rewrite, they can be made simpler and much less intensive.

@TableTooN
Copy link

On what do they grow on?

@JordanL2
Copy link

Is this still a problem? If so an issue should be opened here: https://github.com/mt-mods/moretrees/issues

As for the biome_lib performance issues, I have some ideas and will open issues on the biome_lib repo for them.

@beepbopbeepboop
Copy link

Filed mt-mods/moretrees#33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants