PilzAdam wrote:There is no Lua function (yet), but maybe you can port this to Lua:
https://github.com/minetest/minetest/blob/master/src/mapgen_v6.cpp#L301
prestidigitator wrote:I was already working on the noise generation (noise.cpp) as it turns out. Ported to Lua but not yet tested.
PilzAdam wrote:prestidigitator wrote:I was already working on the noise generation (noise.cpp) as it turns out. Ported to Lua but not yet tested.
You know that there are functions in the Lua API for that?
prestidigitator wrote:PilzAdam wrote:prestidigitator wrote:I was already working on the noise generation (noise.cpp) as it turns out. Ported to Lua but not yet tested.
You know that there are functions in the Lua API for that?
I understand that some noise APIs are exposed, but it is not obvious whether these are exactly the same noise functions that will duplicate the calculations of mapgen. The translation to pure Lua wasn't that bad really. There are just a few gotchas such as Lua not having bit-wise operators, so I had to implement an xor() function using modulo and powers of two. I don't expect it to be particularly fast, of course.
PilzAdam wrote:The Lua API is just a wrapper to core functions, so the noise is definetly the same.
And speed is a very important point when it comes to mapgen, so you should optimise the slow noise functions.
local perlin = minetest.env:get_perlin(9130,3,0.5,250)
local noise = perlin:get2d({x=x+150,y=z+50})Users browsing this forum: Bing [Bot] and 11 guests