A bunch of train-related requests

Things that we aren't going to implement
Post Reply
echo62
Manual Inserter
Manual Inserter
Posts: 1
Joined: Wed May 20, 2020 10:56 pm
Contact:

A bunch of train-related requests

Post by echo62 »

Hello!

I'm working on a mod to make trains more realistic and hopefully more fun for players like me. There are several things that - if implemented in the API - would make some of my ideas possible or less hacky. So I'll make a number of different requests in this post, and I'll give context for them. I don't expect all or even many of them to be feasible, but maybe you'll say "X and Y are non-trivial, but we can implement Z which is trivial and can achieve the same goal".

Let me know if I should instead make individual posts for each request or group of requests. I'm new here and didn't want to spam.

My goals are to make trains in automatic mode slow down at tight curves, to add curved rails with longer curve radius (I have a super hacky idea for how to achieve this if I could control entity visibility), and to make train weight vary depending on cargo type.

1. Making trains slow down at curves. Currently my mod caps train.speed every tick when approaching a curve.
1.1. Could rail prototypes have moddable max_speed? I suspect no because performance.
1.2. Could scripts modify train.max_forward_speed and train.max_backward_speed on the fly, with the train braking (not just abruptly lowering speed) if the max speed is lowered?
1.3. If not, then I guess my mod will keep setting train.max_speed. But it would be great not to have to calculate realistic deceleration. Could trains get some way to apply the brake? One way to achieve this right now is to switch to manual mode, then switch back to automatic, but this recalculates the train path, which I've heard is expensive, and I'm scared of messing with pathing.
1.4. If not, then could scripts add and remove temporary train stops (at places with no stations)? So that when I need to decelerate, I add a temporary stop ahead of the train, and once the train reaches the required speed, I remove the temporary stop and start updating train.speed to keep it at the max speed.

2. Adding curved rails with longer curve radius that have higher top speed
2.1. I have no idea if this is easy or hard, but any chance you could add native support for curved rails of various sizes? E.g. 2x, 5x, and 10x the size of the current curved rail. Only for mods, no need to add recipes in vanilla. If graphics are hard, you could just make an invisible rail type that lets trains run on it, and mods can supply graphics. Again, I have no idea if this is trivial or super hard.
2.2. Assuming the above can't be done, my plan is to add a visible intangible entity that looks like a bigger curve, and add invisible rails that the train actually travels on. But that means hiding the real train and showing an intangible entity (that looks like the train) teleporting over the visible curve. So could you make it possible for scripts to alter the visibility of entities at runtime? As far as I can tell, this is only possible for SimpleEntityWithForce and SimpleEntityWithOwner, but not for locomotives and wagons. (And I understand that what I'm describing is horrible and slow, but hopefully it won't be too slow for smaller bases, and can be switched off for bigger bases.)

3. Making train weight vary depending on cargo type.
3.1. Could scripts alter either wagon.weight or train.weight at runtime?
3.2. If not, then could scripts alter locomotive power, locomotive/wagon friction and locomotive air resistance at runtime? This would allow at least making the train slow and sluggish if it's loaded with e.g. steel. (Some of this is already possible by replacing the train's fuel with fake fuel with different properties, but that's hacky.)

Thanks!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13175
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: A bunch of train-related requests

Post by Rseding91 »

The basic answer to all of your requests:

No, base game has no use or desire for any of them and would only make all of the logic more complex and slower.

Sorry. What you're trying to do is completely outside of anything we want to support modding wise.
If you want to get ahold of me I'm almost always on Discord.

coppercoil
Filter Inserter
Filter Inserter
Posts: 470
Joined: Tue Jun 26, 2018 10:14 am
Contact:

Re: A bunch of train-related requests

Post by coppercoil »

Nevertheless, I like the idea about speed limit at low-radius curves and full speed at large radius. I have read an old topic about that. Maybe it's time to start thinking about Rails v2.0? I love railways :)

Post Reply

Return to “Won't implement”