Friday Facts #113 - Better rail building
Re: Friday Facts #113 - Better rail building
GAH! Starsector 0.7A release AND factorio 0.12 stable-ish? Which do I play first? But still well done on reaching a stable, time to do an update, always fun to play factorio, even if the music sounds like I'm playing xenonaunts.
As for the rail through the forest? I have a easy approach. It's called personal roboport and a deconstruction planner. Those pesky forests don't know what hit em when construction robots tear them to piece. Far faster than an axe and more material efficient than that route.
As for the rail through the forest? I have a easy approach. It's called personal roboport and a deconstruction planner. Those pesky forests don't know what hit em when construction robots tear them to piece. Far faster than an axe and more material efficient than that route.
I typically play Factorio, Minecraft, Rimworld, Starsector, Prison Architect and Stardrive 2. Oh and add XCOM, FTL and Homeworld. And Transport Tycoon...
Quite frankly, it's a miracle I get anything done.
Quite frankly, it's a miracle I get anything done.
-
- Long Handed Inserter
- Posts: 97
- Joined: Thu May 14, 2015 12:54 am
- Contact:
Re: Friday Facts #113 - Better rail building
While it moving through that forest is very resource inefficient, it looks REALLY FREAKING COOL!
Re: Friday Facts #113 - Better rail building
I'll admit that.AlexTheNotsogreat wrote:While it moving through that forest is very resource inefficient, it looks REALLY FREAKING COOL!
I typically play Factorio, Minecraft, Rimworld, Starsector, Prison Architect and Stardrive 2. Oh and add XCOM, FTL and Homeworld. And Transport Tycoon...
Quite frankly, it's a miracle I get anything done.
Quite frankly, it's a miracle I get anything done.
Re: Friday Facts #113 - Better rail building
Looks amazing, I bet it was fun to code as well. Any chance it can be extended to provide some more of the extra features the automatic rail layer provides? Track doubling is a must, as if the point of this is to make large rail systems easier, what large rail system doesn't use doubled track? Although I guess you could place another auto track with adjacent start and end points, but it may be the case that the previous rail didn't leave space in the right places to run another parallel line.
Another one would be automatic placement of signals, and perhaps power poles.
Another one would be automatic placement of signals, and perhaps power poles.
Re: Friday Facts #113 - Better rail building
Did you read this reply from kovarex?Theace98 wrote:As for the rail through the forest? I have a easy approach. It's called personal roboport and a deconstruction planner. Those pesky forests don't know what hit em when construction robots tear them to piece. Far faster than an axe and more material efficient than that route.
Just today I had to lay a rail through a big forest (limiting myself to vanilla) and had to constantly switch between deconstruction planner, straight rail and curved rail. This rail building method is much more efficient than I imagined when I heard the devs are redoing rails. This is just awesome.kovarex wrote:It will probably work the same way as blueprints. When you hold shift, trees get ignored.
For me Factorio is like an almost fully released (for my time spent / fun I had with it even AAA+) game that continues to improve in quality. I haven't seen such a rail laying mechanism in any game before and I really, really like that the devs explain the technical background behind each of these features every week. I just wish the devs of other early access (*) games that I have on steam would be as forthcoming and community-oriented as the Factorio team.
(*) Like mentioned above, for me Factorio has progressed to be far more than just "early access".
Re: Friday Facts #113 - Better rail building
I take it the heuristic function is not quite admissible (i.e., the cost-to-goal estimate can sometimes be slightly higher than the actual cost to goal)? It guess it's not strictly a traditional A* search.kovarex wrote: In the next example, the first solution found is not optimal, as the curves can be straightened, so extra steps of the algorithm is needed to find a better solution.
Re: Friday Facts #113 - Better rail building
This is what I always wished.
What I still don't get is: if there is only one type of rail left (which is very good), and if it works like blueprint, how could the character build curves without bots?
Other question is with signals etc. Will there be autoplacing of signal (a signal after X segments)? Autoplacing of poles? Will there be the possibility to lay 2 lanes at once (2x1-way tracks)?
And a bit off-topic: The features of the rail-layer mod are long. For example that it can use blueprints. Or laying tracks over water (using concrete). Will there be something like this?
What I still don't get is: if there is only one type of rail left (which is very good), and if it works like blueprint, how could the character build curves without bots?
Other question is with signals etc. Will there be autoplacing of signal (a signal after X segments)? Autoplacing of poles? Will there be the possibility to lay 2 lanes at once (2x1-way tracks)?
And a bit off-topic: The features of the rail-layer mod are long. For example that it can use blueprints. Or laying tracks over water (using concrete). Will there be something like this?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Re: Friday Facts #113 - Better rail building
I was wondering about this as well; it's very surprising given that Euclidean distance is admissible here. I think it might instead be a consequence of searching from both ends and meeting in the middle - looking at the given example of a suboptimal chosen path, each half of the path is definitely the right thing for the A* to be checking first, assuming it's using a variant of Euclidean-distance-to-target as its heuristic.Martoon wrote:kovarex wrote:
In the next example, the first solution found is not optimal, as the curves can be straightened, so extra steps of the algorithm is needed to find a better solution.
I take it the heuristic function is not quite admissible (i.e., the cost-to-goal estimate can sometimes be slightly higher than the actual cost to goal)? It guess it's not strictly a traditional A* search.
In other words, the algorithm found the shortest path from A->B->C (or really, A->B and C->B, but paths are reversible in this context), for some B that's not guaranteed to be on a globally shortest path from A->C.
Bidirectional A* is slightly more subtle than this - IIRC the constraints on the heuristic functions are stronger (fortunately Euclidean distance should still meet them in this case) and the stop criteria are different. However, I'm super curious as to the extent to which this algorithm's answers are 'good enough' or can be corrected with inexpensive and simple heuristics to be 'good enough'. What do the extra steps look like?
Re: Friday Facts #113 - Better rail building
Oh wow that looks brilliant! I hadn't even wanted auto rail laying until I saw how great it looked :-)
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Friday Facts #113 - Better rail building
Make a blueprint of a piece of track and you won't need to switch to the deconstruction planner, just need to switch between blueprintsdaniel34 wrote: Just today I had to lay a rail through a big forest (limiting myself to vanilla) and had to constantly switch between deconstruction planner, straight rail and curved rail. This rail building method is much more efficient than I imagined when I heard the devs are redoing rails. This is just awesome.
Re: Friday Facts #113 - Better rail building
Using Euclidean distance for the estimate is fine, and imho the best thing you should use in this case. Also A* doesn't have any nasty side effects when used bidirectional. To answer the question: You don't need any extra steps, A* (and Dijkstra) are designed in a way that the very first solution found is the best. However kovarex's wording and the picture suggest that the current implementation optimizes "pieces of track placed" counting both straights and curves as a single piece and thus favoring "curvy straights" (four pieces of curve cover the same distance as 14 straights) as shown in the picture. Better metrics would be "number of (new) rail items required for building" (i.e. counting a curve as 4 instead of 1) or actual track length (straights as 2 tiles, diagonals as sqrt(2), curves as approx. 7.85)knexer wrote:I was wondering about this as well; it's very surprising given that Euclidean distance is admissible here. I think it might instead be a consequence of searching from both ends and meeting in the middle - looking at the given example of a suboptimal chosen path, each half of the path is definitely the right thing for the A* to be checking first, assuming it's using a variant of Euclidean-distance-to-target as its heuristic.Martoon wrote:I take it the heuristic function is not quite admissible (i.e., the cost-to-goal estimate can sometimes be slightly higher than the actual cost to goal)? It guess it's not strictly a traditional A* search.kovarex wrote:In the next example, the first solution found is not optimal, as the curves can be straightened, so extra steps of the algorithm is needed to find a better solution.
In other words, the algorithm found the shortest path from A->B->C (or really, A->B and C->B, but paths are reversible in this context), for some B that's not guaranteed to be on a globally shortest path from A->C.
Bidirectional A* is slightly more subtle than this - IIRC the constraints on the heuristic functions are stronger (fortunately Euclidean distance should still meet them in this case) and the stop criteria are different. However, I'm super curious as to the extent to which this algorithm's answers are 'good enough' or can be corrected with inexpensive and simple heuristics to be 'good enough'. What do the extra steps look like?
This sentence, especially the bold part is a dead giveaway that the implementation is wrong, in this case because you're optimizing the wrong thing.kovarex wrote:In the next example, the first solution found is not optimal, as the curves can be straightened, so extra steps of the algorithm is needed to find a better solution.
Re: Friday Facts #113 - Better rail building
Correct; but this doesn't apply to the bidirectional variants of either algorithm. The last scanned node of the first complete path needn't be on a global optimal path at all. Instead, once those path trees have met, you can bound how far away you are from an optimal solution, then search until those bounds are met and take the overall best solution you saw. (This might be those 'extra steps' kovarex mentioned?)A* (and Dijkstra) are designed in a way that the very first solution found is the best.
See lecture notes (warning: pdf): http://www.cs.princeton.edu/courses/arc ... rithms.pdf
Re: Friday Facts #113 - Better rail building
Yeah, the point where I went wrong was assuming A* has a trivial bidirectional variant. I've dug up my own university's slides on that topic, but yours do a better job at explaining things.knexer wrote:Correct; but this doesn't apply to the bidirectional variants of either algorithm. The last scanned node of the first complete path needn't be on a global optimal path at all. Instead, once those path trees have met, you can bound how far away you are from an optimal solution, then search until those bounds are met and take the overall best solution you saw. (This might be those 'extra steps' kovarex mentioned?)A* (and Dijkstra) are designed in a way that the very first solution found is the best.
See lecture notes (warning: pdf): http://www.cs.princeton.edu/courses/arc ... rithms.pdf
Conclusion: I messed up. kovarex's A* implementation and metric are fine (for the unidirectional case). To fix the bidirectional problem see the pdf mentioned above. If you prefer German, see slides 52 to 55 of http://i11www.iti.uni-karlsruhe.de/_med ... esung6.pdf (pdf, ~5MB), but the one from Princeton seems to explain things better.
Intuition says you want to explore towards the closest point of the opposite wavefront instead towards the opposite root, but I don't see that in the slides, so don't quote me on that. Also it's getting late over here...
Re: Friday Facts #113 - Better rail building
0.12.18 released today hu?
-
- Long Handed Inserter
- Posts: 98
- Joined: Sun Jul 12, 2015 6:28 pm
- Contact:
Re: Friday Facts #113 - Better rail building
Please keep the ability to manually place, without bots/blueprints, both straight and curve rails as we can at the moment.
Also to be able to drag straight rail without invoking the pathfinding, so that we can still build really long straights.
Maybe making the straight rail act as it already does, and the curve rail act as your planner item, would work best? So that if you just click with a curve rail it places it with specified rotation as it works at the moment, but if you click and drag with curve rail it invokes the pathfinding. Because dragging straight rail in the current version makes sense, but dragging curve rail doesn't.
Also to be able to drag straight rail without invoking the pathfinding, so that we can still build really long straights.
Maybe making the straight rail act as it already does, and the curve rail act as your planner item, would work best? So that if you just click with a curve rail it places it with specified rotation as it works at the moment, but if you click and drag with curve rail it invokes the pathfinding. Because dragging straight rail in the current version makes sense, but dragging curve rail doesn't.
-
- Manual Inserter
- Posts: 4
- Joined: Tue May 26, 2015 7:00 am
- Contact:
Re: Friday Facts #113 - Better rail building
Two points:
As an programmer myself I really appreciate the techtalk in the Friday Facts. Keep going like this
But as an gamer I have to admince that since many months there isn't enough new - not even with mods for me to play factorio again.
Is there any way or option which I missed to further enjoy factorio?
As an programmer myself I really appreciate the techtalk in the Friday Facts. Keep going like this
But as an gamer I have to admince that since many months there isn't enough new - not even with mods for me to play factorio again.
Is there any way or option which I missed to further enjoy factorio?
-
- Burner Inserter
- Posts: 8
- Joined: Mon Jun 02, 2014 6:50 pm
- Contact:
Re: Friday Facts #113 - Better rail building
This might be a silly question, shouldn't weighting straight tiles less (say according to length, or even a bit more biased toward straight tracks) solve this? Obviously, having not built this, I have no idea of the intricacies of the problem, but I'm genuinely interested.From the post wrote:Once the first solution is found(start and goal searches meet with opposite directions), the search continues for a little while, as better solutions might exist.
Re: Friday Facts #113 - Better rail building
I'd like an option to choose which, sometimes I want the trees, sometimes they come down.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?
Re: Friday Facts #113 - Better rail building
Silden wrote:I'd like an option to choose which, sometimes I want the trees, sometimes they come down.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?
kovarex wrote:It will probably work the same way as blueprints. When you hold shift, trees get ignored.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?
Re: Friday Facts #113 - Better rail building
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.nocturnalAndroid wrote:This might be a silly question, shouldn't weighting straight tiles less (say according to length, or even a bit more biased toward straight tracks) solve this? Obviously, having not built this, I have no idea of the intricacies of the problem, but I'm genuinely interested.From the post wrote:Once the first solution is found(start and goal searches meet with opposite directions), the search continues for a little while, as better solutions might exist.