All rail pieces are buildable on a 2x2 grid so it is not possible to have them misaligned by 1 tile.
Friday Facts #377 - New new rails
Re: Friday Facts #377 - New new rails
So I was playing around with the new rail geometry in AutoCAD and things seemed to be lining up pretty well.
Then I stumbled onto this and couldn't find my mistake. The track seemed to be offset by half it's width without a way to make them line up. I had to stare at it a while before I realized I was just looking at overlapping parallel tracks at 30 degrees. The same thing exists at 60 degrees, and at 45 degrees they're right up against each other, not quite overlapping.
Here is the same problem in a more organized manner. If you restrict the starting point for 30 & 60 degree rails to a 2x2 grid, then the nearest parallel rails end up overlapping by about 50%. So maybe restrict 30 & 60 degree rails to a 4x4 grid? But then that S-bend of track on the right-hand side can only connect every 3rd parallel track, so maybe a 6x6 grid is better?
Honestly this problem looks pretty close to the original issue you were trying to solve, just rotated 30 degrees.
[Edit : Image was not loading correctly] Two intermediate tracks that the S-Bend cannot connect.
Is my analysis flawed? How does your development build handle this so far? I don't have a good solution in mind, hopefully someone will reply back and point out a boneheaded mistake I made. I really like your new new rail plan so far, and I hope it can be as good as possible on release!
A couple of times I thought I had found issues, but I realized I had made illegal moves, usually straight track sections an odd number of tiles long. If I restricted myself to building only on a 2x2 grid as boskid said, then everything seemed to line up as intended. Then I stumbled onto this and couldn't find my mistake. The track seemed to be offset by half it's width without a way to make them line up. I had to stare at it a while before I realized I was just looking at overlapping parallel tracks at 30 degrees. The same thing exists at 60 degrees, and at 45 degrees they're right up against each other, not quite overlapping.
Here is the same problem in a more organized manner. If you restrict the starting point for 30 & 60 degree rails to a 2x2 grid, then the nearest parallel rails end up overlapping by about 50%. So maybe restrict 30 & 60 degree rails to a 4x4 grid? But then that S-bend of track on the right-hand side can only connect every 3rd parallel track, so maybe a 6x6 grid is better?
Honestly this problem looks pretty close to the original issue you were trying to solve, just rotated 30 degrees.
[Edit : Image was not loading correctly] Two intermediate tracks that the S-Bend cannot connect.
Is my analysis flawed? How does your development build handle this so far? I don't have a good solution in mind, hopefully someone will reply back and point out a boneheaded mistake I made. I really like your new new rail plan so far, and I hope it can be as good as possible on release!
Re: Friday Facts #377 - New new rails
I'm not quite sure what's happening, but there won't be 30- and 60-degree rails, but 22.5, 45, and 67.5 degrees. You can also use https://mods.factorio.com/mod/fake-new-rails to test layouts, but it will let you build 45-degree rails on a 1x1 grid, instead of the 2x2 that it is supposed to be. I'm not sure if the elevated rails are accurate though. There is no collision simulated in the mod either way.glenjimen wrote:
I was wondering if this quirk will be fixed (click for Reddit post):
![Image](https://external-preview.redd.it/h6a9UiLYtWJ0j4VdvP-WMuLY6MTsExF0A8N7QihHSrM.jpg?width=1080&crop=smart&auto=webp&s=8e4e701f9d9e7ab25dd3cadedbb0601855734398)
The image is old, but I'm pretty sure it still exists in Factorio 1.1. The quirk is that the curved rails, while longer (visually and as measured by train movement), use less materials to build than diagonal rails. I'm not sure if this also happens with orthogonal vs curvy rails, but I think it might.
Have you considered using flow routers instead of balancers?
Re: Friday Facts #377 - New new rails
Bone headed mistake #1 identified!
@ Yodo You're half right, the angles aren't 30, 45 & 60. But they also aren't 22.5, 45 & 67.5. Revisiting my high school trig (and double checking in AutoCAD) the actual angles are 26.57, 45 & 63.43. However, the geometry I presented is still correct even though I was saying the wrong angles. And the angled S-Bend problem still exists, as well as the overlapping track problem. Is there something built into these new new rails that prevents this from being an issue?
@ Yodo You're half right, the angles aren't 30, 45 & 60. But they also aren't 22.5, 45 & 67.5. Revisiting my high school trig (and double checking in AutoCAD) the actual angles are 26.57, 45 & 63.43. However, the geometry I presented is still correct even though I was saying the wrong angles. And the angled S-Bend problem still exists, as well as the overlapping track problem. Is there something built into these new new rails that prevents this from being an issue?
Re: Friday Facts #377 - New new rails
Apologies for the double-post.
I'm managed to confuse myself even more! How can the new new rails follow the rule of only being built on a 2x2 grid if the individual puzzle pieces are an odd numbers of tiles tall & wide? Even when building 45 degree rails, you have to first build to 26.5* then to 45*. Assuming you start horizontal at 0*, you first build over 5 tiles & down 1 to 26.5*. Then over 4 & down 3 to 45*. That's a total of over 9 & down 4.
Are the new new rails able to be built on a 1x1 grid? Or is there some other limiting mechanic?
For reference, the old curves are an even number of tiles tall & wide.
I'm managed to confuse myself even more! How can the new new rails follow the rule of only being built on a 2x2 grid if the individual puzzle pieces are an odd numbers of tiles tall & wide? Even when building 45 degree rails, you have to first build to 26.5* then to 45*. Assuming you start horizontal at 0*, you first build over 5 tiles & down 1 to 26.5*. Then over 4 & down 3 to 45*. That's a total of over 9 & down 4.
Are the new new rails able to be built on a 1x1 grid? Or is there some other limiting mechanic?
For reference, the old curves are an even number of tiles tall & wide.
Re: Friday Facts #377 - New new rails
There are no contradictions there. Entity being buildable on 2x2 grid means that the entity snaps to positions that repeat every 2 tiles in X and Y direction but that does not restrict if X and Y coordinates are even or odd, up to being an even+odd pair or change depending on the direction of entity being built. Straight rails are buildable on 2x2 grid with X and Y both being odd, 45deg straight is buildable on 2x2 grid with X and Y being even. "22.5" straights are buildable on 2x2 grid where both X and Y are odd. Curve-B shape is buildable on 2x2 grid where X and Y are odd. Curve-A shape is buildable on 2x2 grid where one coordinate is even and one is odd (which one is even depends on the direction of the piece being built). There is also one piece you are missing which is where exactly i decided to locate the rail piece centers.
Below is screenshot with tile grid turned (there are 2 chunk borders visible) and exact entity positions.
Re: Friday Facts #377 - New new rails
With an additional straight piece before starting the curve from the bottom you can connect the paths.glenjimen wrote: ↑Fri Jun 14, 2024 5:27 pmThe track seemed to be offset by half it's width without a way to make them line up. I had to stare at it a while before I realized I was just looking at overlapping parallel tracks at 30 degrees. The same thing exists at 60 degrees, and at 45 degrees they're right up against each other, not quite overlapping.
Unless I miscounted, with 2.0 there'll be no intermediate tracks for 45° S-bends, while in 1.1 we have 3 intermediate tracks, so I'd call this an improvement. For 26.6° and 63.3° orientations, it depends on the direction you make the S-bend in. If you transition to 0° or 90° you'll have two intermediate tracks, transitioning to 45° you'll only have a one track gap. But building 26.6° or 63.3° tracks directly adjacent has very limited usefulness as trains will collide; not sure whether a one track gap will work. Thus, limiting yourself to one out of every 2 (or 3) possible tracks saves rails with no throughput lost and should remove the need for most awkward S-bends.Honestly this problem looks pretty close to the original issue you were trying to solve, just rotated 30 degrees.
Two intermediate tracks that the S-Bend cannot connect.
Is my analysis flawed? How does your development build handle this so far? I don't have a good solution in mind, hopefully someone will reply back and point out a boneheaded mistake I made. I really like your new new rail plan so far, and I hope it can be as good as possible on release!
This one is Curve-A? Just looking at your picture the position of reference point feels weird, as it's the only one with a dark lab tile to the top right. Combined with the even/odd coordinate depending on direction, wouldn't it make sense to move the reference point one tile to the right? That'd make both coordinates odd for all eight rotations, possibly simplifying the code, and match up with a "mirrored" version of Curve-B. Or is there a technical reason why that can't be done?
Re: Friday Facts #377 - New new rails
That is Curved-A rail. It can be told by the direction of rail at its ends: Curved-A connects straight with "22.5" when Curved-B connects "22.5" with 45deg.
From code point of view having even+odd causes absolutely no new problems. Game engine is already well prepared to handle this case the same as you can build 2x3 entities (like boilers) with one coordinate being an integer and second coordinate being offset by half - this is exactly the same code path just tile grid for rails is 2x2 while boilers are buildable on 1x1 grid.
All relevant pieces of rails code that need to know where rail ends are, are using a function which sum entity position and offsets from rail connection definitions for given shape+direction so they are unaffected by exact center position of entity. Effectively it does not matter where it is as long it is within collision bounding box and i am not going to change that anymore because it would require a migration.
From build snapping point of view you can consider Curved-A rail to be as if it was 2x4 entity snapping to 2x2 grid: half of 4 is 2, that coordinate will be even and half of 2 is 1, that coordinate will be odd.
From code point of view having even+odd causes absolutely no new problems. Game engine is already well prepared to handle this case the same as you can build 2x3 entities (like boilers) with one coordinate being an integer and second coordinate being offset by half - this is exactly the same code path just tile grid for rails is 2x2 while boilers are buildable on 1x1 grid.
All relevant pieces of rails code that need to know where rail ends are, are using a function which sum entity position and offsets from rail connection definitions for given shape+direction so they are unaffected by exact center position of entity. Effectively it does not matter where it is as long it is within collision bounding box and i am not going to change that anymore because it would require a migration.
From build snapping point of view you can consider Curved-A rail to be as if it was 2x4 entity snapping to 2x2 grid: half of 4 is 2, that coordinate will be even and half of 2 is 1, that coordinate will be odd.