Rename Perlin noise to (fractal) value noise#15858
Conversation
|
|
||
| Perlin noise creates a continuously-varying value depending on the input values. | ||
| Value noise creates a continuously-varying value depending on the input values, | ||
| it is a simpler (but faster) version of Perlin noise. |
There was a problem hiding this comment.
I suggest turning this into two sentences:
Value noise creates a continuously-varying value depending on the input values.
It is similar to Perlin noise, but interpolates between random values instead of
gradient vectors.
- both 'simple' and 'fast' generally have positive connotations, so negating one over the other using 'but' reads unnatural
- I'd argue that performance is not a property of the noise itself, but of its implementation, even though a noise itself can be designed to be easier on compute. keep in mind I'm not an expert though :p
There was a problem hiding this comment.
Performance is supposedly higher, because interpolating between values is simpler than interpolating gradients.
But it will likely be a small constant. In the FastNoiseListe benchmarks, 2D value noise is about 16-24% faster than Perlin noise across three implementations.
|
@sfence this specific PR does not break any API compatibility, it simply introduces a deprecation due to a rename |
|
@wmikita Valid point for get_perli, not for |
global Lua-facing classes aren't touched here yet. the idea is to generate a deprecation warning when somebody tries to use them, similarly to |
|
@wmikita My error, I missed line |
|
As far as I can see:
So why are you renaming these APIs to "value noise" here then? That will be obsolete again with your follow-up PR. |
I did not plan that when I created this pull request.
It's ugly and limiting though. Only a subset of the FastNoiseLite library currently used is available this way. The integration into the old noise API primarily serves the purpose that people can see the difference between the noise quality generated for an actual mapgen, in-game.
It will be only obsolete if that second pull is merged as is, and we do not end up making a much better noise API. |
I suppose what you'll have to figure out is: what are the plans for these noise APIs and your second PR? Will a separate general noise API actually happen (this rename would then make sense), or will the current API become the general one (should choose a different name then)? The reason to think about this now is that we shouldn't end up renaming and still having an inaccurate name, or even renaming twice. |
|
@grorp I don't think I would suggest to do it the way the second pull hacks noise into the existing API via flags. |
sfence
left a comment
There was a problem hiding this comment.
Looks fine, and works as expected.
| core.get_perlin = core.get_value_noise | ||
| core.get_perlin_map = core.get_value_noise_map | ||
| PerlinNoise = ValueNoise | ||
| PerlinNoiseMap = ValueNoiseMap |
There was a problem hiding this comment.
Why is this code block in deprecated.lua and env.lua at the same time?
There was a problem hiding this comment.
I understood the emerge/env to only apply to the voxel manipulator emerge context, whereas builtin/game seemed to apply to the entire game context.
Maybe this could be better documented.
There was a problem hiding this comment.
i have some minor suggestions, but nothing which really needs something to be done about it.
the reason i originally wanted this to be no squash is because while the C++ renames should be pretty uncontroversial 1, the Lua api deprecations are trickier, so i wanted that in a separate commit. but now that the warnings are gone it's fine.
the "new" aliases don't need to support the deprecated multi-param calls (but i can see why it might be more convenient to keep them, so 🤷)
the docs should probably mention that the new aliases are 5.12+? 2
Footnotes
-
why no mention of the fact that it's value noise in the C++ names? i suppose this is to facilitate adding perlin noise later? ↩
-
not sure if we have a policy on this. in principle modders should use the docs corresponding to the luanti version they are targeting, but we typically include such version numbers nevertheless ↩
Fixes #15775: rename Perlin noise to (fractal) value noise, which is what is actually implemented.
I tried to add aliases for the old names. But I'm not sure what is the best way to generate a deprecation warning for the global lua classes such as
PerlinNoiseandPerlinNoiseMap, don't want to break anything. But these old names are probably not going to be removed the next 5+ years anyway...This needs to be fine-tuned by an expert on the Luanti Lua API.
In the future, actual Perlin noise or simplex noise could then be added for new mapgens.
For example the fast https://github.com/Auburn/FastNoise2 library is C++ and MIT licensed.
See also: