[boskid][2.0.27]Elevated rails misalign when rotating blueprint

This subforum contains all the issues which we already resolved.
yangbowen1028
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Apr 09, 2019 7:08 am
Contact:

[boskid][2.0.27]Elevated rails misalign when rotating blueprint

Post by yangbowen1028 »

I was trying to create some tileable, chunk-aligned blueprints of (elevated) rails. When tweaking & experimenting with grid snapping values I noticed some strange behaviour. With an absolute snapping of odd numbers, the blueprint tiled correctly in its original & 180-degrees orientation, but when rotated 90-degrees ghosts of the rail supports do not align with that of the elevated rails. Specifically, the rails were posited correctly but the supports were in "impossible" locations that are off by 1 tile.
Also, the construction bots built rail supports on these "impossible" locations happily, but got stuck attempting to build the rails (whose positions were themselves correct but misalign with the supports). And manually building rails from those wrongly posited rail supports show even weirder behaviour beyond my ability to describe.
Anyway the blueprint is provided below. To reproduce, simply try to build the blueprint with 90-degrees rotation.


I suppose this issue is related to the way coordinate rotations are calculated & the fact that railways align on 2x2 tile boundaries.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3362
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.27]Elevated rails misalign when rotating blueprint

Post by boskid »

More important question is why was the blueprint even allowed to have a mixed even/odd coordinates in the grid position vs absolute. This should not be possible and is the root cause of what is happening when rotating the blueprint. It looks like during 2.0 development the condition was incorrectly rewritten due to space platform hub blueprint support and the condition no longer accounts for rotated blueprints correctly. Whatever the fix will be, it will be to disallow this specific combination of grid position vs absolute coordinates as it is just incorrect.
yangbowen1028
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Apr 09, 2019 7:08 am
Contact:

Re: [2.0.27]Elevated rails misalign when rotating blueprint

Post by yangbowen1028 »

boskid wrote: Sun Dec 22, 2024 2:29 pm More important question is why was the blueprint even allowed to have a mixed even/odd coordinates in the grid position vs absolute.
From what I see, the grid position vs absolute must be both even or both odd in each axis, but one of the axis (X versus Y) may be odd while the other is even. Could you please clarify if you mean it to be even more restricting in that the 4 numbers must be all even or all odd, not 2 even & 2 odd?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3362
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.27]Elevated rails misalign when rotating blueprint

Post by boskid »

If you take a look at those 4 coordinates, all 4 of them should be odd or all 4 of them should be even. This is the only case where "A + B.rotated(0 or 90 or 180 or 270)" fulfills the snapping requirements of rails, rail supports etc with a "core snapping" of 2 tiles regardless of the blueprint rotation. It looks the condition is now in a broken state as it only compares x with x only and y with y only which is wrong.
yangbowen1028
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Apr 09, 2019 7:08 am
Contact:

Re: [2.0.27]Elevated rails misalign when rotating blueprint

Post by yangbowen1028 »

If "A + B.rotate(0 or 90 or 180 or 270)" is used as the coordinates as-is then all 4 of those do need to be of the same parity for the snapping requirements to be fulfilled. However I believe there are legitimate cases where you want the "incorrect" behaviour (i.e. the addition resulting in an odd coordinate) and round it to the next 2x2-snapped position. Disallowing this combination of grid position vs absolute coordinates would make such layouts unachievable. Thus I wonder if it's possible to allow this specific combination, but round the coordinates to multiples of 2 after doing rotations when any such entities present in the blueprint?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3362
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.27]Elevated rails misalign when rotating blueprint

Post by boskid »

Any type of snapping after rotations will cause absolute grid position to be not respected. Absolute grid position describes a point on the surface through which grid likes have to cross regardless of blueprint direction. Because of that the coordinates condition will be fixed causing coordinates combinator from provided blueprint to not be possible.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3362
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [boskid][2.0.27]Elevated rails misalign when rotating blueprint

Post by boskid »

Fixed for 2.0.29.
Post Reply

Return to “Resolved Problems and Bugs”