[mod] Biome library [git][biome_lib]

hlqkj
Member
Posts: 38
Joined: Wed Dec 11, 2019 20:10
GitHub: hlqkj
IRC: hlqkj
In-game: hlqkj

Re: [mod] Biome library [git][biome_lib]

by hlqkj » Post

@VanessaE, perhaps biome_lib could be one of the mods sfan5 is talking about? -> https://github.com/minetest/minetest/pu ... -808903201

No clue if it can technically be ported to that API, but if so it would benefit a lot from it I think (we're getting lag spikes as high as 8 seconds when players explore new areas right now).
Quando omni flunkus, moritati.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [mod] Biome library [git][biome_lib]

by VanessaE » Post

In fact, I had hoped I'd be able to use that API.

As for lag, try the latest biome_lib in git. I thought it was decent already, but this should be MUCH better (in short: generation is now broken down into much smaller steps, to better spread the load).
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

hlqkj
Member
Posts: 38
Joined: Wed Dec 11, 2019 20:10
GitHub: hlqkj
IRC: hlqkj
In-game: hlqkj

Re: [mod] Biome library [git][biome_lib]

by hlqkj » Post

Uhm, not sure we're on the latest... I'll check and give feedback :)
Quando omni flunkus, moritati.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [mod] Biome library [git][biome_lib]

by VanessaE » Post

Latest is currently git commit 43b2c6db.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

hlqkj
Member
Posts: 38
Joined: Wed Dec 11, 2019 20:10
GitHub: hlqkj
IRC: hlqkj
In-game: hlqkj

Re: [mod] Biome library [git][biome_lib]

by hlqkj » Post

Turns out the repo was at 10a10897. So, I asked the admin to pull and tested for about a day so far: I'd say just wonderful! No lag spikes anymore! Thanks so much for your efforts :)
Quando omni flunkus, moritati.

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [mod] Biome library [git][biome_lib]

by VanessaE » Post

I highly advise all users update to the latest available release of this mod (as of early today, that'll be commit 531577af). Critical bugfixes!

Turns out there's an engine bug, the effect of which has gone unnoticed for a very long time, perhaps because this mod's performance wasn't so great in the past. The engine's map generator is sending bad data to biome_lib under some circumstances, causing it to leave rectangular strips of bald terrain. The slower the mod's performance, the fewer and smaller those bald spots were (to the point that they might look intentional).

With Warr1024's help, I have implemented a workaround. It's a little ugly code-wise, but it works perfectly, and it shouldn't cause a noticeable performance penalty (or it doesn't appear to be the case on my end anyway). Besides git, fixes have been deployed to the Content Store and are in the latest Dreambuilder build as well.

Also, lag control has changed somewhat. In your minetest.conf, you can set the variable biome_lib_queue_run_ratio to negative values now.

When given a positive value, biome_lib will skip globalstep ticks between actions that put something on the map. It's essentially a percentage, so a value of, say, 25 would tell the mod to do 25% of an action per tick on average (or if you prefer, roughly 4 ticks between actions).

When given a negative value, it'll be made positive, and that'll become the number of actions to run on every single globalstep tick, skipping none at all, so a value of say -50 will run up to 50 actions during every tick (if there are that many).

The default is -100, so a modest 100 actions per tick, with none skipped. This is somewhat conservative on PC's/servers and Minetest builds that aren't stuck in the dark ages. ;-)

For example, my 2.8 GHz Phenom II, with Minetest 5.5.0-dev and LuaJIT, manages between 200 and 600 events per tick, roughly, depending on their complexity.

The faster your machine is, more negative you can set this value without causing appreciable lag. There's no minimum/most negative limit (apart from what your computer can handle), and of course the maximum is +100.

Note that in the code, one "action" will be one of placing a single node, running a function, spawning a tree or bush, or stepping to the next block in the queue and reading it in. Each action is supposed to be fairly tiny, time-wise.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [mod] Biome library [git][biome_lib]

by VanessaE » Post

More updates: I've been tinkering with the mod to improve its performance some more, and the latest changes do this by reducing its workload. Instead of blindly enqueuing every map block the engine throws at it, biome_lib will now limit itself to only those blocks that are at least partly within the elevation range specified by the mods that use it. The default used to be -31km to +31km, but I've reduced it to -16m to +48m. This isn't a hard limit though -- if a mod specifies elevations outside of this range, the total range the mod will check will be expanded automatically.

This will have the side effect that things like "floatlands" probably won't get any new coverage anymore since such things tend to be at high altitudes, and mods likely won't explicitly ask for things to be put way up there, but those mods whose foliage has gone missing from those areas can be easily altered, if needed. However, in the interest of performance, extreme elevation/altitude ranges should be avoided for now. The wider the range, the more map blocks biome_lib is forced to add to its queue, since it only establishes a single overall range (I plan to address this in the future, if it turns out to be needed).

The mod does some other minor trimming of its queue as well; all else being equal, I would say the total block queue will now be only 10 to 20 percent of its previous size, and the deferred queue should auto-expire more readily as well, leading to a bit less memory usage and quicker shutdowns.

Apart from that, the latest updates bring with them a config change: to avoid issues with old setups, biome_lib_queue_run_ratio has been changed to biome_lib_queue_ratio since its behavior changed a few commits back. I should have changed it at that time, but better late than never (and it didn't really break anything, it just meant that some setups could end up temporarily running unreasonably slow relative to their real capabilities). Also its default has been changed to -200, to make things run a bit faster. That's still pretty conservative relative to a modern gaming rig's abilities, but should be about right for the more understated PCs, laptops, etc. that people seem to favor for playing Minetest.

The mod will now also try to give you some idea of an ETA when playing-out the rest of the block queue at server/game shutdown.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
VanessaE
Moderator
Posts: 4655
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

Re: [mod] Biome library [git][biome_lib]

by VanessaE » Post

Update: biome_lib will now try to pass its item/action calls to the engine's built-in mapgen decorations feature, where practical, rather than always placing things manually.

Since the decorations feature only has a handful of options that correspond to biome_lib's options, this will be kinda limited. For example, only 3 of the 50-ish items/actions defined in Dreambuilder will actually be passed on to the engine, the rest will be handled by biome_lib in its usual way. Still, it's a small performance boost. Also, items handed to the engine in this way will appear in realtime as the map is generated, rather than "building-up" over time after a short delay, like they previously had been.

Please make sure you have decorations enabled in your world settings (this is usually set when the world is created, alongside things like caves and dungeons; I am not sure how to enable it after the fact if it was initially disabled).

In addition, for modders who use biome_lib:

* The API code and the active mapblock queue code have been split into separate files, and the mapblock queue will now be entirely disabled if the mod detects that all of its actions/items have been translated into engine decorations are being used (in essence, biome_lib will detect if it's been rendered inert :-) ).

* In all cases, using the old "method-like" colon notation to call a function, i.e. biome_lib:foo_bar(), is now deprecated. All functions have been renamed, in some cases drastically-so, and in any case, the more usual period notation should now be used, i.e. biome_lib.foo_bar(). There are compatibility shims in place to avoid breaking old mods, which will print "deprecated" warnings, and API.txt shows the new function names.

Windows users, make sure you're on release/tag 2021-04-23-2 or you will probably get weird "not enough memory" errors.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 10 guests