When exporting a single 1x1 tile as blueprint (let's say a single belt) the position of the belt in the json is nice and round at the (.5, .5) mark. Similarly when exporting a 2x2 entity such as a substation their position is at the (.0, .0) mark. This all makes sense to me.
However, I was exploring some json downloaded from factorioprints when I encountered blueprints where all the positions were rounded to the nearest integer but when imported in Factorio the blueprint was loaded correctly. From this I naively assumed that for 1x1 entities everything in the interval (N.0 <= x < (N+1).0) would be centered to the that specific tile and everything lower would be offset 1 tile to the left and anything higher 1 tile to the right. (With N I mean any non-specific integer so N.0 could be 3.0 and (N+1).0 would be 4.0 in that case)
So I checked some coordinates, at first in positive direction and this assumption seemed to hold: 0.0 to 0.999 was on one tile 1.0 to 1.999 was on the tile over and 2.0 to 2.999 was yet another tile further. But then I checked negative numbers and came to the following discovery. The first negative position starts between -0.0039062 and -0.0039063 and this offset doesn't change depending on the scale x=-10000.5 and -10000.0039063 are the same tile (or column of tiles) and x=-10000.0039062 is the next tile over.
Then I checked for the y axis and the same offset appeared for negative numbers but no offset was observed for positive numbers.
I'm aware of floating point precision but I doubt that that's the case here since no positive numbers seems to be affected while negative numbers close to zero are affected the same way as large negative numbers. Furthermore the scale of the offset is way larger than most floating point precision errors are at in my experience.
I understand that this is but a small problem in a non-standard use-case of the Factorio blueprint import/export functionality but I wanted to let you guys know.
Thanks!
Data:
(Correct) Two belts on the same tile with x being positive
Code: Select all
{
"blueprint": {
"icons": [{
"signal": {
"type": "item",
"name": "assembling-machine-3"
},
"index": 1
}
],
"entities": [{
"entity_number": 1,
"name": "fast-transport-belt",
"position": {
"x": 10000.5,
"y": 0.5
}
}, {
"entity_number": 2,
"name": "fast-transport-belt",
"position": {
"x": 10000.0039062,
"y": 0.5
}
}
],
"item": "blueprint",
"version": 281479273644032
}
}
Code: Select all
0eNqdkMEKwjAQRH9FcraSprVaf0VEUl11odmWZBVLyb+7jYIFb+Y0sxneJDuqpr1D75FY7RajwlNHQdR+VAGvZNs05aEHEQoZnFouFFmXvA0BXNMiXTNnTzckyAoVJYB0hqck8ngQB8TICB9ucsOR7q4BP2VmwIsNnLG3FPrOc9ZAy1Nf3wUBdJQek7hazmotV4M4UVFaf9Hmb7TWRa0rMy+YfpIWILDv0mT4AB/eBLPNy01tNkVVlrowMb4AuvhrzQ==
Code: Select all
{
"blueprint": {
"icons": [{
"signal": {
"type": "item",
"name": "assembling-machine-3"
},
"index": 1
}
],
"entities": [{
"entity_number": 1,
"name": "fast-transport-belt",
"position": {
"x": -10000.5,
"y": 0.5
}
}, {
"entity_number": 2,
"name": "fast-transport-belt",
"position": {
"x": -10000.0039062,
"y": 0.5
}
}
],
"item": "blueprint",
"version": 281479273644032
}
}
Code: Select all
0eNqdkM0KwjAQhF9FcjaSpvX3VUQk1VUXmm1JtmIpeXe3UVDwZk4zm+GbZEdVNz10AYnVbjYqPLUURe1HFfFKrslTHjoQoZDBq/lMkfPZuxjB1w3SVXt3uiGBLlWSANIZHpIo0kEcECMjvLnZDUfqfQ1hynwBLy6y5uAodm1gXUPDU1/XRgG0lB8zcXVh5CyWcjeIFZWk9pdt/2cbU27Nyn43TH/JKxDaZ20yvEOIL4TdFNV6a9flqqpMaVN6AnmKbCc=