Page 1 of 2

New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 1:58 am
by MyrddinE
The new blueprint book is out, and it's great... BUT...

Rail grids CANNOT be created in a rotationally symmetrical way. :-(

One of the biggest use-cases for a globally synced grid is rail segments, so you can ensure your widely disparate areas will connect easily when your blueprint stamps meet. But the way the new global grids work, this is not possible.

Because the center point of a blueprint has to be in the center of a cell, and rail blueprints must be an even size (due to the 2x2 nature of rails), you can never have the point of rotation match. The center of an even-sized grid is on the edge between two cells, but you can't specify the center of a blueprint to be on a grid edge in the new system.

This makes it impossible to create a grid with your rail parts (or any template that's an even width) unless you make four copies, one for every rotation.

Very depressing. :-( I hope they allow for more flexible specification of the point of symmetry, quickly.

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 2:06 am
by boskid
It is possible, like here (taken out of https://factorio.com/blog/post/fff-357):


Keep in mind that snapping box can be manually shifted and grid size can be set to 30x30 (then center may be on rail if you really need)

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 2:17 am
by MyrddinE
I respectfully disagree. I made a video to demonstrate (I'm not a very good videographer, sorry it's not great).

This video is in the process of uploading, but it demonstrates a blueprint that is perfectly symmetrical (rotationally) without a global reference point, but cannot be used with rotational symmetry if you add a global reference point, because the point is in a cell, not the divider between a cell.

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 4:03 am
by 5thHorseman
boskid wrote:
Thu Jul 30, 2020 2:06 am
It is possible, like here (taken out of https://factorio.com/blog/post/fff-357):
I have tried this as well and it doesn't work as described. I cannot make a rail system that you can do what is shown in that video. If I replace the rails with large power poles (as they're 2x2 structures) then I can make a blueprint that tiles like in the video.

With rails though, the game will not allow me to place a marker where it needs to be in order to correctly tile.

I am totally willing to admit I just can't figure it out, but I'd like someone who has been able to do it to point out what I'm doing wrong, or show how to do it correctly.

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 5:11 am
by 5thHorseman
I figured it out. I (and I suspect @MyrddinE) was making an assumption that I shouldn't have, and the blueprint centering has a restriction that we didn't know about.

Below is a blueprint string of a simple tileable rail. The blueprint itself is 34 tiles wide but the grid is 30x30.

The restriction on tiling is that you MUST overlap a full rail, or 2 full rails, or 3, etc. You must do this both vertically and horizontally.

Because of this, you can NOT have rails that are an even number of rail widths apart. They MUST be odd, which I think a lot of designs currently don't do.

In other words, you can't have:

RAIL
BLANK
BLANK
RAIL

You must have:
RAIL
BLANK
RAIL

or:
RAIL
BLANK
BLANK
BLANK
RAIL
(like my rail)

Also, at least in my testing, the power poles can not be where you could put a rail horizontally, but must be where you could put a rail vertically. So:

Code: Select all

------ <- 3 rails long, or 6 tiles long.
------     
:::::: <- Blank tiles
:::::: 
:::##: <-Power Pole, note it's on a rail line vertically, but split across 2 rails horizontally)
:::##: 
:::::: <- Blank tiles
::::::
------ <- 3 rails long, or 6 tiles long.
------
Here's a working blueprint that I'll be basing my designs off of:

Code: Select all

0eNqV191uozAQBeB3mWuIGJv/V6lWFUks1hIxCJxVo4p3ryFpst3Q7ZmrCMX+ZHEy5PBO++5shtE6T/U7Ta4ZYt/H7WiPy/Ub1TqJ6LJ8zBE1+6nvzt7Ey7rBupZqP55NRPbQu4nqlyDY1jXdstdfBkM1WW9OFJFrTsvV2NiOgmTd0QSc518RGeett+a6f724vLrzaW/GsOC+c/Jhb/vbxysR0dBPYVfvbseMeT0mc8CPdjSH63dqjp5MhZo4qVFSw2SKkhlMZihZwGSOkhVMFnA8eD4lbOIBVbCJJ8QJjOIZMTxEjKfE8BQpPCaG50jhOTE8SUoQFDxLShAUPE1KEBQ8T1oQVPnliR7fnvrPT+Vkd7unapd9ZfMttsJYVYlY9ZiqvW1j04XFoz3EQ9+ZZ/z6f8fZvCU9Rmmww8ZmTj9Plu22BfWTkP0kaPgM6TdCCp/hOyGT3FH931uaY5nff0nFv5Fv/scXmKqFbCntIxWAVsJCApg6ETYSxGRhJUFMJewkiKmFpQQxU2krQdBMWksQNJf2EgQtpL0EQUtpL0HQStpLADRNpL0EQVnaSxBUSXsJgmppL0HQVNpLntDw7ri+XdZ/vcRG9MeM07qgKDRzqXPO9Tx/ALth4fY=
(it has 4 pipes centered, so I could place the flag and verify that rotation was working easily. Just delete them if you actually want to use this blueprint in your own designs)

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 5:45 am
by 5thHorseman
Sorry for spamming posts but this is important enough for each thought to have its own place.

I tried to expand my blueprint above making it twice as long, and I was unable to make it rotate correctly. So I broke my rule above:
5thHorseman wrote:
Thu Jul 30, 2020 5:11 am
...you can NOT have rails that are an even number of rail widths apart.
and it worked. I HAD to make them an even number apart to get the 2-wide blueprint to work. If they were an odd number apart, it would not rotate no matter what.

Code: Select all

0eNqVmd2KqzAUhd8l1zqYbJOorzIMg21DT8CqaHo4ZfDdR9uenzktw1pXRZp8bLpYdH/4oXbdOYxT7JNqPtTct2Oehvw4xcP2/Es1rsjUZftYMtXu5qE7p5Bv58bYH1WTpnPIVNwP/aya15UQj33bbXfTZQyqUTGFk8pU3562p6mNnVpJsT+EFa6Xt0yFPsUUw+3+9eHy3p9PuzCtB/7cnNN69/gj5VdEpsZhXm8N/X3MXF/HNH6FH+IU9rfvzJI9MA3KxJGCIgVGlijSwkiLIj2MdCiyhpEejgfPp4KZeEA1zMQT0gUMxTPScIk0npKGW2TwmDTcI4PnpOEmGSIouEuGCApukyGCgvskRFBwoYQICm6U4EEZuFGCB2XgRgkelIEbVRL/dXCjSjwoAzeqJIKCG1USQcGNKomg4EZZIii4UZYICm6UxYMSuFEWD0rgRlk8KIEb5YhVT74ss/l94X1cSIuX+29avdivWPcM+7dTu3jMQ7cenuI+H4cuPMJvO7kUyzOSxQY0NTegYwaUbyf02ISWnLBiJnTfTlhjE/7OWPT/Az5d6QuMKiRWY1hHYg3pXiIAVDj5gpglZ18Q03L6BTEd518Q03MCBjEr0sAgaE0qGAK1BelgEFSTDgZBDelgEFRIB4OgJelgENSSDgZBHelgENSTDgZBK9LBIGhNOhgCdQXpYBBUkw4GQQ3pYBBUSAeDoCXpYBDUkg4GQR3pYBDUkw4GQSvSwSBoTToYAvUF6WAQVJMOBkEN6WAQVEgHe4S+ZbeXCM0/7yoy9TNM8/WA96J1JU47WZZPLwwnpQ==
The first blueprint had a grid 30 (15 rails) wide, while the second had a grid 60 (30 rails) wide. So it appears that your grid must either be an odd number of rails in both directions or an even number of rails in both directions.

So in short, if your grid is an odd number of rails wide, you need to have your rails an odd number of rails apart, because it will center in the middle of a rail. If your grid is an even number of rails wide, you need to have your rails an even number of rails apart, because it will center in the corner between 4 rails. There is no way to have it centered anywhere else, because then you can't rotate it, it'd have to shift left, right, up, or down to keep the rails on the grid.

And this makes sense, given the restriction that the blueprint snaps to the 0,0 point. Or more accurately, that 4 blueprints will snap around 0,0. if you could place the marker anywhere, it would cause rails to be incorrect. The only way to overcome this would be to allow us to state the snap coordinates. So you could say "snap to 1,1" or "snap to 1,0" or ... well... anything to make it work. Wube could even allow you to place the flag anywhere and modify the snap to to be the closest point to 0,0 that would allow that flag.

Re: New Blueprints - Better Symmetry Point

Posted: Thu Jul 30, 2020 1:17 pm
by MyrddinE
My grid is 36x36, with the rails being one square apart. It sounds like I need to make my grid 38 or 34 instead, based on your testing. In other words, the grid must be divisible by 2, but not by 4. That's frustrating; the entire point of my rail template was to tile perfectly with a blanket grid of substations (as you may have noticed in the video), and those are 18x18. I'll need to change it to tile with three substations (54x54) instead.

Allowing more flexible rotation points would eliminate this restriction on grid size, but at least I have a way forward now.

Re: New Blueprints - Better Symmetry Point

Posted: Fri Jul 31, 2020 11:10 pm
by DaggerBall
The problem occures when the gap between rails and the size of the blueprint divided by two have a different parity, which is not so rare case. The reason is that blueprint tile border cannot pass through the midle of the rail, since the rail cannot be built on the center of the map (rather weird reason, imo).
The simplest solution might be to use the source location of the blueprint instead of the map center to adjust blueprint tile grid.

Re: New Blueprints - Better Symmetry Point

Posted: Sat Aug 01, 2020 9:35 am
by sorahn
Here are the 4-gap LHD rail system that I've used for quite a while, I went through and updated it to use a global snapping grid of 28x28 px. All pieces are rationally symmetrical (if they can be) and the idea is that you can build rail anywhere in the world and it's always connected to the same grid when you get to the next part.


https://gist.github.com/sorahn/cd3ce815 ... 42844ab2ba

Re: New Blueprints - Better Symmetry Point

Posted: Sat Aug 01, 2020 2:12 pm
by Qon
MyrddinE wrote:
Thu Jul 30, 2020 2:17 am
I respectfully disagree. I made a video to demonstrate (I'm not a very good videographer, sorry it's not great).

This video is in the process of uploading, but it demonstrates a blueprint that is perfectly symmetrical (rotationally) without a global reference point, but cannot be used with rotational symmetry if you add a global reference point, because the point is in a cell, not the divider between a cell.
How can you disagree when there's an existence proof of it being possible?

Maybe you didn't adjust your grid and reference point correctly? But I can't help you without a blueprint string. :(

Edit:
It's possible. I fixed the reference point and now it works. But why do you use 1 rail spacing + even sized (even in the 2x2 grid, so a multiple of 4) snap sizes? That makes it impossible to have right and left turns be the same blueprint, alignment or not. Either have both be even or both be odd.

Re: New Blueprints - Better Symmetry Point

Posted: Sat Aug 01, 2020 3:39 pm
by sorahn
MyrddinE wrote:
Thu Jul 30, 2020 1:17 pm
In other words, the grid must be divisible by 2, but not by 4.
That's not true, see the rails I posted here: viewtopic.php?p=504154#p504154 They're 28x28, divisible by 2 and 4. What you can't do is have the tracks setup in such a way that it would be possible to place one at the center of the blueprint.


Image

Any rail systems that use the top gaps won't be able to be rotationally symmetrical, but the ones that use the bottom can be.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 9:22 am
by DaggerBall
sorahn wrote:
Sat Aug 01, 2020 3:39 pm
MyrddinE wrote:
Thu Jul 30, 2020 1:17 pm
In other words, the grid must be divisible by 2, but not by 4.
That's not true, see the rails I posted here: viewtopic.php?p=504154#p504154 They're 28x28, divisible by 2 and 4. What you can't do is have the tracks setup in such a way that it would be possible to place one at the center of the blueprint.


Image

Any rail systems that use the top gaps won't be able to be rotationally symmetrical, but the ones that use the bottom can be.
Any rail systems can be properly tiled and rotationally symmetrical. They just should have appropriate tile size.
In the given picture, the upper ones should have tile size of 4n + 2 (26, 30, 34 etc.), and the lower ones, of 4n (28, 32, etc.)
But this restriction is just a bit annoying. It could easily be avoided if we had the way to adjust tile grid to the given point. Just adding the offset of (1, 1) reverses the requirements in this particular case.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 10:10 am
by Qon
DaggerBall wrote:
Sun Aug 02, 2020 9:22 am
But this restriction is just a bit annoying. It could easily be avoided if we had the way to adjust tile grid to the given point. Just adding the offset of (1, 1) reverses the requirements in this particular case.
Rails can't be offset by 1 tile. They are always snapped to an absolute 2x2 grid. This is not going to change.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 10:59 am
by xykite
I was about to file an 'is this a bug?' then found this thread. For rail blueprints the game is happy to have an absolute reference point at any of the four positions in a 2x2 rail tile (choose e.g. grid sizes of 6x6, 6x8, 8x6, 8x8) so I suspect there's already some sneaky plus-one fixes going on to make rail tiles always end up aligned once you place them.

I believe the issue is that if (blueprint dimension mod 4) != (grid dimension mod 4) then it is not possible to place the absolute reference point in the centre. This is a problem for my blueprints at least.

Changing this to the desired behaviour of a free choice of alignment point may be nontrivial because handling players who make multiple rail blueprints with different choices of alignment point (mod 2x2) for the same grid size doesn't sound like fun to me.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 12:11 pm
by xykite
I've changed my mind - I think the main problem is actually legitimate players, not "players who make multiple rail blueprints with different choices of alignment point".

Fix a grid size and suppose we have a free choice of alignment point. There are 4 classes of blueprint according to whether the alignment point is (0,0),(0,1),(1,0),(1,1) in a rail tile; the class may change as the blueprint is rotated.

The obvious solution is to choose a translation map from each class to the rail-aligned grid, i.e. you just apply the translation map as blueprints are placed. A properly-constructed blueprint book of compatible rail components will be all in the same 'class', so you can have a centre of rotation and things will 'just work'.

I believe the problems come when you start creating blueprints that are designed to be compatible with your rail blueprints (i.e. same grid size) but don't actually contain any rails. The game has no way to know which class you want to be in, i.e. which translation map to apply. So depending on your luck, you might get off-by-one errors.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 1:59 pm
by Qon
xykite wrote:
Sun Aug 02, 2020 12:11 pm
The obvious solution is to choose a translation map from each class to the rail-aligned grid, i.e. you just apply the translation map as blueprints are placed. A properly-constructed blueprint book of compatible rail components will be all in the same 'class', so you can have a centre of rotation and things will 'just work'.
Not sure what you are proposing here, but it sounds like you haven't read:
Qon wrote:
Sun Aug 02, 2020 10:10 am
Rails can't be offset by 1 tile. They are always snapped to an absolute 2x2 grid. This is not going to change.
Offsetting the alignment flag by 1 tile forces rails to be offset 1 tile also, which is impossible in Factorio. All problems here come from players who are trying to offset rails by 1 tile. If you don't, it all works perfectly.

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 2:56 pm
by xykite
On the contrary - the purpose of such a (hypothetical) translation map is to cancel out an unaligned reference point and end up with a result of 0 mod 2, i.e. aligned rails. My point is that I don't think this idea works once you take in account blueprints without rails in them.
alignment.png
alignment.png (202.48 KiB) Viewed 9202 times
Suppose we're placing 6x6 blueprints. 1, 2 are from one book of train blueprints, and 3, 4 are from a different book of train blueprints. Note that (1,2) and (3,4) have different rail alignments, i.e. the books aren't compatible.

As far as the game is concerned, 1 and 4 are both normal blueprints without rails, so they can and will be placed anywhere without modification. However one of 2 and 3 must have a (+-1, +-1) translation applied before it gets placed in order to keep the rails aligned. Since the game doesn't know that 1 goes with 2 and 3 goes with 4, one of the two sets of train blueprints will end up broken.

I believe the game gets round this at the moment not by disallowing unaligned reference points (as these are used) but by fixing the translation map per grid size, relative to the rail positioning in each blueprint. Hence the 2x2 resolution for reference points.

It's still possible I'm way off the mark here - does this make any kind of sense?

Re: New Blueprints - Better Symmetry Point

Posted: Sun Aug 02, 2020 10:02 pm
by EnerJi
I've read this whole thread hoping it would shed insight into the whole global reference new feature, and I'm just as confused as before. Can anyone point me to an ELI5 description of how it's supposed to work?

Re: New Blueprints - Better Symmetry Point

Posted: Mon Aug 03, 2020 1:10 am
by DaggerBall
Nothing violates the "rails can't be offset by 1 tile" rule.
Blueprints will not change their "offset class" when rotated.

The problem is simply this:
Factorio blueprint tiling problem.png
Factorio blueprint tiling problem.png (221.68 KiB) Viewed 9168 times
Both blueprints are perfectly tileable. They are essentially the same. The only difference is that the second one is rotatable, and the first one isn't.
Currently blueprint tile grid is adjusted to the map center. In other words you should be able to place your blueprint so that the corner of the blueprint tile (green square) will match the center of the map (intersection of bold black lines).
And you obviously can't move the second blueprint to match the map center, because, yes, rails can't be offset by 1 tile. So you will not be permitted to create such blueprint. That is the problem. And that is why it can be easily fixed by adding some controllable offset to the blueprint tile grid.

Re: New Blueprints - Better Symmetry Point

Posted: Mon Aug 03, 2020 7:11 am
by xykite
DaggerBall wrote:
Mon Aug 03, 2020 1:10 am
Blueprints will not change their "offset class" when rotated.
That's true in the cases we've both drawn, but when a rotation acts on the set of offset classes, (0,1) gets swapped with (1,0).
DaggerBall wrote:
Mon Aug 03, 2020 1:10 am
... it can be easily fixed by adding some controllable offset to the blueprint tile grid.
Are you proposing a global offset, or a per-blueprint offset? If it's a global offset then some of your blueprints may have to be deemed 'invalid' at any given time, according to whether or not their alignment point is valid. A per-blueprint offset would definitely work though.

How about this for another way forward: give blueprint books a tickbox to say something like "Blueprint book contains compatible rail blueprints". Then you get completely free choice for the alignment point of the first blueprint you make, and subsequent alignment points are committed to this choice (mod 2x2) thereafter. Another perk - that would probably be more user-visible - is that you could make it so you only have to type in the grid size once per blueprint book. [obviously some thought required to decide how to handle "what happens if you try to add an incompatible blueprint" etc.]