Making fluid wagons work on a curved rail
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Making fluid wagons work on a curved rail
Hi folks,
I see from the bug reports that fluid wagons and pumps aren't supported when part of the train sequences (not the fluid wagon themselves, of course) are on a curved rail. I've had hit or miss success with this and it worked the first time but not the second time. When using long trains not being able to used curves at stops is a bit of show stopper.
Is there something we can do to, perhaps with the debug options, to figure out how to align the rail so that it works?
Cheers
I see from the bug reports that fluid wagons and pumps aren't supported when part of the train sequences (not the fluid wagon themselves, of course) are on a curved rail. I've had hit or miss success with this and it worked the first time but not the second time. When using long trains not being able to used curves at stops is a bit of show stopper.
Is there something we can do to, perhaps with the debug options, to figure out how to align the rail so that it works?
Cheers
OptimaUPS Mod, pm for info.
Re: Making fluid wagons work on a curved rail
You can make a mod that disables this by increasing fluid_wagon_connector_alignment_tolerance on pump entity prototype.
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Making fluid wagons work on a curved rail
That would require more effort than simply re-arranging the rails. Is it possible to simply change a file or execute a lua command?
OptimaUPS Mod, pm for info.
Re: Making fluid wagons work on a curved rail
you would have to change one of the core prototype definition files, which is arguably more work than using a mod.blazespinnaker wrote: ↑Mon Sep 27, 2021 2:37 pm That would require more effort than simply re-arranging the rails. Is it possible to simply change a file or execute a lua command?
in fact, there's already a mod for this: https://mods.factorio.com/mod/fluid-wagon-curved-rails
Re: Making fluid wagons work on a curved rail
I see that sets the tolerance for pumps to connect to 1.0. Is that pixels? Tiles?ptx0 wrote: ↑Mon Sep 27, 2021 3:25 pmyou would have to change one of the core prototype definition files, which is arguably more work than using a mod.blazespinnaker wrote: ↑Mon Sep 27, 2021 2:37 pm That would require more effort than simply re-arranging the rails. Is it possible to simply change a file or execute a lua command?
in fact, there's already a mod for this: https://mods.factorio.com/mod/fluid-wagon-curved-rails
I assume the aim is to make it tolerant to the fluid wagon being slightly off after a curve. But what happens after 2 curves? or 10? A train with 1000 fluid wagons and 100 locomotives can go around a lot of curves. If it's tolerant up to 1 tile then I guess at some point you just move the pump by 1 tile to compensate.
I really wish they would change the curve radius just a little bit so the wagons would align after a curve.
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Making fluid wagons work on a curved rail
Yeah, I saw that, but it's not listed in Factorio mods for installing.
If I just have to edit a text file, that sounds pretty trivial. However, if it is some sort of binary edit, than yes a mod would be easier though likely not easier than just moving all the fluids to a vertical rail.
If I just have to edit a text file, that sounds pretty trivial. However, if it is some sort of binary edit, than yes a mod would be easier though likely not easier than just moving all the fluids to a vertical rail.
OptimaUPS Mod, pm for info.
-
- Filter Inserter
- Posts: 665
- Joined: Wed Sep 16, 2020 12:45 pm
- Contact:
Re: Making fluid wagons work on a curved rail
ok, so 10 second change in C:\Program Files\Factorio\data\base\prototypes\entity\entities.lua
fluid_wagon_connector_alignment_tolerance = 1.0, (was some fraction before)
And seriously, in alt mode you can't even see the graphic! I mean, geez guys
can't believe I wasted silly amounts of time on this.
fluid_wagon_connector_alignment_tolerance = 1.0, (was some fraction before)
And seriously, in alt mode you can't even see the graphic! I mean, geez guys
can't believe I wasted silly amounts of time on this.
OptimaUPS Mod, pm for info.
Re: Making fluid wagons work on a curved rail
You can't do it without giving up circularity on the curve or the rail grid. Pi is your enemy. Wider tolerances on the pump connection's basically the only option that doesn't break things.
Re: Making fluid wagons work on a curved rail
Nothing to do with circularity. l = 2 * Pi * r. If you want l to be an integer then r just becomes a irrational number. The change in r should be rather small and you wouldn't have to change the graphics at all. Just allow some tolerance in the connections between train cars so everything draws exactly like now while the radius being slightly different.
Re: Making fluid wagons work on a curved rail
I was already thinking about changing the curved rail length from 7.842 to exactly 8 (so the position function would be tighter a little bit) so the distances on curved rail were not kept properly, but this approach turned out to be a garbage anyway because a 90deg bend will also contain an odd number of diagonal straight rails which are 1.414 long. I am not going to change them to be 2 tiles long as that would be too much distortion. Only other possibility would be to have diagonals 1.5 long but then the curved rails would have to be 7.75 long. This approach with diagonals of 1.5 would only work with 90 deg bends where there are odd numbers of diagonals. In case of a rail shift by 6+2N tiles there are odd numbers of diagonals and the train would be misaligned by exactly 0.5.
The only proper solution would be to rework the pump entity itself so it does not have this arm to reach a fluid wagon fluid connector or to change it in a spider-leg-like way where it would work with any possible fluid connector position. With that solution it would be allowed to work with any train alignment.
The only proper solution would be to rework the pump entity itself so it does not have this arm to reach a fluid wagon fluid connector or to change it in a spider-leg-like way where it would work with any possible fluid connector position. With that solution it would be allowed to work with any train alignment.
Re: Making fluid wagons work on a curved rail
mrvn wrote: ↑Tue Sep 28, 2021 3:40 pmNothing to do with circularity. l = 2 * Pi * r. If you want l to be an integer then r just becomes a irrational number. The change in r should be rather small and you wouldn't have to change the graphics at all. Just allow some tolerance in the connections between train cars so everything draws exactly like now while the radius being slightly different.
If you make r an irrational number, you lose the grid. If you make both r and l integers, you lose circularity.
Re: Making fluid wagons work on a curved rail
Not that rail circles are all that circular in Factorio. There are straight diagonal pieces in there. A curved piece cannot mathematically have constant curvature and have the endpoints that it has. It’s easy to see with the naked eye. Nevertheless, the length does appear to be irrational.
It also isn’t an absolute showstopper. With the right combination of curved and diagonal pieces, you can get a length close to an integer, within unmodded tolerances. The amount of rail and wagons to realign is still a mild disaster, however.
It also isn’t an absolute showstopper. With the right combination of curved and diagonal pieces, you can get a length close to an integer, within unmodded tolerances. The amount of rail and wagons to realign is still a mild disaster, however.
Re: Making fluid wagons work on a curved rail
Curved stations are usually using 180° turn. At least I have never seen a station with an S curve. The 7.75 for curved and 1.5 for diagonals sounds fair to me. That would work for 90°, 180°, 270°, 360° turns as is.boskid wrote: ↑Tue Sep 28, 2021 3:52 pm I was already thinking about changing the curved rail length from 7.842 to exactly 8 (so the position function would be tighter a little bit) so the distances on curved rail were not kept properly, but this approach turned out to be a garbage anyway because a 90deg bend will also contain an odd number of diagonal straight rails which are 1.414 long. I am not going to change them to be 2 tiles long as that would be too much distortion. Only other possibility would be to have diagonals 1.5 long but then the curved rails would have to be 7.75 long. This approach with diagonals of 1.5 would only work with 90 deg bends where there are odd numbers of diagonals. In case of a rail shift by 6+2N tiles there are odd numbers of diagonals and the train would be misaligned by exactly 0.5.
The only proper solution would be to rework the pump entity itself so it does not have this arm to reach a fluid wagon fluid connector or to change it in a spider-leg-like way where it would work with any possible fluid connector position. With that solution it would be allowed to work with any train alignment.
As for stations with an S curve: 2 curved rails + 2 diagonals = 2*7.75 + 2*1.5 = 15.5 + 3 = 18.5. So, as you say, 0.5 out of alignment. Why can't pumps deal with that?
Normally the pump can be in one of 4 tiles (2 per side) to connect to the tank in the center. So it reaches 0.5 tiles across. With a 0.5 tile offset a pump that reaches straight would fit perfectly. It would require new graphics for a straight reaching arm. Would that be so much work or just setting a new angle in the 3D model and rendering it again? I guess you also need to extend the prototype for the third arm position. Still doesn't sound earth shattering.
Re: Making fluid wagons work on a curved rail
That's true, but it's still got two smaller 22.5 degree curves at the beginning and end of the rail, which causes the same issue. And, even in the case where there was a strict 45 degree diagonal with an unsmoothed join, that would still give you irrational lengths because the square root of 2 is also an irrational number.
So you can't win. I suppose you could try and fudge things by jiggering exactly where the curves and straight alignments are, but I think it'd get real messy real quick.
Re: Making fluid wagons work on a curved rail
It isn’t entirely unreasonable. For mrvn’s 180° turn, you can add two extra diagonals (4 curves and 4 diagonals in total). That’s still within tolerances when you do it twice. But that’s the best of the worst. The most compact solution for a 90° turn is 2 curves with 25 diagonals. There’s your mild disaster. At least the next turn can consist of as little as 2 curves with 3 diagonals.
Re: Making fluid wagons work on a curved rail
it's times like this that i wish my brain worked better with geometric maths. where's my TI-89 calculator...