[Mod] Natural slopes [naturalslopeslib]

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Natural slopes [natural_slopes]

by azekill_DIABLO » Post

climbing slopes is a bit abrupt, a more detailed collision box should be better... Homedecor should have some examples!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

I started with a box that had 4 or 6 layers. But it was buggy and you would be stuck on corners way too often. Sometime I was even stuck while simply following a slopped edge. That was far worse than having only 2 steps, with which I haven't noticed any relevant issue. I haven't spent hours on this issue, but I'm fine with this.

Also there's something equivalent with smooth slopes: it looks like you can jump on 2 nodes (a full block with a slope on it), because the far low end of the slope is at the same level than the top of the full node. But you can't. And you must not unless you change the gameplay.

So smooth rendering is eye-candy, but with time I'm more convinced that it is a wrong good idea (but not convinced enough to remove it completely yet).

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

Image
My apologies, Karamel, my ability to nitpick and find issues in even the most solid software, is legendary in some circles.

I decided to try and see if I could garden on a slope. The hoe does not effect sloped ground. I made garden soil with the hoe out of range of water and next to a slope. I put grass on the bare ground that resulted after the system checked for water and changed the tilled soil to bare ground. Then I got this odd arrangement in the soil. I think the shape propagated with the ground cover. Probably, when grass or something is on a patch of sand, soil or whatever, it should remain or revert to cubic. I would prefer to have crops and grass on slopes, but having vegetation hold the structure of soil and making a cliff when the rest of the are degrades to a slope is something found often in nature, so It think it works. I am not sure that the ground should revert to level when you place something, but I think that would be the easy way to program it to pass visual inspection.

One more thing, When I make a row of gravel on level ground, it becomes a slope facing one way. I think a pyramid, preferably rounded for a single gravel and a prism or half cylinder for a row would be better.

I do have to warn you that fixing these issues so quickly and well just encourages us to find more and complain. :)

All in all, this is a great mod and I can't see running Minetest without it. It looks better and it plays better with no lag that I can detect.
Attachments
New angles.jpg
New angles.jpg (263.36 KiB) Viewed 1609 times

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

Otter wrote:The hoe does not effect sloped ground.
I haven't picked the default behaviour of nodes once they are sloped. I was planning to take care of the growth of the grass, I'll have to pick interaction too. I don't know if there is a way to automatically to this. It would be wonderful because that would mean the lib is automatically compatible with most games and mods, but I'm skeptical about this. I'll probably handle Minetest Game because of it's state to have a show-case and let other games to handle the compatibility.
Otter wrote:Probably, when grass or something is on a patch of sand, soil or whatever, it should remain or revert to cubic.
The nodes are indeed expected to get their full node shape once something is put on it. There should never be anything on a slope but I may have not tested this feature enough. Anyway, the dry grass slopes are clearly bugged, I don't see any reason they would have got this shape. Be sure that you have the latest version (0.5 at the moment) and you don't place slopes directly. If you still have slopes in your inventory I suggest you to /pulverize them or place them and dig them to get the full node. You are not expected anymore to be able to directly place slopes.

Can you give yourself server privileges and run /updshape while standing on thoses bugged nodes? If they revert back to their full shape, it's an update trigger bug (or not if you placed the slopes by hand). If they stay and there is a message reading "natural_slopes:dirt_with_dry_grass_slope cannot have it's shape updated" it's a detection bug.
Otter wrote:One more thing, When I make a row of gravel on level ground, it becomes a slope facing one way. I think a pyramid, preferably rounded for a single gravel and a prism or half cylinder for a row would be better.
I don't know if I would handle more specific shapes, there can be three more pyramidal shapes for isolated nodes, one-neighbor ends and thin line. It may become too much, probably an option for low-end servers. Stay tuned.
Otter wrote:I do have to warn you that fixing these issues so quickly and well just encourages us to find more and complain. :)

All in all, this is a great mod and I can't see running Minetest without it. It looks better and it plays better with no lag that I can detect.
Thanks :) A little lag is expected on map generation with the current code (so big lag once there are 10 explorers). There are currently so little nodes that can update that it works relatively fast. Once there are slopes for almost everything I'll probably have to make compromises and optimizations.

Also thanks for discovering all those bugs. When you release something and you don't have bugs it's either that you have strong automatic tests with super-duper use cases that could power an infinite improbability drive, or that you don't have users doing things.

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

I want the programming environment they used in the movie Swordfish. (Your program is 90% done. Your program is finished and has no errors.)

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

I made a test to see if other shapes would replicate.
Image
This is an infectious slope that piggybacks along with the dry_grass.

Eventually it can make for some cool terrain though.
Image

This may be one of those bugs that I kind of miss when it is gone. Download this mod quick while it still has this flaw!
Attachments
Cool terrain.jpg
Cool terrain.jpg (258.98 KiB) Viewed 1609 times
infectuous slope.jpg
infectuous slope.jpg (193.93 KiB) Viewed 1609 times

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

Version 0.6 to fix that cool feature. If you want to farm slopes with grass, dry grass or snow, use v0.5. Grass still cannot grow a dirt slope though (as well as snow), it's an other issue that requires to overwrite the growth ABM from default. I'll do it later because it's only a compatibility issue with a single game instead of generic features.

It also adds the pike shape for isolated nodes (it's a slab with cubic rendering) and force reverting to full node shape when placing something on a slope. No more flying grass.

So why is there only the pike and not the conic-end shape and thin line? Because thinking about it, it will add much more shapes to handle, at least with the smooth shape rendering mode. I find the results rather fine with the current shapes and the cubic rendering. Sub blocks don't connect everytime, but it's not a big deal while it is with smooth slopes.
Spoiler
View from above. X are blocks (in any shape, it doesn't matter), O is the described node.

Code: Select all

X X
XOX   XOOX  XOOX
X X         X
Every O are thin lines, but if I make an extruded triangle shape, it will looks odd in the first case and good in the second case. If I make an hyperbolic shape, it will look good in the first case and bad in the second. And for the last case: one node will look bad in any cases because of the corner on the left.

Code: Select all

X
XO   YO
X    X
Both are an end-corner but in the second case, Y is an outer corner. So again with the smooth rendering, it will looks odd in the second case.


Code: Select all

XO
 OX
Both nodes are outer corners. Again with the smooth rendering it looks odd.
Adding new shapes or trying to get a real smooth look will require some more checks, but every check can be multiplied by a lot when it comes to massive update (for the ABM or the generator). So for the little it adds I'm not convinced it's worth it. An other solution is to create meshes on the fly with Bézier curves. Completely out of scope.

Also like exposed before, when there is a slope on a node with the smooth rendering, it looks like you can jump-climb both nodes. When you jump, you get on the same height than the base of the slope so it would be sensible that you can get on it, but you can't. It happens very frequently on sand or gravel slides in caverns. It doesn't happen with the cubic rendering because the lower end of a slope is already half-node high. So it's clear in that case that you can't jump on it.

For these reasons it's very likely that I drop the smooth rendering mode in the next version. I'll include the meshes for the cubic rendering to break the dependency with stairs. The thin line and end-corner can then use the pike shape. That will also give me less things to maintain.
Otter wrote:I do have to warn you that fixing these issues so quickly and well just encourages us to find more and complain. :)
Are you French? ;D

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

karamel wrote:
Otter wrote:I do have to warn you that fixing these issues so quickly and well just encourages us to find more and complain. :)
Are you French? ;D
If only.

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

Karamel, great work! The pikes are good. A checkerboard of them is an interesting terrain. I think you have come close to finishing this with version 0.6

I have three thoughts that are probably worth considering but might should be ignored. ;)

My original thought on slopes was a half spill to one of the areas around and then shift like fences do to adjust. I think your method of keeping volume and not flowing to surrounding areas has less lag and less potential for messing things up. Your method is more contained. I am thinking an additional mod combined with your mod might be interesting. If gravel (or sand) that is stacked up dropped a gravel to the side, then slopes of gravel would evolve from cliffs or towers of gravel.

If you dig a hole in the sand, you get, by appearance, a big hole as the slopes form around it. An inverse pike might be worth considering. Probably not though. As it is, a deep hole in the sand gives a giant sand lion lair.

The straight path of gravel 0.6 makes is probably better for a road and is easier to work with and build with. It does however lack the elegant grace that the rest of your mod engenders.

In any case, this is a great mod. I think it needs to be included in the main build. It makes play better and the look of the game much, much better.

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

And now, 0.7. With texture enhancement, no more smooth rendering, a little code optimization (just a small little) and more options to tweak resources consumption.

There is no ABM anymore, instead it is replaced by (not that) small area updates from time to time. There is still a lot of room for optimization for both on-generation and on-time area updates. In fact it may be currently slower than the ABM but it covers all the managed nodes at once. I'll need to enhance the surface detection for further works too.
Otter wrote:I am thinking an additional mod combined with your mod might be interesting. If gravel (or sand) that is stacked up dropped a gravel to the side, then slopes of gravel would evolve from cliffs or towers of gravel.
I don't understand well. Do you mean if you put a lot of gravel on above the other the top ones will fall on the sides and make a pyramid-like mount of gravel? That's roughly what sedimentology does and I'll probably tweak it a bit to get more effects.

There are two problems with the inversed pike. It will add some more checks to get the nodes above and a few more to check if these are slopes (I only check if it is air or anything else right now). Because if you dig under your feet and the node even below turns into a pike, you are stuck in your hole until the slopes forms.

About the gravel path, my main motivation was to "build" walkable paths, so work completed! But natural_slopes is not supporting human constructions. It works with gravel because it is a non-dense material that can flow a little. It may work with cobblestone (not in 0.7) and I was thinking about stone erosion but it would be better to have a sculpting tool for that matter and keep the shape when digging and placing. You don't break stone by walking on it, then mine it and tadaa! a full block.
Otter wrote:In any case, this is a great mod. I think it needs to be included in the main build. It makes play better and the look of the game much, much better.
Thanks for your support. But I don't feel it is ready for release. It is close to beta-state but there are still a few issues. First for dirt transformation (and generally anything similar), second for multiplayer to keep a rather constant update frequency around every player and third for performances.

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

6.0 had a hills of Virginia feel. 7.0 is more like the Edwards plateau. I like 7.0, There are advantages to the new, but for play, I am going back to 6.0. Even with the graphic flaws and a few odd placements, 6.0 is more fun.

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

Switching between version 0.6 and 0.7, I like 0.7 for grass and 0.6 for dry grass. I realize that speed for servers is important, but I am focused on the experience and the slopes on the grass give the game a much richer and more real look. being able to see down the 45 degree slope you are about to run down is a totally different feel from hopping down one ledge after another pausing to be sure it is not a cliff.
With the meshes I can simulate the beginning of "The Sound of Music." Without the meshes the illusion breaks down pretty quick.
On the other hand, the dry grass with the more blocky slope has much the same feel as some of the dryland I have hiked, so I like it quite a bit.

I am aware that the meshes are a pain to adjust and maintain. For me,:) a solo user who does not do any of the work, the meshes are wonderful and make the scenery twice as realistic as before. This is a huge jump in visual experience. The meshes may be work, but they are the difference between this mod being a nice and worth using mod and being a mod that absolutely changes everything.

So my odd proposal is that version 0.7 and 0.6 be merged. A few settings should be added. Snow should also be managed.

In both 0.7 and 0.6, there is a bit of an issue that makes working the ground a pain. When I dig a hole in the dirt there is about a fifty-fifty chance that one of the surrounding blocks of dirt will become a slope. When I fill the hole with something, the slope will never revert back to level on it's own. This means that making a garden with a small water pool to keep it working, can be a bit of a pain.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Natural slopes [natural_slopes]

by azekill_DIABLO » Post

+1 for the 0.7 update! it looks very nice and works well! (if I ignore the 25fps drop, but that not a problem). The only thing is that sand slope seem to generate super fast and dirt takes much more time to do so... Is it intentded?
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] Natural slopes [natural_slopes]

by ManElevation » Post

Wow versión 3 actually makes this look 5 times more awesome
My Public Mods! Discord: Rottweiler Games#3368

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

Otter wrote:So my odd proposal is that version 0.7 and 0.6 be merged. A few settings should be added. Snow should also be managed.
Do you suggest I get back the smooth rendering but leave the visual bugs from 0.6? If it's only that, I can include some meshes, disable face by face texturing and keep the cubic rendering the default mode. Then I may put later (or if someone wants to do it) more checks and shapes and add a setting for the light check with a decent set, or the extended ones only for the smooth rendering mode (or maybe even 2 mods).
Otter wrote:In both 0.7 and 0.6, there is a bit of an issue that makes working the ground a pain. When I dig a hole in the dirt there is about a fifty-fifty chance that one of the surrounding blocks of dirt will become a slope. When I fill the hole with something, the slope will never revert back to level on it's own. This means that making a garden with a small water pool to keep it working, can be a bit of a pain.
I wasn't able to reproduce it. I dug a hole and made all surrounding slopes. I put a water source in the hole and waited, they got back to the full node shape. It can be much more longer than in v0.6 though. If you want fast revert, you can put anything on top of it.

Can you stand on the faulty nodes and run /updshape with server privileges to see if it's really a bug or if it's only that the trigger is too slow?
azekill_DIABLO wrote:+1 for the 0.7 update! it looks very nice and works well! (if I ignore the 25fps drop, but that not a problem). The only thing is that sand slope seem to generate super fast and dirt takes much more time to do so... Is it intentded?
Thanks for the feedback. I'll try with my old netbook with has now less RAM and CPU than a smartphone (but Minetest still works!!!) to try to get some optimizations.

If you try to disable "Enable automatic shape update" from the advanced setting, does it still have that huge drop? If yes, it comes from the new models and textures. If not its the area updater that requires tweaks. Also, did you had this drop on 0.6 too?

Right now sands have 1 of 5 chance of updating, while dirt has 1 of 10. These are not final figures, but its intentional that sand updates itself more often, as it is less structured than dirt. I put that figures rather randomly, beside ones being higher than others. You can tweak the values in nodes/default.lua (they are the last number of each declaration) and post a descent set if you want.

Also if you updated from 0.6 to 0.7, the already generated areas aren't massively updated. When an area is generated with the mod enabled, it comes with a lot of slopes already, then it changes very slowly. On 0.6 it was . You may play with natural_slopes.area_chance_update_shape on player join if you want to force the massive update (it's declared in update_shape.lua around line 90).

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

Yes a block on top or /updshape fixes the issue. I have been running 0.7 quite a bit and comparing. I use different worlds for both0.6 and 0.7. I left Minetest running and walked away from the computer for a few hours and came back to find the shapes were still there. I should have looked at the code first before I spoke. Your code is well written so it is close to readable even for someone who knows very little Lua. (That would be me.)

I started looking over your code in 0.6 and 0.7. Well done. Seriously, you do great work. Your code is clear and well described.

Making snow work with slopes has been bothering me. That is why I started looking through your code to try and see if there was a good way to manage snow and plants on slopes.

I don't have any good ideas on how to manage snow. Here are my ideas on managing snow, in the order of how fond I am of the idea. Some of these ideas are pretty bad.
1: Ignore Snow. Eliminate it as the scourge it is. When it hits a slope, it melts or slides down the slope. Plants die. They can't handle slopes. Rosemary does not exist. If plants exist before the slope is made, they prevent it from becoming a slope. Otherwise, the seeds roll down hill and plant below the slope if they do anything at all.
2: Incorporate the snow layer into the "default:dirt_with_snow" and make a "natural_slopes:slope_outer_dirt_with_snow_and _snow." This will require a whole slew of extra meshes and textures.
3:Draw the node above the slope with an offset. In the Australia mod, there are blocks that draw past the edges of the block. Some of the tree fronds are like this. This might work for snow, but you might end up with an object in one block being mostly drawn in the one below it. Plants could be drawn offset lower than the node they are in to prevent floating plants.
4: Come up with a method of creating new nodes on the fly that combine two nodes sort of. This would allow multiple nodes to exist in one node. Then if you drew one node offset over the other you could have it displayed. This would also fix plants and make debugging nightmare the likes of which can only currently be found in Windows Office.
5: Have the mod give Minetest the ability to be able to have blocks consist of eight sub blocks half the length, depth and width of a normal block.
6: Fork Minetest.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] Natural slopes [natural_slopes]

by azekill_DIABLO » Post

I have the solution: it's inclued in villages_modpack and it's called moresnow: it allows the snow to adapt to the block it is on, like stairs! so it wold be simple to adapt it :)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

Version 0.8 and guess what? The smooth rendering is back (but not enabled by default).

I made some tests for the area update on time and it was completely counter-productive. I switched back to a lighter and faster update without VoxelManip. It's not interesting if you are not planning to update huge percent of nodes. If it is faster for a single node, it has a big general read/write cost.

I'm losing a few FPS with the slopes themselves on my old notebook (from around 10 to 7-8fps), but I haven't noticed significant drop when walking or when the timed-events triggered (ant it's single-cored). It may be only related to having a few more polygons, meshes, lighted faces and textures to handle. I don't know, it's probably something else.

The new check updates one node (yes one) every 5 seconds by default (instead of 30s), but it will almost always get an interesting node. That is on the surface instead of purely randomly. That reduced the time from around 200ms on my local server for a change (which checked for a bunch of fully random, most of the time in air or underground), to around 2ms.

It uses the new feature from poschangelib v0.4, so you must update this one too even if it doesn't add anything by itself. It adds compatibility for some next mods (and footprints on slopes which are not included).

I looked quickly at moresnow, it's very interesting. It may works without doing anything (or just a very few things) but I haven't tested it yet.

User avatar
Otter
Member
Posts: 152
Joined: Fri May 12, 2017 21:17
GitHub: InfiniteOtter
In-game: Otter

Re: [Mod] Natural slopes [natural_slopes]

by Otter » Post

karamel wrote:Version 0.8 and guess what? The smooth rendering is back (but not enabled by default).

I'm losing a few FPS with the slopes themselves on my old notebook (from around 10 to 7-8fps), but I haven't noticed significant drop when walking or when the timed-events triggered (ant it's single-cored). It may be only related to having a few more polygons, meshes, lighted faces and textures to handle. I don't know, it's probably something else.
As I play around on different machines, operating systems and versions of Minetest, running out of memory to process is where slopes seems to have hiccups. I have seen this happen on a laptop with 16 gig of ram so it is not a lack of physical ram that is causing issues.
On windows, using sfan5's minetest-0.4.16-b20d01a build,https://minetest.kitsunemimi.pw/builds/, seems to resolve most of the issues.

My suspicion is that when Minetest 0.5 comes out, drawn slopes may be faster than blocks. The difference in sloped angles and square angles is of no concern to the graphic processor. A block drawn is three sides so it is at least six triangles. A slope will usually reduce the three sides shown to two sides. While a slope can force drawing of another side of a block beside it, I suspect the interface of the computer language to the graphics processor is where we have the awkwardness coming from. This is all speculation, but it would not surprise me if a lot of the memory leaks from drawing will go away. If I am right all we will have left to fear is textures. Textures are what really seem to bog down graphic processors.

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

Re: [Mod] Natural slopes [natural_slopes]

by karamel » Post

Version 0.9

I got a few more FPS by disabling backface culling on slopes but I don't expect a massive enhancement.

The smooth rendering would be indeed a little faster. But we are talking about at most a few hundred triangles. Not that much at first sight.

Apart from that, the slopes from Minetest Game are now a little more likely to happen. And some bugfixes. I'm waiting for Minetest 0.5 to make the last updates but I thing this mod is ready for 1.0 now.

This mod may be included in a modpack with poschangelib and an other mod that adds shaping events. This will allow to have better compatibility (like grass growing on dirt slopes) without bulking the mod for other games.

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

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Since the latest release, I was working from time to time on this mod for an other (unreleased) project. Maybe it's time to make some updates...

This is now version 1.0, as it seems to be rather stable. I took the opportunity to make some breaking changes...

This mod does not include any change by itself anymore. If you want to use it with Minetest Game (mostly as a showcase), check naturaslopes_minetest_game within the downloads.

If you used the library with other mods, the mod name has changed, as well as the associated functions (not the actual name, just the prefix). The registration method was changed too (see below).

The library is fully compatible with Minetest 5, support for Minetest 4 was dropped along the way.

Also, a few things new with this version:
  • Slopes can happen on ceiling (mostly useful with stone slopes for caves)
  • A group is added to each slope: family:<original node name>, so if registering slopes for default:dirt, all slopes will have the group family:default:dirt. It is more or less a convention I set myself to bind ABM or selection to the original node and some variants easily.
  • Slope registration was simplified by setting changes from the original node instead of having to copy everything
  • A new map generation method for single-core or low CPU, the progressive method make the transformation continuously little bit by little bit instead of everything at generation-time. The default method still uses VoxelManip on map generation which is overall much faster.
  • A new method to copy stomping for each slope
  • A detailed API documentation, inspired by the lua_api.txt documentation

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [Mod] Natural slopes [naturalslopeslib]

by ShadMOrdre » Post

I've been using this mod for some time now. I've only used it for the softer materials, dirt, sand, clay and some leaves. I had always avoided sloped stone, preferring the jaggedness that the block nodes provide for stone.

Until now. With this update that now includes inverted slopes, and in a more easily updatedable package, I'm sold!!!

Using a slightly modified version of this and the poschangelib mod, I produce this, badly needed screenies for an awesome mod!

Image
Image

Performance does not suffer, IMHO, with this mod running. I use this mod to create sloped variants of my gal_ enabled mods, (formerly lib_shapes, lib_materials and lib_ecology). These mods add hundreds of material, plant, tree, liquid nodes, and nodebox variants of many tree and stone materials. My current node count is already in the thousands, and this mod adds thousands more for the hundreds of nodes that actually get sloped. Heavy, no. Any mapgen times in my screenshots are due to the inefficiency of lib_ecology decorations, and the current voronoi / 3D noise custom mapgen.

My customizations include folding poschangelib into my gal libraries project, updating the current naturalslopeslib mod to use the corresponding poschangelib functions in gal, and looking into how I can fold naturalslopeslib itself into gal as well. The only snag I encountered was that naturalslopeslib mod needs to depend on any lua mapgen for the nodes to be sloped at generation.

Great job here, karamel!!!!!

Shad
Attachments
screenshot_20210102_210223.jpg
screenshot_20210102_210223.jpg (296.56 KiB) Viewed 1609 times
screenshot_20210102_213006.jpg
screenshot_20210102_213006.jpg (199.25 KiB) Viewed 1609 times

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 message. Your landscapes look great, may I embed them in the first post?

I looked quickly to GAL, but couldn't find your modification to poschangelib to understand your changes and see if I can merge it or update it to make it possible without editing the lib. Can you point to a commit/diff/file or explain me the changes (probably in private message or there viewtopic.php?f=9&t=18170 )?

About the limitations, there is currently no way to order functions called on generation outside playing with dependencies to make sure minetest.register_on_generated are called in the desired order (at least, there is an ugly one I used to force a callback to be the first one elsewhere...). I don't know if I can add something to control when the registration is done, to have more control over the mapgen. Basically it should be the last like you do by adding dependencies, and I can do that (but if other mods register things the last too, that doesn't work :D ).

An other issue I've found is that the borders of a map chunk are not updated on generation with the VoxelManip method. I'll try either to suppose what could be outside the voxel area (and make some potential inconsistencies) or check neighbours when an other chunk emerges.

Also I plan to add more control on the hardness of the nodes, to separate chances on generation, time and walking/placing (by still keeping one value for the same and compatibility). Currently the only way to have smooth stones on generation is making them soft, but that means they erode quickly when you walk on them...

That should be enough for a new release, it may also fix the issues I'm facing while creating a mod for Hades Revisited (every time I play a game I miss the slopes now).

ShadMOrdre
Member
Posts: 1118
Joined: Mon Dec 29, 2014 08:07
Location: USA

Re: [Mod] Natural slopes [naturalslopeslib]

by ShadMOrdre » Post

karamel,

The changes that I made to implement poschangelib into gal are listed here: gal.lib.poschange. It is really nothing more than renaming the poschangelib namespace to fit within gal.

As for the naturalslopeslib, the reasons I cannot implement this in the same way, is that naturalslopeslib requires naming the slopes to itself, instead of to the mod from which the underlying materials come. default:stone becomes naturalslopeslib:slope_..._stone. Additionally, the lua mapgen must run before naturalslopeslib, or the slopes are never updated on_gen. Because my gal enabled mapgens are seperate mods, at the moment, this complicates matters. Due to this, I may also just fold the mapgens into the gal mod also, since they are only code, with no content. The content mods will remain seperate from gal, which should largely remain a code base.

In my gal project, I am using a function to register all "materials" type nodes to gal, so that nodes are named "gal:nodename", instead of being registered to the mod defining the node. This greatly simplifies the creation of a singular ontology of names for nodes. This singular ontology is then rather easily updated to fit into practically any other MT game, such as MCL2, MTG, and others.


As for the "dependencies" issue, what I am discovering is that when using the actual MT provided functions, dependencies do in fact matter significantly. What I mean by this, is that using the minetest.on_generated function to actually store the logic, instead of a seperate function that is called within on_gen. An option to include into naturalslopeslib, would be a function that can be called from on_gen and also other mods on_gen, passing minp and maxp and the vm, if necessary, as parameters. duane's geomoria kinda does this, and his mapgen project takes it magnitudes further.

These are mere suggestions for folding naturalslopeslib into a larger library of functionality that is provided by solid mods, while reducing the headaches of dependencies. gal works with this concept in mind. I've included a nodebox shapes library, a voronoi library, and am working to implement a schematics library. The gal project also centralizes the player, hud, and inventory, adding significant functionality to the player and inventory, which are based on player_api, 3d_armor, hunger, elements from Adventuretest game, and sfinv and related enhancements.

Shad

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

Re: [Mod] Natural slopes [naturalslopeslib]

by karamel » Post

Version 1.1, the documentation was updated to reflect the latest changes and was extended a bit.

About map generation, the slope generation is done last (minetest.register_on_generated is called within minetest.on_mods_loaded) and this behaviour can be disabled by calling naturalslopes.set_manual_map_generation(). Then you can call the update functions from other mods to control everything.

The slope registration was extended with chance factors. You can define a factor for each update type, either for map generation, stomping, with time or when digging and placing. This allows for example to have smooth stones on generation that doesn't chip easily when walking over them or that "breaks" easily when an other node is dug nearby.

The registration can also be done from other mods, unchanging the node name prefix. Use naturalslopeslib.get_slope_defs to get the definitions to use with minetest.register_node and link them with naturalslopeslib.set_slopes. An example is provided in the documentation. The one-line automatic registration from within naturalslopeslib is still available.

Finally, the edge of areas are updated using the progressive method, which was sped up a bit with fast cpu. Even if the progressive update tries not to include a lot of lag by doing things, well, progressively, it's still more than nothing and may be slow with a lot of players exploring the map.

The mod for Minetest Game was also updated (version 0.2) to use chance factors and add a few missing slopes.

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests