Page 1 of 1

[0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 9:46 am
by jorgenRe
Okay so im playing with the world(using lua) and i found out that quite so often lines of grass-dry tiles spawn(unless they already was there) in long straight lines that sometimes may take a 90 degree turn.
Map view of grass-dry lines
Image
Now the second thing is that when i trye to remove them with concrete there seems to occasionally spawn in new grass dry tiles.
Before
Image
After placing some concrete tiles
Image

Extraweird is also that when those lines appear after a second regen of the tiles in that area the tile looks like grass, but when using the get_tile function it returns that it is a lavastone tile(not what it looks like!)
Image

Now after some testing i think it has something to do with biome borders.
Biome in a biome(before)
Image

Biome in a biome(after)
Image
Notice how many lines there are!

1 Biome alone(before)
Image

1 Biome alone(after)
Image
Notice the no lines in the biome alone!

Further tests showed the same results. As soon as there came a new biome those lines appeared again, but as long as the biome was the same all the time. No lines appeared.
(each tile regeneration was 30 * 30 big, but sometimes 30*60 tiles big
So to conclude something doesnt seem to be right when it comes to those biome borders :(

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 10:33 am
by kovarex
I have no idea what is it about. What are these grey tiles, are you using any mods? what lua commands did you use?

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 10:41 am
by jorgenRe
kovarex wrote:I have no idea what is it about. What are these grey tiles, are you using any mods? what lua commands did you use?
Those gray and lava looking tiles are from my mod: "The Underground". Which is a mod that is to add its own surface that looks like if you are inside a huge cave filled with lava and new kinds of biters.
Back to the case:
To change the tiles to those i want i'm using:

Code: Select all

--Place iron chests every 50 tile both up and down and use a find_entities function to find it. If its found then it 
--Changes the tiles in a 30*30 tiles big area. 

--First place down the markers in as big of an area as possible
distBetween = 30
function placeMarkers()
  for x = 1, 200 do
    xPos = (x-100) * distBetween 
    for y = 1, 200 do
	  game.surfaces["nauvis"].create_entity({name = "iron-chest", position = {xPos, (y - 100) * distBetween}, force = game.forces.player})
	end
  end
end
--Find those chests and if its closer than 50 tiles then change all the tiles in its space to the new tiles
searchDist = 150
function changetiles2()	
  chestsFound = {}
  found = 0
  results = game.surfaces["nauvis"].find_entities_filtered{area = {{game.player.position.x -searchDist, game.player.position.y -searchDist}, {game.player.position.x +searchDist, game.player.position.y +searchDist}}, name= "iron-chest"}
  for d,ent in pairs(results) do
  game.player.print("Number: "..d)
    if ent.position ~= nil then
      chestsFound[d] = ent.position
	  found = found + 1
	  ent.destroy()
	end
  end
  for n = 1, found do
    --if ent ~= nil then
	if chestsFound[n] ~= nil then

      for x = 1, 30 do
        xPos = chestsFound[n].x + x - 2	
	    for y = 1, 30 do
	      yPos = chestsFound[n].y + y - 2
		  --If it collides with a player turn it into lava if not turn it to lavaStone
          if game.surfaces["nauvis"].get_tile(xPos, yPos).collides_with("player-layer") then 
	        --game.player.print("yes!") 
	        game.surfaces["nauvis"].set_tiles{{name = "lava", position = {xPos, yPos}}} 
	      else
	        game.surfaces["nauvis"].set_tiles{{name = "lavaStone", position = {xPos, yPos}}} 
	      end
	    end
	  end
--ent.destroy()
	--end
	end
  end
end
Basically as said something in Factorio just dont like it when the tiles around biome borders are changed and therefore choose to regen in those huge lines :/
PS i have tested and found it not to be because i'm not changing those tiles. Because i am seeing as it worked perfectly when it all happened in one biome.

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 10:49 am
by jorgenRe
Also one more thing it also happens when doing it with my mod disabled. THen it still spawns new tiles when i place concrete around a biome border.
Before
Image
After
Image

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 11:11 am
by kovarex
Ok, now I know what is going on.

The problem you are experiencing is caused by the tile-fixup logic. Basically, to avoid non-allowed tile combinations, like 1-tile wide water canal etc, the game fixes the tiles after any change. (This also chooses the 2X2 or 4X4 tiles to be used if the area is big enough).

The problem is, that you are changing tiles one by one, which is not only much slower, but also can do various results as the tile correction is done after every change.

The proper way is to save all the tiles you want to change into an array, and then do it by single call of the set_tiles method.

I added the comment to the wiki doc of the command (https://forums.factorio.com/wiki/inde ... #set_tiles).

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 11:29 am
by jorgenRe
kovarex wrote:Ok, now I know what is going on.

The problem you are experiencing is caused by the tile-fixup logic. Basically, to avoid non-allowed tile combinations, like 1-tile wide water canal etc, the game fixes the tiles after any change. (This also chooses the 2X2 or 4X4 tiles to be used if the area is big enough).

The problem is, that you are changing tiles one by one, which is not only much slower, but also can do various results as the tile correction is done after every change.

The proper way is to save all the tiles you want to change into an array, and then do it by single call of the set_tiles method.

I added the comment to the wiki doc of the command (https://forums.factorio.com/wiki/inde ... #set_tiles).
Thank you so much :D!

Re: [0.12.2]biome borders keep refreshing border tiles

Posted: Sun Aug 02, 2015 12:11 pm
by kovarex
jorgenRe wrote:
kovarex wrote:Ok, now I know what is going on.

The problem you are experiencing is caused by the tile-fixup logic. Basically, to avoid non-allowed tile combinations, like 1-tile wide water canal etc, the game fixes the tiles after any change. (This also chooses the 2X2 or 4X4 tiles to be used if the area is big enough).

The problem is, that you are changing tiles one by one, which is not only much slower, but also can do various results as the tile correction is done after every change.

The proper way is to save all the tiles you want to change into an array, and then do it by single call of the set_tiles method.

I added the comment to the wiki doc of the command (https://forums.factorio.com/wiki/inde ... #set_tiles).
Thank you so much :D!
You are welcome, question like this make it easier for future moders :)