## Friday Facts #113 - Better rail building

Regular reports on Factorio development.
cube
Former Staff
Posts: 1111
Joined: Tue Mar 05, 2013 8:14 pm
Contact:

### Re: Friday Facts #113 - Better rail building

Smarty wrote:0.12.18 released today hu? :P
Yeah, sorry for that, something broke again. Monday.

Smarty
Global Moderator
Posts: 816
Joined: Sat Oct 04, 2014 5:00 pm
Contact:

### Re: Friday Facts #113 - Better rail building

cube wrote:
Smarty wrote:0.12.18 released today hu?
Yeah, sorry for that, something broke again. Monday.
no worries

nocturnalAndroid
Burner Inserter
Posts: 8
Joined: Mon Jun 02, 2014 6:50 pm
Contact:

### Re: Friday Facts #113 - Better rail building

kyborek wrote: I was thinking exactly the same. The only reason i can think of for such solution is the one where prefering curves and then counting a bit more after solution is found is on average faster than preferring straight rails that lead to nowhere. Such issue should still be solved by A* algorithm anyway but i don't know how does the both-way variant work.

Hmmm, I didn't think about the two way thing, that might create some strange situation, though I'm not sure how it's implemented so it's hard to speculate. Also, your point about preferring curves seems plausible as the straight track is shorter and therefor will create deeper search trees. But, a track length metric seems to me like the most sensible one. If you go by number of rails pieces it might be hard to come up with an admissible heuristic, which, come to think of it, must be the issue, as an admissible heuristic guarantees optimally (I think...)

Nemoricus
Fast Inserter
Posts: 172
Joined: Mon Jan 19, 2015 7:48 am
Contact:

### Re: Friday Facts #113 - Better rail building

Would it be possible to add 'waypoints' to the rail planner? That is, you can tell the planner that you want the rail to pass through certain points on its route to the destination. While, yes, you could get this by building the rail in segments, this would allow you to see what the results would be before you commit to building the final track.

And I'll echo the others in asking for the ability to build any direction or shape of track by hand. Sometimes you want that fine control.

aRatNamedSammy
Fast Inserter
Posts: 216
Joined: Tue Jul 08, 2014 4:26 pm
Contact:

### Re: Friday Facts #113 - Better rail building

kovarex wrote:
hitzu wrote:One question: why this algorithm avoid trees? If it works like a blueprint doesn't it should just lay tracks on top of the trees marking them to be removed?
It will probably work the same way as blueprints. When you hold shift, trees get ignored.
:O.. love it... ability to choose , ignore or not, .. love that feature since on blueprints.... and laying tracks will work same way extra nice !!
Teeth for Two (so sorry my bad english)

GeniusIsme
Burner Inserter
Posts: 15
Joined: Sun Sep 28, 2014 7:26 am
Contact:

### Re: Friday Facts #113 - Better rail building

To perform a bidirectional search, one does not need to run two instances of algorithm, looking for their results to intersect. Use abstraction power of A*. Let it add rails to solution at both ends and compute you heuristic based on endpoint of each track (one from beginning, one from end).

Speaking of heuristics, euclidean is admissible, but not very informative here. That can be profitable to explore incentives to place curves to rotate to other end direction and/or not to place curves which derail path from meeting with other end. These could cut a lot of search space.

Long Handed Inserter
Posts: 68
Joined: Sat Nov 07, 2015 1:55 am
Contact:

### Re: Friday Facts #113 - Better rail building

Looking forward to using the new rail system

ssilk
Global Moderator
Posts: 11176
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

### Re: Friday Facts #113 - Better rail building

What I just thought through: The algorithm can be used also to create
- rails-tracks by using already existing rails. A problem here is the direction, given by signals (distinction between one-way rail and two-way rails) (*)
- pipes (shortest way between two points, which uses already existing pipes (which should be of course from the same liquid-type, that would be a cool feature, see https://forums.factorio.com/forum/vie ... =6&t=17286 ))
- belts (inclusive underground belts under rails or other belts)
- poles, roboports (any item which needs to be connected from A to B)
- paths/routes for natives, and/or automatic driven vehicles.

This is GREAT!

(*) I see an extension to the rail-layer-mod: I just say "Create a track from station A (the origin station for the raillayer) to (unconnected) station B. Start."
You can slowly walk to station B, while the raillayer lays the rails to that station. A cool problem is to lay double- (triple-, quadruple?) tracks.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Long Handed Inserter
Posts: 68
Joined: Sat Nov 07, 2015 1:55 am
Contact:

### Re: Friday Facts #113 - Better rail building

Something I just thought of:

How will placing the rails with the new system work if you don't have a personal roboport?

I apologize in advance if this has been brought up but when I was skimming through the replies I didn't see anything

ssilk
Global Moderator
Posts: 11176
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

### Re: Friday Facts #113 - Better rail building

vaderciya wrote:Something I just thought of:

How will placing the rails with the new system work if you don't have a personal roboport?

I apologize in advance if this has been brought up but when I was skimming through the replies I didn't see anything
We have the same question: https://forums.factorio.com/forum/vie ... 40#p117856
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

kovarex
Factorio Staff
Posts: 7502
Joined: Wed Feb 06, 2013 12:00 am
Contact:

### Re: Friday Facts #113 - Better rail building

The work I'v shown there was mainly WIP.
I will make some note about it in the next FFF when the feature is finished completely.

There are basically two modes:
• Manual mode (normal build), the planner length is limited to small rail distance (around 20), and it builds rails directly from the inventory. In this mode, the closest point to the cursor is used. No collisions are checked in this mode, so you don't build strange paths because of the one tree that was in the way. It is intended to be used to build small paths segments, while the overall plan of the path is planned by the player.
• Ghost mode (shift build the same as when building ghosts), the planner length is (almost) unlimited, it builds rail ghosts. It searches path to the exact point specified by cursor. It also allows to user to specify exact ending rotation if he wants to. It checks for collisions and it is intended to be used to build longer paths.
Thanks for the notes about the double rail. Building double rail is very common thing, so I will probably try to find a way to make even double rail building possible.

goertzenator
Inserter
Posts: 30
Joined: Thu Feb 20, 2014 8:59 pm
Contact:

### Re: Friday Facts #113 - Better rail building

For the pre-robot game I'd love to have a "build ghosts" button that constructs all ghost objects within the players build radius with items from his/her inventory. In other words, it works like a very short range manually-activated personal roboport. This way you don't need a manual rail mode; you just lay the ghost track down and then walk the track's path hammering the "build ghosts" button to lay the actual rail. This of course is useful beyond just railway tracks.

Drury
Filter Inserter
Posts: 740
Joined: Tue Mar 25, 2014 8:01 pm
Contact:

### Re: Friday Facts #113 - Better rail building

goertzenator wrote:For the pre-robot game I'd love to have a "build ghosts" button that constructs all ghost objects within the players build radius with items from his/her inventory. In other words, it works like a very short range manually-activated personal roboport. This way you don't need a manual rail mode; you just lay the ghost track down and then walk the track's path hammering the "build ghosts" button to lay the actual rail. This of course is useful beyond just railway tracks.
I like this idea, an argument can be raised though that it would diminish the importance of robots, especially personal roboport.

Then again, I do support this.

obstinate
Inserter
Posts: 45
Joined: Sun Aug 16, 2015 7:25 am
Contact:

### Re: Friday Facts #113 - Better rail building

Oh god I want this.

Kuro-Maii
Burner Inserter
Posts: 8
Joined: Tue Nov 24, 2015 11:58 am
Contact:

### Re: Friday Facts #113 - Better rail building

I do not really get why everybody is asking how it will work "pre(-personal)-roboport"
here is why:
The player has a range she/he can place things in the world, beyond this range the game make an error sound.
so if you where to "auto build" beyond that player range I would guess that the game either informs with an error sound that the player is being silly, or place what the player can reach and then tells the player that beyond that is just being silly..

If you have the research done for blueprints the player can place a ghost image of anything by holding shift ( or your remapped equivalent )
in this case it does not matter if you have roboports ( personal or normal ) or not when the player goes to make a "long" track ( beyond place-able range ) I would expect the game to place a ghost, as if I held shift and clicked them one by one myself.
If I where to hold down shift in this case I would expect the blueprint style of placing marking all trees in the way of the optimal path for removal.

If I do this beyond the range of the construction network ( personal or the one of the base, if any ) I can then just run around axe the the trees to move, or plow with the shotgun, and place the track myself on the ghost images the game planned for me.

SHiRKiT
Filter Inserter
Posts: 700
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

### Re: Friday Facts #113 - Better rail building

I personally use PocketRobots from start mod on all my games.

So, a request: can we force just using straight lines? 0-45-90-135-180-225-270-315

Martc
Long Handed Inserter
Posts: 85
Joined: Wed May 21, 2014 8:20 am
Contact:

### Re: Friday Facts #113 - Better rail building

kovarex wrote:Thanks for the notes about the double rail. Building double rail is very common thing, so I will probably try to find a way to make even double rail building possible.
Auto-placing signals after specified distance would be also nice. Especially on double rail track.

Peter34
Smart Inserter
Posts: 1092
Joined: Mon Nov 10, 2014 12:44 pm
Contact:

### Re: Friday Facts #113 - Better rail building

Drury wrote:I like this idea, an argument can be raised though that it would diminish the importance of robots, especially personal roboport.
No. Because one Personal RoboPort isn't important to begin with. The beauty of them only happens when you install several into your modular armour.

Each RoboPort adds to your area total, and your actual area is then the square root of your area total. IIRC, its 400 tiles per Personal RoboPort, thus with one you have an area of 20x20 tiles, 10 tiles out in each direction from your current location. Add a second RoboPort and you have 800 tiles, which is 28x28 tiles, much sweeter already. A third one and you have 34x34 tiles. Four gives 40x40, and so forth.

Nobody uses just one Personal RoboPort. Not if they have a 7x7 or larger armour.

wwdragon
Long Handed Inserter
Posts: 91
Joined: Sun Jun 28, 2015 12:16 am
Contact:

### Re: Friday Facts #113 - Better rail building

Wow! That new rail building looks like it'll really save on effort!

steinio
Smart Inserter
Posts: 2476
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

### Re: Friday Facts #113 - Better rail building

I guess this S shapes everywhere would look silly in the whole factory. Why did the algorithm not just plan a straight route through the forest? This would also cost less resources.

Just wondering.
steinio

Transport Belt Repair Man