[2.1.14] voronoi_cell_id generates repeated cell ids near (0,0)

Things that we don't consider worth fixing at this moment.
Hanodest
Burner Inserter
Burner Inserter
Posts: 15
Joined: Sun Aug 11, 2024 10:55 pm
Contact:

[2.1.14] voronoi_cell_id generates repeated cell ids near (0,0)

Post by Hanodest »

voronoi_cell_id seems to always assign the same exact ids to the cells directly top-left and bottom-right from (0,0). Same for the bottom-left and top-right pair. The other ids seem to be randomized properly.

Test expression:

Code: Select all

  {
    type = "noise-expression",
    name = "cell_id",
    expression = [[
      if (
        abs(x) < 200 & abs(y) < 200, 
        voronoi_cell_id {
          x = x,
          y = y,
          seed0 = map_seed,
          seed1 = 0,
          grid_size = 50,
          distance_type = 1,
          jitter = 0.2
        },
        0
      )
    ]],
  },
Visualisation from noise-tools:
noise_vis.png
noise_vis.png (14.92 KiB) Viewed 222 times
Raw noise values:
noise_values.png
noise_values.png (39.9 KiB) Viewed 222 times
Genhis
Factorio Staff
Factorio Staff
Posts: 987
Joined: Wed Dec 24, 2014 8:19 am
Contact:

Re: [2.1.14] voronoi_cell_id generates repeated cell ids near (0,0)

Post by Genhis »

Thanks for the report. I was going to fix it for 2.1 but eventually decided not to because it would significantly alter Fulgora map generation and cause hard borders for old save files. The hash function which picks random values isn't very good unfortunately, I recommend offsetting or multiplying one dimension to get better results.

Code: Select all

Math::hash(regionPosition.x) ^ Math::hash(std::rotr(uint32_t(regionPosition.y), 16)) ^ voronoi.seed
Post Reply

Return to “Won't fix.”