What is the exact shape of a curved rail?
What is the exact shape of a curved rail?
I’ve been wondering about this for a while. FFF #377 spurred my interest again. We know the current curved rail moves 7 tiles in the major direction and 3 tiles in the minor direction, curving from 0° to 45°. That is not possible with a circular arc alone. I’ve tried some arrangements like a circular arc followed by a straight segment (length (1+√2)π-4+3√2≈7.827) and splines, maintaining C1 smoothness, but nothing quite matches the measured length of 7.842081225095013 used by the game. Not super important. It’s just killing me.
The new pieces raise the same question. The new cardinal-adjacent curve could be a circular arc of radius 13, but the resulting 12:5 direction wouldn’t line up with 2:1 straights. It will have to be some mixed shape hitting 2:1. The diagonal-adjacent curve has no such theoretical possibility at all. Not that many people even have access now. And then the new bridges add even more curves. Bring on the speculation!
The new pieces raise the same question. The new cardinal-adjacent curve could be a circular arc of radius 13, but the resulting 12:5 direction wouldn’t line up with 2:1 straights. It will have to be some mixed shape hitting 2:1. The diagonal-adjacent curve has no such theoretical possibility at all. Not that many people even have access now. And then the new bridges add even more curves. Bring on the speculation!
Re: What is the exact shape of a curved rail?
Maybe a super ellipse ? https://procato.com/superellipse/ ( try with same height and width and default n or at least >2 ), i have no idea how one would measure the precise distance then x). I've seen those used in video games that mimick real life architecture because of their "visual appeal".
The new curves pieces have ratio of 5:1 then 4:3 and then 3:4 and 1:5 for to make 1/4 arc circle i counted from the FFF. It think it makes is so that control point are placed on integer value instead of half tile as if a 12:5 curve was used to introduce 2:1 which is what you say ?
Again no idea how one would math out the precise lengh
Re: What is the exact shape of a curved rail?
Nevermind found it !
https://www.reddit.com/r/factorio/comme ... cars_dont/
8.55 - sqrt(2)/2 = 7.84289321881
https://www.reddit.com/r/factorio/comme ... cars_dont/
8.55 - sqrt(2)/2 = 7.84289321881
Re: What is the exact shape of a curved rail?
It has to be a function of distance giving a position, that’s easy to evaluate. It’s easy to do that with things like arcs and splines. Superellipses, not so much. At best, there was an attempt to use such a fancy shape, but then it was approximated by other means.
8.55 - sqrt(2)/2 = 7.84289321881 seems more like a lucky approximation. It’s still off by nearly 0.001, which is ginormous at this level of precision. The source is another post which asserts that a quarter turn is exactly 17.1 tiles, which is not true. It also doesn’t tell you anything about the shape.
I might try to get it from the internals. It’s pain, though.
8.55 - sqrt(2)/2 = 7.84289321881 seems more like a lucky approximation. It’s still off by nearly 0.001, which is ginormous at this level of precision. The source is another post which asserts that a quarter turn is exactly 17.1 tiles, which is not true. It also doesn’t tell you anything about the shape.
I might try to get it from the internals. It’s pain, though.
Re: What is the exact shape of a curved rail?
If one take as base shape a circle of diameter 20 tile cut along diagonal axis to insert a 4 diagonal rails you get : (20*pi)+4sqrt(2) = 68.4887073213, too big but look like what we have in game in terms of pieces to make a circle.
I suppose there is some plays on the thickness or centering (see last pictures) because when measuring ingame, if you take a coal train at task him to run full speed for 5700 ticks, it's doing a little more than 100 laps, but 5699 is a little less than 100 laps, it's definitely not a round number so 68.4 is too big too.
Doing more laps to know more precisely the digits is quite annoying testing method and it seem unnecessary given than the exact lengh were given by boskid
viewtopic.php?p=500666#p500666
viewtopic.php?p=592880#p592880
I suppose there is some plays on the thickness or centering (see last pictures) because when measuring ingame, if you take a coal train at task him to run full speed for 5700 ticks, it's doing a little more than 100 laps, but 5699 is a little less than 100 laps, it's definitely not a round number so 68.4 is too big too.
Doing more laps to know more precisely the digits is quite annoying testing method and it seem unnecessary given than the exact lengh were given by boskid
viewtopic.php?p=500666#p500666
Yep, as if there are some particular adjustments / programming tricks to makes things works like removing 1/256 or rounding to the 1/256 to match the position system, it may not be accessible for players to see, but boskid gave us the new values for curves :
viewtopic.php?p=592880#p592880
AFAIK numbers about "20" and "quarter circle" were told by JG which may give you some rough estimates from his playtesting experience. Exact mechanic for rail support distance is slightly more numbers involved but relatively simple:
- elevated-straight-rail has a length of 2 (equals to 2.00 required support distance)
- elevated-half-diagonal-rail has a length of 4.472135955 (equals to 4.48 required support distance)
- elevated-curved-a-rail has a length of 5.132284556 (equals to 5.14 required support distance)
- elevated-curved-b-rail has a length of 5.077891568 (equals to 5.08 required support distance)
- rail-ramp provides support distance of 9. Since rail-ramp is a rail itself, this value is measured from the upper rail connection point. Visually you may see the rail support baked into rail ramp graphics, its center is 2 tiles away from the elevated connection point, so that means when counting support distance from visible baked in support center, it would be 11 tiles support distance (2 is immediately consumed by the rail ramp, only 9 distance is remaining)
- rail-support provides support distance of 11 measuring from the rail support center.
Re: What is the exact shape of a curved rail?
I do not know why any guesses are involved related to legacy rails, game is literally giving those values through the Lua API by means of LuaEntity::get_rail_segment_length. As for the lengths of all the unique shapes (including 2.0 shapes):
Re: What is the exact shape of a curved rail?
Thank you for clarifying the wrong information i found on reddit and posted there.
I think the initial interest from quale was to find the math that yield "7.842081225095013" instead of other close value that one can find using pi and sqrt(2) or other purely mathematical methods.
Re: What is the exact shape of a curved rail?
As for the shapes. 1.1.x straights are straights so there is nothing interesting here. 1.1.x curved rail has 3 parts: straight (of length 0.14405836993571697), turn (of length 7.3113238341979292) and diagonal (of length 0.38669902096136721). Position function for diagonal section is known to be not implemented so it kind of falls back to the turn profile beyond the limits of the turn angles resulting in a position error of around 0.02 at the diagonal end. Turn length is based on the computed radius of 9.3090666300655158. The way the radius is computed is some crazy math involving some gauge numer of (35/64 = 0.546875) with an origin not known for me, i just treat it as a constant.
2.0 curved rails and ramp exact position functions i will keep secret until 2.0 release.
2.0 curved rails and ramp exact position functions i will keep secret until 2.0 release.
Re: What is the exact shape of a curved rail?
Thank you, boskid! That is what I wanted to hear.
I did use get_rail_segment_length to find the length, but I used it more as a checksum to see if a shape could plausibly be the one used by Factorio, my bigger goal. Turns out the nature of the shape is tunable, not lending such credence. I was about to do some more hardcore reverse engineering. That wouldn’t have been so pleasant. All to calculate accurate areas outlined by rails.
I did use get_rail_segment_length to find the length, but I used it more as a checksum to see if a shape could plausibly be the one used by Factorio, my bigger goal. Turns out the nature of the shape is tunable, not lending such credence. I was about to do some more hardcore reverse engineering. That wouldn’t have been so pleasant. All to calculate accurate areas outlined by rails.
Re: What is the exact shape of a curved rail?
Well the value reported by the get_rail_segment_length when used on a single rail is giving just the rail length and most of the train joints code does not care about the position function of the rails so if i would make curved-rail to have a length of exactly 8 the joints on such rail would have to travel distance of 8 before reaching one of the rail ends and transitioning to another rail. The position function is still required for various drawing purposes to show where the rail joints are at the given point in time given a distance from one of the rail ends. Position function is also used when computing rolling stocks collision box since its position and orientation is defined by the joint positions so the joints have to be converted into map positions. Position function can be literally just anything and i could make it go straight, then wiggle side to side then do a barrel loop and then go straight again. Straight rails in 1.1.x consist of 1 linear segment. Curved rails in 1.1.x consist of 3 segments (linear, constant radius arc, linear) with one of them being not implemented without noone noticing this. In 2.0 the curved rails will be defined by a single continuous function where for curved-b-rail the constant velocity assumption is slightly violated to hit the grid point at the 45deg end while the ramp has shape that is defined by 3 segments as there is also a sloped part where the horizontal travel has to slow down slightly due to height change which i did in order to keep a relatively constant travel speed in a 3D space: this is why the ramp length is more than 16. Elevated rails are 1:1 based on their ground counterparts with the only difference they have connection points marked as elevated and they have height function returning a constant 3.
Re: What is the exact shape of a curved rail?
Haha, yeah. All depends on your purposes. You could probably make it horribly discontinuous and disassemble trains visually.
I’d personally try cubic splines. Even approximations of much longer arcs are virtually indistinguishable. They’re cheap to evaluate, flexible (to match control points, for instance) and amenable to linear transformation. Speed preservation does suffer more for S-curves, although a single-segment ramp can remain within about ±1%. Not that real trains are so unfazed by inclines. The harder part is analyzing or reversing it (to snap trains on placement or whatever) but the game doesn’t need to concern itself with that in a way that isn’t easy to evaluate numerically when it does come up.boskid wrote: ↑Sun Oct 15, 2023 8:35 pm In 2.0 the curved rails will be defined by a single continuous function where for curved-b-rail the constant velocity assumption is slightly violated to hit the grid point at the 45deg end while the ramp has shape that is defined by 3 segments as there is also a sloped part where the horizontal travel has to slow down slightly due to height change which i did in order to keep a relatively constant travel speed in a 3D space: this is why the ramp length is more than 16.
Re: What is the exact shape of a curved rail?
It already isn’t feasible to compute collisions in curves analytically, and Factorio doesn’t do that. Collisions are a post-hoc check. If you ram trains into each other at high speeds, you’ll find they don’t get as close as they do at low speeds. The train is stopped where it was a tick before the collision. You can then start moving again to snuggle up. Any position function can work, and any sensible position function will have sensible outcomes.
You can construct splines such that their parameterization is almost equal to distance. I actually did that for all curves, using a single cubic curve between the endpoints, preserving C^1 smoothness (both position and velocity are continuous within and between all curves and straights). You can do slightly better than this if you minimize extremes at the cost of the average.
Current curve: ±0.3%
Cardinal-adjacent curve: ±0.5%
Ordinal-adjacent curve: ±0.2%
Ramp S-curve: ±1.7%
The endpoints of the cardinal-adjacent curve form a Pythagorean triple. If you allow the endpoint direction to be 5:12 instead of 1:2, you can keep it within ±0.004%, showing how good these are at approximating actual circular arcs.
The ramp S-curve assumes a rise of 4.5 tiles which should be enough to compensate for Factorio’s weird perspective. Noticeably worse than the rest as a single segment, but I still doubt anyone would notice. Compare to the visual stretching induced by that same weird perspective, or the fact that a train maintains an exact length measured down a virtual line in the middle, disregarding more realistic bogie and coupling physics. But of course you can split the curve and do much better.
See my plots. f is the curve itself. g is the local speed multiplier. a and d are endpoints. b and c are directions toward the curve at those endpoints. l is the tunable presumed length of the curve. Adjust it to make g average 1. t is the parameter in [0, 1]. lt is the approximate distance along the curve.
Re: What is the exact shape of a curved rail?
No i can't ....quale wrote: ↑Mon Oct 16, 2023 11:18 am You can construct splines such that their parameterization is almost equal to distance. I actually did that for all curves, using a single cubic curve between the endpoints, preserving C^1 smoothness (both position and velocity are continuous within and between all curves and straights). You can do slightly better than this if you minimize extremes at the cost of the average.
1 hour later
Ha yes it's all clear now, i learned a lot and understand the words, but i still couldn't do it if i tried not with more explanations
I'm beginning to think it was more of a rethorical "you can" akin to "it is mathematically possible".quale wrote: ↑Mon Oct 16, 2023 11:18 am The endpoints of the cardinal-adjacent curve form a Pythagorean triple. If you allow the endpoint direction to be 5:12 instead of 1:2, you can keep it within ±0.004%, showing how good these are at approximating actual circular arcs.
See my plots. f is the curve itself. g is the local speed multiplier. a and d are endpoints. b and c are directions toward the curve at those endpoints. l is the tunable presumed length of the curve. Adjust it to make g average 1. t is the parameter in [0, 1]. lt is the approximate distance along the curve.
I can see how the parameter l can be tweaked and the curve changes shape so that its lengh matches the change in l in direction and magnitude at the cost of more squareness for the 1/4 circle but still try to stay similar to in game curves rails shape. It looks cool but it is not how it's done in factorio AFAIK now
Maybe more information will be available after the expansion release, when things are no longer kept secret , that could explain the reasons of the technical choice, maybe it's part of the secret.
How did you come to know how to do that ? (not personnally more like is it some math used only for video-games ? )
wait what ? My years of playing roller-coaster tells me that vertical G's and horizontal G's are totally different, curve need to be smooth only on the horizontal plane, otherwisequale wrote: ↑Mon Oct 16, 2023 11:18 am The ramp S-curve assumes a rise of 4.5 tiles which should be enough to compensate for Factorio’s weird perspective. Noticeably worse than the rest as a single segment, but I still doubt anyone would notice. Compare to the visual stretching induced by that same weird perspective, or the fact that a train maintains an exact length measured down a virtual line in the middle, disregarding more realistic bogie and coupling physics. But of course you can split the curve and do much better.
Re: What is the exact shape of a curved rail?
Certainly not 1.1. Maybe 2.0. I was going from first principles anyway, designing new pieces that fit the control points but don’t have to match an existing curve exactly. I figured the speed constraint is more important than a near-perfect static arc given that it’s used to position trains. The difference is very minor for arcs of ≤45° anyway, and then the control points themselves impose imperfect arcs. The power of splines is that you can match anything that’s smooth very closely. Just use shorter segments for a drastic improvement, by all measures.mmmPI wrote: ↑Sat Oct 21, 2023 2:29 am I can see how the parameter l can be tweaked and the curve changes shape so that its lengh matches the change in l in direction and magnitude at the cost of more squareness for the 1/4 circle but still try to stay similar to in game curves rails shape. It looks cool but it is not how it's done in factorio AFAIK now
The same curiosity that led to this post made me learn about it. I don’t know how often this is used. It’s just math you can apply to anything. I know the SCS trucking games define roads using splines of a similar form. AI traffic is on rails, following the parameterization directly. Theoretical speed changes are dwarfed by the lateral offset. X-Plane started using fully general cubic Bézier curves to define roads in version 10. Its road traffic is all weird because world generation forwent a speed constraint. Thankfully, it’s only decor in a flight sim.
Factorio trains seem to take ramps effortlessly. All about playability. If you did take such considerations into account, don’t forget that the optimal curve depends on overall traversal speed and train length. Carriages can’t follow their own ballistic trajectory, being forced to travel at the same speed as the rest. A longer train needs a smaller top–bottom difference because any one carriage doesn’t change speed as much on the ramp itself. A faster train needs a smaller top–bottom difference because the speed change is again smaller. Imagine a vehicle nearly coming to a stop on top. The ideal curve would be gentle at the bottom and very sharp at the top. That would be a launch ramp to a faster vehicle. If you’re designing horizontal curves, superelevation likewise depends on speed. The uniform shape I went with is good at the limit of high speed and/or a long train, without being horrible in other cases. And again, train momenta don’t seem to be affected in Factorio, so that symmetry is actually optimal.mmmPI wrote: ↑Sat Oct 21, 2023 2:29 amwait what ? My years of playing roller-coaster tells me that vertical G's and horizontal G's are totally different, curve need to be smooth only on the horizontal plane, otherwisequale wrote: ↑Mon Oct 16, 2023 11:18 am The ramp S-curve assumes a rise of 4.5 tiles which should be enough to compensate for Factorio’s weird perspective. Noticeably worse than the rest as a single segment, but I still doubt anyone would notice. Compare to the visual stretching induced by that same weird perspective, or the fact that a train maintains an exact length measured down a virtual line in the middle, disregarding more realistic bogie and coupling physics. But of course you can split the curve and do much better.the passengerscargo gets smashed outward due to centrifugal forces. Whereas for the ramp S curve, trains using their max power will inevitably be slower when going uphill so the bottom part of the ramp need to be smoother than the upper part ! But that's not very scientific way of drawing curves.
Re: What is the exact shape of a curved rail?
You sound like you have a better understanding of splines than me who only ever heard of them as a math tool like a hammer and chisel before. Then, your plot and formulas felt like seeing a whole piece of functionnal furniture and then watching the video felt like seeing all the different way to stick pieces of wood together. That doesn't make me a carpenter i'm still unable to piece that recently acquired knowledge together in a functionnal way but that definitly sparked my curiosity and i realized now i've been using splines without knowing i was using splines when doing curvy path with moving control point in image editing software. I feel they are everywhere now that i can recognize some in games i seen them heavily used in City Skyline where you can make "freeform" road, and there are tiling appearing on each side, pictures or videos from the game are mostly showing players draw those.quale wrote: ↑Tue Oct 24, 2023 5:43 pm Certainly not 1.1. Maybe 2.0. I was going from first principles anyway, designing new pieces that fit the control points but don’t have to match an existing curve exactly. I figured the speed constraint is more important than a near-perfect static arc given that it’s used to position trains. The difference is very minor for arcs of ≤45° anyway, and then the control points themselves impose imperfect arcs. The power of splines is that you can match anything that’s smooth very closely. Just use shorter segments for a drastic improvement, by all measures.
The same curiosity that led to this post made me learn about it. I don’t know how often this is used. It’s just math you can apply to anything. I know the SCS trucking games define roads using splines of a similar form. AI traffic is on rails, following the parameterization directly. Theoretical speed changes are dwarfed by the lateral offset. X-Plane started using fully general cubic Bézier curves to define roads in version 10. Its road traffic is all weird because world generation forwent a speed constraint. Thankfully, it’s only decor in a flight sim.
Factorio trains seem to take ramps effortlessly. All about playability. If you did take such considerations into account, don’t forget that the optimal curve depends on overall traversal speed and train length. Carriages can’t follow their own ballistic trajectory, being forced to travel at the same speed as the rest. A longer train needs a smaller top–bottom difference because any one carriage doesn’t change speed as much on the ramp itself. A faster train needs a smaller top–bottom difference because the speed change is again smaller. Imagine a vehicle nearly coming to a stop on top. The ideal curve would be gentle at the bottom and very sharp at the top. That would be a launch ramp to a faster vehicle. If you’re designing horizontal curves, superelevation likewise depends on speed. The uniform shape I went with is good at the limit of high speed and/or a long train, without being horrible in other cases. And again, train momenta don’t seem to be affected in Factorio, so that symmetry is actually optimal.
In Planet Coaster too for so many things. Both those games have some heavy mods which allow you to position trees (+ infinite amount of modded things) along those "freeform" road with different spacing and offset and really those are all kind of ) splines functions like in image editing software, you place ingame your control point and tweak the weight and "validate" to place like 150 trees 1.35m apart from each other
In roller coaster game, more than 2D road, one can look at the forces felt by guest in trains, such as negative vertical G's, also called "airtime", very appreciated by rollercoaster enthusiast that knows the last rows/carriages of the train are those where you feel them the most, since the train is going already fast when those finally approach the drop that made the train go faster. With an orthogonal shift of axis, that would be a locomotive accelerating after a 90° curve while the wagons are still in the curve, and the last wagon of the long train be slammed outward much more strongly than the loco that passed the curve going slowly. Vertically that makes people's ass fly off their seat which is fun or would ruin a freight train infrastructure as you explain, the downward-to-horizontal curve having the potential for positive vertical G's, where people get the feeling of weighting a ton, being slammed into their siege stronger when the train goes fast/when the curve is changing angle fast. This is simulated on openRCT2, which is also an isometric tiled based game. This is a very significant part of the gameplay, re-shaping part of the deisgn to change how forces are felt given speed.
I know there exist some "serious" roller coaster simulation out there not marketed as game, if at all it'd be like architect software-lite compared to the sims , where physics is the focus, i can't tell if they use splines or if at some points physics and material resistance and train lengh and weight and all the other considerations you are mentionning are forcing the use of other formulas to account for the real world physic in drawing the curves. I share what i understand from your explanation about why you went with those shapes (symetry, uniform curvature as much as possible). Trains in factorio i can see as less involved than rollercoaster trains (3D /momentum), but in both cases the math for positions speed and lengh feel like they have the potential to yield a problem like squaring the circle when it's expected to have a definite lengh and store it in computer memory precisely enough for user not to notice after building contraption that rely on its use over long period of time with calculations that need to be done in real time and precisely emphasizing the need for a good tool like splines seems to be. That's making me curious about that position function i feel it's part of the knowledge required to build intricate/precise train design such as signal-less , the shape is interesting in itself too, their relation seem difficult to explain in an accessible way though.
Re: What is the exact shape of a curved rail?
Funny you should mention RCT. That isn’t actually super realistic itself, which isn’t to say you don’t go through the same kind of design process. Accelerations are proportional to speed in the game, as opposed to speed squared. I suppose that makes the game more tolerant of extremes, which can be helpful even if your designs are exquisite, given the small assortment of fixed track pieces. I don’t know if that was deliberate or just a lucky outcome. It also doesn’t even apply gravity consistently; there are some arrangements (I think involving a half corkscrew and a half loop) that add net energy to the train. I learned about the latter part through Marcel Vos.mmmPI wrote: ↑Wed Oct 25, 2023 9:46 am Vertically that makes people's ass fly off their seat which is fun or would ruin a freight train infrastructure as you explain, the downward-to-horizontal curve having the potential for positive vertical G's, where people get the feeling of weighting a ton, being slammed into their siege stronger when the train goes fast/when the curve is changing angle fast. This is simulated on openRCT2, which is also an isometric tiled based game. This is a very significant part of the gameplay, re-shaping part of the deisgn to change how forces are felt given speed.
There is no closed form for length. What matters for Factorio, though, is that you can set a length and it will behave as such. That length is defining. The position function is basically just flair. It will work fine as long as that function isn’t gravely off, such as by causing adjacent carriages to collide. Signal-less operation is likewise defined by those lengths that have been set. Long-term integration error is tiny in binary64 and affects different trains similarly. The visual requirements are much more stringent than that, yet are also easily met.mmmPI wrote: ↑Wed Oct 25, 2023 9:46 am I know there exist some "serious" roller coaster simulation out there not marketed as game, if at all it'd be like architect software-lite compared to the sims , where physics is the focus, i can't tell if they use splines or if at some points physics and material resistance and train lengh and weight and all the other considerations you are mentionning are forcing the use of other formulas to account for the real world physic in drawing the curves. [Quote cut to save space. You can read it right above.]
Years ago I toyed a little with No Limits. I think it also used splines. I’d think that it would be much more stringent for that type of simulation, and it can afford to be. You can always subdivide a spline to get a more accurate length estimation or whatever you need. The smoothness can only be an asset to higher-order physics. The simulation doesn’t have to run hundreds of trains alongside a gigantic factory. If there are more steps to making it work the way it needs to, it can just take them, not to mention that there will be such steps regardless of the track’s representation at the level where I expect it to be.
Re: What is the exact shape of a curved rail?
Ironically, one of the places you won't find splines is real-world roads and railways (I know nothing about rollercoasters). Real road and rail curves are circular arcs with (approximately) Euler spiral transitions.
Re: What is the exact shape of a curved rail?
I see you are a connoisseur of the fine arts x) I'm tempted to think that a game from 1999 or so decided against using the square of acceleration deliberatly for perfomance reasons. I know factorio also does take some liberty with physics for air_resistance that doesn't apply to braking trains. I had heard of that corkscrew magic too, but to my memory it was a trick relying on the fact that you could make a loop with pieces whose lengh didn't added up, something like you were going more "down" than "up" as an Escher painting. I've heard of the calculator Marcel Vos made in RCT2 and was able to find the video but it's unclear if that is gravity of lengh or position function that is 'problematic'.
(https://www.youtube.com/watch?v=EbjqWThzXME)
I did that one quite some time ago without knowing if it would work for long time :quale wrote: ↑Wed Oct 25, 2023 2:11 pm There is no closed form for length. What matters for Factorio, though, is that you can set a length and it will behave as such. That length is defining. The position function is basically just flair. It will work fine as long as that function isn’t gravely off, such as by causing adjacent carriages to collide. Signal-less operation is likewise defined by those lengths that have been set. Long-term integration error is tiny in binary64 and affects different trains similarly. The visual requirements are much more stringent than that, yet are also easily met.
It relies on what you describe, the integration error affecting trains similarly i suppose. But knowing the exact time a train need to do 1 lap is knowing the period of the GIF or is knowing the frequency at which you can try to send a train through the existing rotating trains. Since the exact lengh of trains squircle in factorio are not transcendental, it is possible to find such period exactly in a finite amount of time ! It is yielding a squaring the circle problem equivalent
Synchronization in previous gif was done using combinators to turn all station on at the same time, but when building larger thing accross the map and several days i usually use a solar pannel to power a combinator at the exact same tick modulo 1 day. Mathing things out precisely could offer another tool to build those. The exact length are indeed enough, the position function is more curiosity
I've heard of No Limits but i think it looked like this FVD++ (Force Vector Design) thing : https://www.youtube.com/watch?v=o_cOiYa-0qM Where you can draw pieces of track from math functions as they say in first minutes of the video. Those track can then be imported in No Limits.quale wrote: ↑Wed Oct 25, 2023 2:11 pm Years ago I toyed a little with No Limits. I think it also used splines. I’d think that it would be much more stringent for that type of simulation, and it can afford to be. You can always subdivide a spline to get a more accurate length estimation or whatever you need. The smoothness can only be an asset to higher-order physics. The simulation doesn’t have to run hundreds of trains alongside a gigantic factory. If there are more steps to making it work the way it needs to, it can just take them, not to mention that there will be such steps regardless of the track’s representation at the level where I expect it to be.
No Limits seem to indeed use splines a lot, but FVD i think ( it was long time ) allows to make different curves that may be more suited to the physics of real life (coaster) trains.
Well nobody's perfect , rollercoasters i found are the main video game analog for adding the effect of gravity to trains in a fun way They make up for fun curves like the Brachistochrone !
That's funny you mention Euler spiral transition, i've heard of them under the name clothoid, i didn't realize it was those used for real life railroad. But are you sure they are not splines ?
I found some article with :
https://www.ams.org/journals/mcom/1992- ... 4736-8.pdfAbstract. Highway and railway designers use clothoid splines (planar G1
curves consisting of straight line segments, circular arcs, and clothoid segments)
as center lines in route location. This paper considers the problem of finding a
clothoid spline transition spiral which joins two given points and matches given
curvatures and unit tangents at the two points. Conditions are given for the ex-
istence and uniqueness of the clothoid spline transition spirals, and algorithms
for finding them are outlined
But i can't understand the math, that doesn't seem a topic that has been vulgarized a lot.
There are many many kind of splines, the cubic or bezier curves are just part of a larger group. I understood splines as a curve generation method and clothoid is a special curve where the angle changes in a linear fashion. I don't think they are both exclusive, but if i was to see the math that allow to create a spline to generate clothoids i wouldn't be able to recognize it maybe it's the math in the article i can't understand.
Maybe the way clothoid are approximated in real life is using spline that one can use in video games, that would be different i couldn't know maybe you are correct and those are not splines.
Thanks you for bringing this here, we still don't know what was refered to as "crazy math involving some gauge number of 35/64" by boskid, which is how the exact length of a curve rail was computed. So maybe the 1.1 curve rail length was computed using circular arcs with euler's spiral transition as a base for speed calculations.
The initial question is very difficult to answer with word, whereas a picture is much easier to take
Re: What is the exact shape of a curved rail?
They may perhaps be 'splines' in some generic sense of the term, but they are certainly not Bezier curves or anything closely related to them (e.g. Catmull-Rom), which is what is normally meant by the term in the context of computer graphics (and the way it has been used in this thread). The latter are polynomial curves (typically cubic), while the Euler/clothoid spiral involves transcendental functions (specifically, Fresnel integrals).