[Mod] Natural slopes [naturalslopeslib]

User avatar
Mantar
Member
Posts: 584
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Mantar » Post

Hey I've got an odd texture thing happening in Exile, some of the nodes' side textures are correct, and others just seem to stretch the top of the texture downwards:
screenshot_20210219_001435.jpg
screenshot_20210219_001435.jpg (503.95 KiB) Viewed 3253 times
Any ideas on what's going on?
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

The buggy stretchy node is something I've already seen when tileable_vertical is false for that texture. Removing it by redefining the textures when registering the slope may do the trick. But it should make all the nodes buggy, not just some… Any idea what could differ between the pointed buggy straight slope and the good one nearby? They seem to be the same node type, have the same param2…

I also notice that the three kind of slopes have this issue (the inner and outer corners are also affected), so I'm a bit more confident about the texture definition, but the good one really bugs me…

Can you provide me your mod so I can take a look at it? (if you have a repository, a link to an archive, send by email that I can send by PM or whatever)

User avatar
Mantar
Member
Posts: 584
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Mantar » Post

I've got no clue what difference there could be. Here's the repo: https://github.com/jeremyshannon/Exile/tree/Development
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

As I suspected, removing tileable_vertical = false fixed the textures. For a quickfix I just removed it from nodes_nature/sediment.lua, line 334.

I discovered that without the fix it was still rendering well for nodes which position.y is a multiple of 16, probably something about aligning textures along mapblocks. I don't really understand what tileable_vertical is about, but it seems to have been deprecated in Minetest 5.4 anyway.

User avatar
Mantar
Member
Posts: 584
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Mantar » Post

Multiple of 16, eh? Must be engine weirdness.
tileable_vertical
Thanks, that's all I needed to fix it!
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Version 1.2

What's new?
  • Colored nodes can have their slopes. But the full palette cannot be applied as colorfacedir nodes can have only 8 colors instead of 256.
  • All change types (stomp, dig/place, time, map generation) have their global factor defined in settingstype, not just only on generation.
  • Tired of managing dependencies? Just call naturalslopeslib.propagate_overrides() somewhere in your code and any modification applied to a node after the slopes are defined will be propagated to the slopes too (not applied by default for backward compatibility). You then just need to add the dependency for the original node definition and what happens after is no longer a problem.
  • And a few bugfixes, not a big deal...

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by MCL » Post

Interesting mod!
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

User avatar
MCL
Member
Posts: 654
Joined: Mon Aug 20, 2018 00:44
GitHub: MCLx86
IRC: migdyn
In-game: singleplayer
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by MCL » Post

Hello,
I have seen a few (Minetest) games where this mod was used but the slopes were actual slopes, and to stairs.
Is it a feature that's in this mod or would I have to implement it myself if I wanted actual sloped nodes instead of stairs?

Thanks in advance, your mod is great!
2014-02-14 - 2024-02-14 TEN YEARS OF MCL

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

The actual slopes is the somewhat hidden smooth rendering. You can enable it in the settings before running a game. On the main menu open the settings tab, click on All parameters and check under Mods >naturalslopeslib > Smooth but glitched rendering (and enable it). This setting is set on the server side, so you can't change it when joining a game.

Or in your config file just set naturalslopeslib_smooth_rendering = true.

Thanks for your interest :)

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

Re: [Mod] Natural slopes [naturalslopeslib]

by Wuzzy » Post

The natural slopes are pretty interesting!
The landscape looks kinda interesting. Makes kind of a difference …

However, the behavior/gameplay isn't too great. The way the slopes get created seems to be random/unpredictable, there isn't a clear rule. That's a bit frustrating if you want to build. So the behavior isn't consistent, that's meh. Is the randomness intended?

The slope nodes shouldn't appear in the Creative Inventory IMO. What's kind of annoying are the slope textures, as they rotate (but they shouldn't). World-aligned textures will come to the rescue.

I feel like it would make sense if there is some gameplay value to this other than just eye-candy and different shape. What is especially weird to me that digging a slope or pike still drops you the full block. That feels so wrong.

Anyway, the idea is still very interesting and could be used to make maps more interesting.

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Thanks for the comment and feedback.

The randomness is somewhat intended, at least as a simple way to make it happen but not every time. The softer the material, the higher chance it has to "slide". There could me more predictable ways to do so, like adding some kind of HP for each node, but I thought it would be an overkill. If you have some ideas, I'd be glad to discuss them.

As for creative inventory and world-aligned texture, this is a bug in the game-mods implementation (or, are they? I don't know, I think fixed that a few times but it's still popping). I don't know, in a way it could make sense for slopes to be available in the creative inventory to put the right shape directly, but it's not because it won't be stable anyway. Personally, I don't think natural slopes makes sense for creative mode gameplay-wise, declaring craftable and stable stair-shapes for most nodes would be better and use natural slopes only for the mapgen. But everyone is free to include it anyway. That said, creative inventory is a mod, and I think it should be left to the game implementation to add a the group or not. I thought I added a way to alter the default changes, but it's not there.

The choice about digging the full node is by design. Because full nodes can transform into half nodes and the other way around, so you can easily exploit slopes to create material magically (Exile did that before fixing it), or lose a lot of material unintentionally. And it's a lot simpler for the inventory, to stack everything.

I would say it feel wrong when you make a game thinking about nodes nodes not being atomic. It may seems intuitive at first, but it feels so wrong for me: creating stairs is super-pain because of those half-nodes, overcrafting and some excess unusable material (like having 1 inner corner and 2 outer ones left and nothing to do with them). It's pretty consistent when your game says "a node is a node, be it full or half filled" (spoiler: this is included in a game I worked on, which is only a few years late in schedule and currently stalled. Creating stairs is just about a click from full nodes).

Gameplay wise, natural slopes are, well, natural. And you don't have 100% control over nature. That's the core concept I had when starting it. But just adding slopes is rather cheap, it just adds some smooth movements and eye-candiness and you're right about it. Some other things should be added if you want to exploit the gameplay extensions, like the ability for the shovels to make some gardening and get some control unless you use plants or whatever to keep the landscape sharp.

That said, I tried to keep the lib highly configurable, so almost everything I wrote above can be tweaked or disabled to fit your game need just with settingtypes or within the declaration of slopes. The core concept is making the landscape changing its shape by itself. What goes after is up to the game implementation, and the available implementations here are mostly showcases or advertisement for the lib (by the way, that's not that I could not fix things, I think you had tried it for Hades).

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Version 1.3 is mostly about fixes, either directly, or by easing the use of the library. These come with an update for Hades Revisited and Minetest Game. The natural slopes are now hidden in the creative inventory and the textures are correctly aligned. Beside this, mining tools can now shape slopes with their secondary use.

This update allows to play with the latest version of Hades Revisited, which brought some breaking changes with the growth of grass.

About the library, some fixes were made:
  • naturalslopeslib.chance_update_shape and naturalslopeslib.update_shape return true only when a node actually changed, instead of when it could change but not, because it was already in a stable shape.
  • The color of the nodes are kept when they change their shape.
  • Using "nil" to remove a property upon registration is now applied correctly.
To keep colors, a new parameter can be passed upon registration to convert a palette of 256 colors to one of 8 colors. By default the first 8 colors are mapped. For more extended palettes, the conversion allows to control which colors are lost.

And to ease the registration of slopes, some default parameters can be registered. Especially to handle dropping the original node when nothing is defined, adding parameters to textures or adding or removing groups.

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Version 1.4 is rather a minor update, and adds some uninstall stuff. The mod for Mintest Game was updated to 0.4 with a fix to the leaves decay.

Only two changes to the lib:
  • naturalslopeslib.get_all_slopes was added. It is almost like naturalslopeslib.get_all_shapes but doesn't return the block shape. Both can work with either the block name or any sloped node name (the documentation was updated).
  • A new setting was added to revert changes to be able to remove the mod after a while. When Revert is activated, an LBM will revert all slopes to the original block shape and prevent any further slope to be created, as if the mod was inactive. Beware though when using the GUI for local games as the setting is shared between all worlds.

User avatar
Mantar
Member
Posts: 584
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Mantar » Post

Exile's mods/mapgen/biomes.lua uses a hack to enable world-specific settings, so you could modify that code to allow Revert to be switched on or off for a specific world, perhaps with a console command.
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Thanks for the tip. Activating it for a single world from a chat command would be far better for singleplayer or local server, when the admin is also a player.

Some other settings could also benefit from being stored in world settings instead of being global.

User avatar
Mantar
Member
Posts: 584
Joined: Thu Oct 05, 2017 18:46
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Mantar » Post

You're welcome. I'm thinking I should write a separate mod to handle settings, including the world-specific hack, but haven't gotten around to it. It'd be nice if the Minetest settings infrastructure was sane in the first place, but I'm not holding my breath for that. :)
Lead dev of Exile, git repo: https://codeberg.org/Mantar/Exile

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Thinking about that maybe the mod storage could do the trick to save world settings. I haven't thought that much about that. I should have included it in this version, but I haven't that much energy for that currently.

Version 1.5 is available. It only includes a new mesh rendering from DanRPI that look even more natural with some roughness.

The settings were extended, you can choose one of the three rendering modes now (Cubic, the default one; Smooth, that wasn't changed and Rough, the new one)

naturalslopes.setting_smooth_rendering is now deprecated but still working. Use naturalslopeslib.setting_rendering_mode instead.

The configuration was updated too to change from a boolean to an enum for the rendering mode, but it is still backward compatible.

QBSteve
Member
Posts: 19
Joined: Wed Mar 15, 2023 00:00
In-game: QBSteve

Re: [Mod] Natural slopes [naturalslopeslib]

by QBSteve » Post

Just wondering, how would I get this mod to work with other mods (for example, the amazing ebiomes mod)?
Hello! I'm just some random person with an ancient 7 year old potato that is my laptop :)

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

The lib doesn't do anything by itself to stay compatible with virtually any game or mod. An other mod is required to activate the slopes for each game or extension. For example there are mods available for Minetest Game and Hades Revisited, and Exile is already shipped with slopes.

If you want Extra Biomes to include slopes, you will require to either add the slopes directly in ebiome (with naturalslopeslib being an optional dependency) or create a separate mod that activates the slopes like it is done for Minetest Game (with both naturalslopeslib and ebiome as dependencies).

Hopefully adding natural slopes is a (repeated) one-line thing for the basic cases:

Code: Select all

naturalslopeslib.register_slopes("<base node name>")
So you will "just" have to list the new nodes that should have slopes and pass them to naturalslopeslib.register_slopes, and everything is automatically handled by the lib, with some limitations. There are more options to tweak how often the slopes are created and to handle some intricate dependencies. And for a complete integration you will also have to check ABMs and other stuffs targeting a specific node instead of a group, so that they can also apply to slopes.

Hessed
New member
Posts: 4
Joined: Tue Dec 06, 2022 06:22

Re: [Mod] Natural slopes [naturalslopeslib]

by Hessed » Post

Hi
My game crash when i try to load the world with this message
AsyncErr: Lua: Runtime error from mod 'leaves_in_the_wind' in callback LuaABM::trigger(): ...games/mesecraft/mods/MODULES/leaves_in_the_wind/init.lua:29: attempt to concatenate a table value
stack traceback:
...games/mesecraft/mods/MODULES/leaves_in_the_wind/init.lua:29: in function <...games/mesecraft/mods/MODULES/leaves_in_the_wind/init.lua:13>
You said that in theory it should work in any game, right?

note: I tried it with a clean install of MT 5.7 and Mesecraft, with only this mod, and the same thing happens.

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Hello

From a quick look at the code from Mesecraft it looks like the ABM is expecting the tile definition to be only a texture name.

Code: Select all

texture = "(single_leaf_texture_mask"..math.random(1,2)..".png^[mask:"..
	-- Take this leaf's texture and mask it with the shape of a single leaf
	(minetest.registered_nodes[node.name].tiles[1] or "default_leaves.png").. 
	")^[transform"..math.random(0,7), --Flip it around for some randomness
minetest.registered_nodes[node.name].tiles[1] is crashing with leave slopes. Mesecraft is expecting only something like image.png while Natural slopes is using {name="image.png", <other properties>}. See Tile definition in doc/lua_api.txt for more details about that.

From what I understand, the "right way" to fix this would be in my opinion to check the tile definition format in leaves_in_the_wind so it becomes more mod-proof.

Something like this (I haven't tested this code):

Code: Select all

local leaf_texture = minetest.registered_nodes[node.name].tiles[1] or "default_leaves.png"
if type(leaf_texture) == "table" then
	leaf_texture = leaf_texture.name
end
texture = "(single_leaf_texture_mask"..math.random(1,2)..".png^[mask:"..
	-- Take this leaf's texture and mask it with the shape of a single leaf
	leaf_texture
	.. ")^[transform"..math.random(0,7), --Flip it around for some randomness
It still doesn't check for colored leaves or scaled textures, in case a mod is adding some, but it should not crash.

Updating Natural slopes to fix that will be much more complex and will just move the bug elsewhere.

Hessed
New member
Posts: 4
Joined: Tue Dec 06, 2022 06:22

Re: [Mod] Natural slopes [naturalslopeslib]

by Hessed » Post

I understand (a little at least haha). Thank you soo much for the explanation. I hope the Mesecrafteam does something about it.
Meanwhile it's time to play without this mod. Speaking of which... will it be possible to add it later? Or should I start a new world? What happens if I want to deactivate the mod in the middle of a game?
Regards!

User avatar
karamel
Member
Posts: 56
Joined: Wed Jul 19, 2017 21:51
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

I've opened an issue on Mesecraft bug tracker so they can be aware of that and fix it.

You can enable the mods later but all the already explored areas will stay sharp and it will take a long time until they become more sloppy (especially for stones).

There is a way to disable slope generation and revert the landscape in the mod settings but it will activate for all your worlds until the option is turned off (beware if you play on multiple worlds with naturalslopes). Or you can remove the mod completely from your world but every already generated slopes will look as unknown nodes.

I would also suggest disabling the leaves_in_the_wind ABM if it is the only source of incompatibility with naturalslopes and you really wish to play with slopes until the fix is available. You may do so by editing games/MeseCraft/mods/MODULES/leaves_in_the_wind/init.lua and remove (or comment out) minetest.register_abm({ and everything below. There will be no floating leaves until then and updating MeseCraft will reenable them.

User avatar
Komodo
Member
Posts: 163
Joined: Tue Jan 11, 2022 13:33
GitHub: MeseCraft
In-game: Komodo
Location: God Bless America
Contact:

Re: [Mod] Natural slopes [naturalslopeslib]

by Komodo » Post

I've implemented the fix into the untable branch of MeseCraft, we just need confirmation that the issue is fixed. Thank you @Hessed for reporting this and @karamel for suggesting a good fix.

Once the fix is confirmed to be working to resolve the issue, I can merge the fix into the main branch of the game.
🌎 Website | 🌲 MeseCraft Game | 📰 News | 🖌️ ContentDB

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests