[2.1.12] Map generation tile probability mismatch

Post your bugs and problems so we can fix them.
Prommah
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue Jun 23, 2026 12:29 pm
Contact:

[2.1.12] Map generation tile probability mismatch

Post by Prommah »

I've found that the 'wrong' tiles seem to be selected for some coordinates during terrain generation. To be clear, this is not important. It doesn't impact gameplay and I haven't noticed any visible weirdness. It's just inconsistent, caused issues with a tool I was working on, and drove me kinda insane.

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"}
Shouldn't that tile be dirt-1?

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"}
I tried using a mod to hard-code ["red-desert-1"].autoplace.probability_expression to higher values until the tile would be generated as desert. It wouldn't at 0.9074, but would at 0.9075.
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:
default.png
default.png (171.81 KiB) Viewed 154 times
And this is with water's value hard-coded:
hardcoded.png
hardcoded.png (136.59 KiB) Viewed 154 times

I wrote a monstrous Lua command and found about 1,000 of these in roughly a 400x400 area centered around 0,0.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17240
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.12] Map generation tile probability mismatch

Post by Rseding91 »

I haven’t looked into this at all but could this simply be the logic that makes sure the starting area isn’t pure water? The starting area has more complex logic compared to simply tile probably values.
If you want to get ahold of me I'm almost always on Discord.
Prommah
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue Jun 23, 2026 12:29 pm
Contact:

Re: [2.1.12] Map generation tile probability mismatch

Post by Prommah »

Rseding91 wrote: Sat Jul 25, 2026 3:08 pm I haven’t looked into this at all but could this simply be the logic that makes sure the starting area isn’t pure water? The starting area has more complex logic compared to simply tile probably values.
I think that's covered by the elevation expression(s), which would make water a far more powerful signal. And anyway, would that really cause sand to override dirt? Or apply to coords like 315,-1709? This happens everywhere, I just narrowed the search to give reproducible cases without having to manually trigger chunk generation. First one my tool gives when I increased the radius again: x = -1440, y = -1401}, {"tile:dirt-1:probability", -0.2427818775177002}, {"tile:sand-3:probability", -0.25930005311965942}, "sand-3". (This format is a bit custom, it's basically "highest probability, probability of tile that spawned, tile that spawned")
Post Reply

Return to “Bug Reports”