Looks good, as I only found a few minor things to nitpick about. Ping me if you address any of these so I can re-approve.
I did a profile of this recently (local access compared to accessing a global) and accessing a local was about 3 times faster on my hardware than a simple global access (see https://git.minetest.la…
it is easy to see
Unfortunately, it wasn't for me. While I am decent using and understanding mathematical concepts I'm familiar with, reasoning about new concepts and things like proofs I'm…
I found a bug this morning with the sky color when returning to the overworld from the nether
That's a rare one, I'm glad you encountered it while working on this. :) It's both rare and…
After I checked this behaved correctly across the integer boundary, I did use this.
110.times {
The method you have here looks similar to the method with equations 9-11 at https://mathworld.wolfram.com/SpherePointPicking.html that you linked to, but a 3D point selection with rejection sampling, which selects a uniform point in a volume and I don't think this gives a uniform distribution on the surface of the sphere.
When I started writing the code for the distance selection, I started with math.sqrt()
but found in testing it selected spawn points far from the player too often. The inverse CDF got somewhat better results and can be easily changed to any desired distribution. See #5 under https://en.wikipedia.org/wiki/Cumulative_distribution_function#Inverse_distribution_function_(quantile_function)
I haven't tested this yet, but reading thru the article you linked and what I know about lua, I have a couple of issues.
This is supposed to be math.floor,
because minetest.get_nodes_in_area()
uses an inclusive range. If you pass identical values for p1
and p2
it tests exactly one node. Using ceil
tests…
Lua: Runtime error from mod '??' in callback environment_Step(): ...est/games/mineclone2/mods/ENTITIES/mcl_mobs/spawning.lua:761: attempt to call field 'get_node_boxes' (a nil value)
it…
Thanks. Random variables was one of the math courses that didn't come easily.
I'm not positive about (1) and I haven't tested code to see how it behaves. It looks problematic to me, though. I should go check it to see how it behaves.