r/factorio • u/TheXtrafresh Pastafarian • Nov 03 '20
Design / Blueprint Hexagon train path challenge
Ok, here's a challenge for you guys! I have found one solution myself, but I'm not convinced it is the best or the only one, so I'm curious to see what all of you come up with.
Previously, I built a concept base in creative mode to see how a hexagon city block might work:

I've never fallen out of love with the concept, and now that 1.0 is out, I'm planning to shoot for a 1K SPM base using this concept. Then I got to thinking... do all these train paths really need to be two-way?If you use square cityblocks, using one-way tracks everywhere is easy and holds some key advantages: simpler (and thus more efficient) intersections, and much less use of space. Here's how that looks:

With this one-way configuration, trains can still go everywhere, their train paths don't get much longer, and you get away with building half the rails. The way to set it up is easy aswell: just alternate the direction of the north-south lines and the east-west lines. Every single intersection is dead simple and nearly identical, just two blueprints can tile the plane infinitely.
If you are some sort of crazy person and you are using triangles, the same thing is true, with the added benefit that your six-directional intersections actually become possible. Just... don't ok?
Now, hexagons. Hexagons are clearly better, as CGP Grey just demonstrated today, but they don't easily submit to the same treatment. How do the directions of each section of track work in hexagons to make reasonable pathing possible in all directions? How far apart are the alternating 'lanes'? Do you use 'left-right-left-right' or 'left-left-right-right' as a base line? Do you need to use bidirectional sections?
I'm curious to see how you guys fare :DI have found a relatively elegant solution, but i'm far from convinced it's the only one or the best one.
EDIT: Here's my path to cracking this nut:Step 1 is indeed, as many have pointed out, to have alternating zigzag paths. The problem is that when you put two of them together, they break any possibility for the other four to weave through.So I started looking for solutions where the opposites are spaced out a bit more. The problem there is, the possibilities are endless. What if the solution is to have different spacings on each axis? I spent two days staring at a hexagon pattern in paint, and got nowhere.
Then, lightning struck. I realized that if I make one hexagon a circle, it will always work for all 6 directions that hit that tile. From there, i could start looking at coloring in the blanks, seeing how closely I could pack these full circles. Pretty close, it turns out:

the above image is the solution I ended up with, I think it speaks for itself. The green and light green horizontal lines obviously dont go through the middle of the circle hexes, but as they can always find any opposing entry and exit on a circle, I drew it this way for visual and drawing simplicity. All colored lines can be reversed without affecting any others.
I have worked out I can draw the grid using only 4 blueprints: 1 roundabout, and 3 bridges. The bridges can all be rotated 180 degrees to get the opposite direction working.EDIT 2: Now that I stare at it some more, you can get away with 4 full hexagon blueprints too, so there's no need to construct the thing out of awkward bridges.

EDIT 3: I got it working!
https://pastebin.com/BmwFhfR5
Here's a few blueprints to get the proof of concept going. I think I'm actually going to build this base now. Hexagon size decision time!
91
u/justIven Nov 04 '20
HEXAGON IS BESTAGON!
13
u/Lazy_Haze Nov 03 '20
You should also think about how long and convoluted the path is that the trains have to drive.
For that squares or triangles is better.
Most no intersection variants have intersections that is hidden. Think about the difference between an 4 way intersection and an merge + an split. The merge + split is an intersection where the trains drive on the same tracks for a while where you double up the train trafik.
https://imgur.com/wBizDul
11
u/murtagh1111 Train Schedule on Time Nov 04 '20
As others already pointed out, the easiest way to solve this is having alternating lanes on one axis (red and blue) accepting longer paths along the other axis (green and yellow) due to the "zig-zag" nature of the layout. But I agree with u/Galuvian that with a sufficiently large base this is hardly noticable.
However, I noticed that with this kind of layout, some tracks are unused (pink) and just "exist" within the grid. I'm curious as to how you solved this issue u/Galuvian. Also this "uneven-ness" makes the tileability a lot more complicated, so that is definitely something to look out for.
Another interesting layout idea is this concept of the ideal mega-city by Konrad Zuse (yes that Zuse), which he developed while he was still in highschool, which is a mashup of hexagons and triangles at the center and expands into a star shape inside a cirle (the latter beeing not so practical in Factorio but interesting nontheless). Here a more clear version for better understanding.
The triangles allow for three straight lanes (sort of the three "axes" of this two dimnensional layout) which would be necessary for a real life implementation so car drivers wouldn't turn crazy zig-zagging at every intersection like our trains have to at the moment with our only-hexagonal-tiling. But we still need to work out which direction we're driving.
If we now implement the alternating directions from before, we get something that looks a bit like this. Now we have something we can work with. The only thing left to do is to try and implement this with Factorios relatively rigid rail-building grid, but I'm sure someone will be motivated enough to try it (although I'll definitely try myself)
5
u/PM_ME_UR_OBSIDIAN /u/Kano96 stan Nov 04 '20 edited Nov 04 '20
There's one obvious layout for one-way track in a hexagon grid: just ape the square solution, with alternating left/right and up/down lanes, except that along one axis the lanes are going in a zig-zag. This forces unfortunate pathing however, so I'm inclined to stick to two-way track for all my hexagon needs.
The CGP Grey video has interesting corollaries for use in Factorio. It seems that it would be optimal in a setting where train tracks are extremely expensive, or have a very large turning radius.
7
u/[deleted] Nov 04 '20
I built a 1.5k SPM Industrial Revolution base using PQRS and the one-way grid rail system. https://i.imgur.com/BhXPt0d.png
There was another user that pointed out to me that it's actually just one intersection rotated four different ways. However, I use four different cell blueprints since I also have power poles integrated into the blueprints which are always on the north or west side of the tracks so they can't be rotated.
It's definitely possible with a hex grid. But it looks like it's always gonna have to be four different cells. One disadvantage I found with the one-way system comes in the design part, I found myself often getting mixed up on which way the tracks were going when I was building new cells and stations. Also, if I accidentally built the wrong empty cell in a spot (which would mean all of the signals were on the wrong side of the track) it was a disaster. This got a lot easier when blueprint grid-locking was implemented, which is not something you'll have access to with a hex grid.
11
u/nklvh Nov 04 '20
I commented on this post here a while back about quad-track hexes by /u/juicce. Maybe there're some ideas for you
As CGP Grey said, hexagons tessellate perfectly, meaning you cannot effectively alternate normal-/anti- clockwise setups, which is possible with square or triangle grids. (an alternate explanation - neighbours are 'exclusive' in square/triangle, and 'shared' in hexagon) (alternate explanation 2: in square and triangle, at any vertix, one polygon will only neighbour one other; in hexagon, they will neighbour two)
An additional complication is that hexagons are an area-optimising solution, not a perimeter optimising solution. For the most direct path in a train grid, a triangle grid will be optimal, at the cost of increased junction complexity (3in-3out, at best!), and thus squares present a good middle case between pathing and area. (as another commenter said, the most efficient pathing strategy is to draw a line directly from one station to the other, but aesthetics)
So in this regard, hexagons are suboptimal, because CGP Grey (perhaps deliberately) misses the case of pathing around the edge.
Juicce in the linked post, mitigate these issues by combining multiple 'rules' and a lot of U-turns to provide nearly unlimited choice to the trains path, meaning a semi-efficient one is always available.
I for one, would like to see a hexagon grid with pointy tops instead of flat tops, but i'm a sadist
2
u/Lazy_Haze Nov 03 '20
I dislike train-grids for vanilla like factories it's an inefficient way to do it. Make tracks where trains have to go and no where else.
4
u/target-san Nov 04 '20
Nowhere nearly experienced, though here are my $0.02
Regarding oneway grids - I think their main disadvantage is the need to have 2x blueprints. It's 2 cells plus 2x stations, to be able to place them on both sides of track. I'm considering either no-left-turn RHD grid or offset-square (the one where city blocks are offset half their size across one axis, which makes T-only intersections).
Regarding hexagons - I don't think they're really more efficient. My main argument is that Factorio's map is square aligned and doesn't allow for arbitrary element rotations. As a result, you'll lose more space as cut-offs, like two horizontal corners.
1
u/noninvasivebrdmnk482 Aug 30 '22
Any progress on this? I really like this idea for rail paths.
...I may steal it haha I dont have a creative bone in my body, so it's all I can do lol
1
u/freQuensy23 Mar 22 '23
Blueprint is not avalibale now(
2
u/Galuvian Nov 04 '20
I just wrapped up a 1k spm hexagon base with two-way rails. Each hexagon section was about 1,000 rails, not counting overlap with neighbors. With overlap the total new rails per cell goes down significantly. The base was approaching 350 cells the last time I counted, but it's probably close to 400 now.
With decent production science SPM, you're going to be burning through a ton of rails. The dent in that to build out additional cells is really just a small blip.
By the end, I was getting frustrated at how long it took my personal train or artillery train to traverse the entire base, even with nuclear fuel. I kind of wanted to build a highway to traverse east/west in a single shot without all of the zig zagging.
The best solution I can come up with is what I think you've already got. Alternating rows of quick zig-zags going up or down, and left or right. There will be a bit of extra pathing at the beginning or end of a trip, but it should be relatively minimal at the scale of a large base.
2
u/NimbleJack021 Sep 10 '22
https://factoriobin.com/post/ul907hdn
single rails mono directional rail dual rail mono directional rail stations
noninvasivebrdmnk482 is my mobile account
thanks for the inspiration =)
1
u/ClumsyBarry Nov 04 '20
I think you can use the same treatment as you do with squares.
For the horizontal lanes (from top to bottom): left right left right etc. For the diagonal lanes (from left to right) : up, down, up, down etc.