TL;DR: probabilities reported via calculate_tile_properties don't seem to match up with which tile was actually generated.
My understanding is that to determine what tile a coordinate has during generation, probability_expression noise expressions are computed and then (if there are no other restrictions/variables) the tile with the highest value is chosen for a location. I've looked and looked but haven't found this documented anywhere.
But for some coordinates this doesn't match up with what the game reports via calculate_tile_properties. For example a tile might end up as sand-3 when dirt-1 had a higher value.
All values are from seed 45438212 (it's just the one I was using when I noticed this).
On a freshly generated map:
Code: Select all
/c local pos = {60,-8}
game.player.print(serpent.line({
game.get_surface(1).calculate_tile_properties({"tile:dirt-1:probability","tile:sand-3:probability"},{pos}),
game.get_surface(1).get_tile(pos[1], pos[2]).name}))
{{["tile:dirt-1:probability"] = {0.12150222063064575}, ["tile:sand-3:probability"] = {-0.076949119567871094}}, "sand-3"}Another example I went deeper on:
Code: Select all
/c local pos = {315,-1709}
game.player.print(serpent.line({
surface.calculate_tile_properties({"tile:red-desert-1:probability","tile:water:probability"},{pos}),
surface.get_tile(pos[1], pos[2]).name}))
{{["tile:red-desert-1:probability"] = {0.89085942506790161}, ["tile:water:probability"] = {0.87511539459228516}}, "water"}On the other hand, hard-coding ["water"].autoplace.probability_expression to the exact value the game said it had, 0.87511539459228516, meant the tile would be red-desert-1.
So this is vanilla, no changes: And this is with water's value hard-coded:
I wrote a monstrous Lua command and found about 1,000 of these in roughly a 400x400 area centered around 0,0.

