Friday Facts #113 - Better rail building

Regular reports on Factorio development.
Trev_lite
Inserter
Inserter
Posts: 43
Joined: Sat Mar 28, 2015 9:20 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by Trev_lite »

I thought that the great things about the A* algorithm is that the first solution it finds is optimal (given that some constraints on the heuristic it uses). The only reason that A* search will find a curved path before a curved path that is just as good is if the curves are tied in cost of rails (assuming that the rails used is the cost function). One way to make it prefer straight paths is to set the cost for curves used in the A* heuristic to be infinitesimally greater (1 millionth might work) than the plain cost in rails. The devs have probably all ready thought of everything I am saying but I would like more details on the rail A* algorithm to satisfy my curiosity.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by ratchetfreak »

Trev_lite wrote:I thought that the great things about the A* algorithm is that the first solution it finds is optimal (given that some constraints on the heuristic it uses). The only reason that A* search will find a curved path before a curved path that is just as good is if the curves are tied in cost of rails (assuming that the rails used is the cost function). One way to make it prefer straight paths is to set the cost for curves used in the A* heuristic to be infinitesimally greater (1 millionth might work) than the plain cost in rails. The devs have probably all ready thought of everything I am saying but I would like more details on the rail A* algorithm to satisfy my curiosity.
Actually the curve cost would need to be larger by a decent factor, 4 curves can span the length of 12 straight pieces (if I got the math right) so curves need to be at least 3 times as expensive. Then you can add a small offset to make the algorithm prefer the straights

slindenau
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Fri Mar 25, 2016 1:46 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by slindenau »

Please don't remove the option to manually place curved rails entirely...i can already see myself fighting against the algorithm that is not doing what i want it to do.

Make it a config option or something, power users will want to manually place curved rails in some cases.
My mod: "Auto Deploy Destroyers" (follower robots) viewtopic.php?f=97&t=24545

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by Klonan »

slindenau wrote:Please don't remove the option to manually place curved rails entirely...i can already see myself fighting against the algorithm that is not doing what i want it to do.

Make it a config option or something, power users will want to manually place curved rails in some cases.
I don't see any cases where this will happen,
The system is very robust, and... well you will see ;)

CodAv
Burner Inserter
Burner Inserter
Posts: 7
Joined: Fri Apr 15, 2016 8:45 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by CodAv »

Just a small fact which left me wondering: in the FFF you state that the algorithm takes a lot of iterations for long and complicated paths, which don't really fit inside a single 1/60s game tick. As Factorio already supports multithreading, wouldn't it make sense to calculate the path fully asynchronous instead of a few steps per tick and update the interface in the next frame after the calculation has finished? Even if it takes a few ticks, the probability that anything changes in the given area which could possibly obstruct the rails is quite low. Since Factorio seemingly already creates a (fixed, small) thread pool, there is no real overhead for creating and joining the worker thread.

slindenau
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Fri Mar 25, 2016 1:46 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by slindenau »

Klonan wrote:
slindenau wrote:Please don't remove the option to manually place curved rails entirely...i can already see myself fighting against the algorithm that is not doing what i want it to do.

Make it a config option or something, power users will want to manually place curved rails in some cases.
I don't see any cases where this will happen,
The system is very robust, and... well you will see ;)
I trust your skills, i won't judge this change until i've actually played with it in 0.13.
If i find any problems, i'll let you guys know :).
My mod: "Auto Deploy Destroyers" (follower robots) viewtopic.php?f=97&t=24545

AlexTheNotsogreat
Long Handed Inserter
Long Handed Inserter
Posts: 96
Joined: Thu May 14, 2015 12:54 am
Contact:

Re: Friday Facts #113 - Better rail building

Post by AlexTheNotsogreat »

How would you build the rails without robots?

Edit: guess I missed this!
kovarex wrote: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.

User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1063
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by brunzenstein »

AlexTheNotsogreat wrote:How would you build the rails without robots?

Edit: guess I missed this!
kovarex wrote: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.
Isn't Ghost mode for robot build tracks only?

searker
Long Handed Inserter
Long Handed Inserter
Posts: 91
Joined: Fri Nov 27, 2015 3:12 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by searker »

brunzenstein wrote:
AlexTheNotsogreat wrote:How would you build the rails without robots?

Edit: guess I missed this!
kovarex wrote: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.
Isn't Ghost mode for robot build tracks only?
Thats what it sounds like.
I guess you could use the Ghost mode to plan a length of track (like using a blueprint without robots) and then use the Manual mode to build it in smaller segments.

User avatar
brunzenstein
Smart Inserter
Smart Inserter
Posts: 1063
Joined: Tue Mar 01, 2016 2:27 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by brunzenstein »

searker wrote:
brunzenstein wrote:
AlexTheNotsogreat wrote:How would you build the rails without robots?

Edit: guess I missed this!
kovarex wrote: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.
Isn't Ghost mode for robot build tracks only?
Thats what it sounds like.
I guess you could use the Ghost mode to plan a length of track (like using a blueprint without robots) and then use the Manual mode to build it in smaller segments.
Not so easy as the Ghost print vanishes after a few minutes - but...
soon we know...

Ojelle
Fast Inserter
Fast Inserter
Posts: 143
Joined: Thu Feb 12, 2015 9:21 am
Contact:

Re: Friday Facts #113 - Better rail building

Post by Ojelle »

brunzenstein wrote:
searker wrote:
brunzenstein wrote:
AlexTheNotsogreat wrote:How would you build the rails without robots?



Thats what it sounds like.
I guess you could use the Ghost mode to plan a length of track (like using a blueprint without robots) and then use the Manual mode to build it in smaller segments.
Not so easy as the Ghost print vanishes after a few minutes - but...
soon we know...

I can build a lot of track in 5Min!
Choumiko wrote:
sillyfly wrote:kovarex just posted the thread... but with #118 in the title. I think they had too much beer :D
It's a wonder how good the game is, if you consider how bad they are with the FFF numbers :mrgreen:

Maja153
Inserter
Inserter
Posts: 41
Joined: Wed May 11, 2016 12:03 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by Maja153 »

How do you use it?

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by Klonan »

Maja153 wrote:How do you use it?
Check the entry on it here:
http://guide.factorio.com/new-features-013.html

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Friday Facts #113 - Better rail building

Post by Zeblote »

Klonan wrote:
Maja153 wrote:How do you use it?
Check the entry on it here:
http://guide.factorio.com/new-features-013.html
That's great :D

However... can you remove or reduce this huge header?

Image

Or maybe make it not static on the page?

User avatar
Drury
Filter Inserter
Filter Inserter
Posts: 783
Joined: Tue Mar 25, 2014 8:01 pm
Contact:

Re: Friday Facts #113 - Better rail building

Post by Drury »

Zeblote wrote:However... can you remove or reduce this huge header?

Image

Or maybe make it not static on the page?
Yeah this is taking up a solid half of my screen.

Mion
Long Handed Inserter
Long Handed Inserter
Posts: 64
Joined: Thu Dec 04, 2014 7:38 am
Contact:

Re: Friday Facts #113 - Better rail building

Post by Mion »

Zeblote wrote: However... can you remove or reduce this huge header?

Image

Or maybe make it not static on the page?
Bump it up :D

taylorwilson
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Jul 01, 2016 6:33 am
Contact:

Re: Friday Facts #113 - Better rail building

Post by taylorwilson »

i like it :)

Post Reply

Return to “News”