Flag to allow rear facing locomotives to power trains
Flag to allow rear facing locomotives to power trains
How difficult would it be to make a flag to allow locomotives to provide power in reverse in automatic mode? Currently having a locomotive on the back facing forwards provides full power, but if the locomotive is facing backwards it provides none and has to be fully pulled around by the front locomotive (interestingly, you can also have the locomotive at the front facing backwards, and the locomotive at the back facing forwards and you end up with a train that will happily drive either direction in automatic, but only the pusher locomotive at the rear is operating). I would like make a mod that would allow the rear locomotive to provide power even if facing the wrong direction. A flag that allows the current reversing power to apply in automatic would be nice, but a separate modifier for automatic mode would be better as then it could apply full power in automatic while still being more controlled when the player is backing trains up.
It would also be nice if there was a property on trains that could be set true to allow a train to attempt to path backwards even if all locomotives are facing one direction so that single locomotive trains could be set to use terminus stations.
In summary (example names):
For prototype type of "locomotive":
reversing_power_modifier_automatic
If greater than 0, the locomotive will provide that percent of power when the train is traveling in the opposite direction to the direction the locomotive is facing while running in automatic mode..
For entity LuaTrain:
path_reverse
If false, and all locomotives on the train are facing the same direction, the train will only attempt to find an automatic path in the direction the locomotives are facing.
If true, and at least one locomotive has reversing_power_modifier_automatic > 0, attempt to find a path backwards as well as forwards to it's destination.
If the train has at least one locomotive facing each direction, then train pathfinding is done both ways as it currently does.
It would also be nice if there was a property on trains that could be set true to allow a train to attempt to path backwards even if all locomotives are facing one direction so that single locomotive trains could be set to use terminus stations.
In summary (example names):
For prototype type of "locomotive":
reversing_power_modifier_automatic
If greater than 0, the locomotive will provide that percent of power when the train is traveling in the opposite direction to the direction the locomotive is facing while running in automatic mode..
For entity LuaTrain:
path_reverse
If false, and all locomotives on the train are facing the same direction, the train will only attempt to find an automatic path in the direction the locomotives are facing.
If true, and at least one locomotive has reversing_power_modifier_automatic > 0, attempt to find a path backwards as well as forwards to it's destination.
If the train has at least one locomotive facing each direction, then train pathfinding is done both ways as it currently does.
Last edited by Zanthra on Sat Jun 23, 2018 2:17 am, edited 9 times in total.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Add flag to allow reversing_power_modifier in automatic mode
Hah, you stroke out that part before i could write an answer .
Concerning power providing in "reverse" mode...i just looked that up and it looks like in real world applications neither electrical nor mechanical locomotives suffer any significant penalty (except air friction) for going "backwards", so the whole mechanic of backwards-facing locomotives not providing power is an odd game design decision...?
Conclusion: Definetly +1 to allow backwards facing locos to provide power (they already do in manual i think).
Concerning power providing in "reverse" mode...i just looked that up and it looks like in real world applications neither electrical nor mechanical locomotives suffer any significant penalty (except air friction) for going "backwards", so the whole mechanic of backwards-facing locomotives not providing power is an odd game design decision...?
Conclusion: Definetly +1 to allow backwards facing locos to provide power (they already do in manual i think).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Add flag to allow reversing_power_modifier in automatic mode
In the entity definition for locomotive there is a property:eradicator wrote:Hah, you stroke out that part before i could write an answer .
Concerning power providing in "reverse" mode...i just looked that up and it looks like in real world applications neither electrical nor mechanical locomotives suffer any significant penalty (except air friction) for going "backwards", so the whole mechanic of backwards-facing locomotives not providing power is an odd game design decision...?
Conclusion: Definetly +1 to allow backwards facing locos to provide power (they already do in manual i think).
Code: Select all
reversing_power_modifier = 0.6,
As for why this was designed this way, now that I know trains are fine with the locomotive at the rear, it could cause a lot of problems for train networks if trains that had all locomotives facing one direction could calculate a path to the destination station in reverse. Then when it arrives, the last cargo wagon is where the locomotive should be, with an inserter dutifully loading it full of fuel while the locomotive is stripped bare and the coal is sent to the furnaces as ore; so it might have something to do with avoiding problems related to that.
It could also be an asthetics issue with trains driving in reverse not looking as cool, or if trains with Cargo Wagon, Locomotive, Cargo Wagon becomes a very efficient single locomotive train setup because the stations can work if it comes in forward or reverse, but would look a bit silly.
Or based on the fact that trains are generally not as stable in push configuration than pull (ignoring the fact that forward facing push locomotives work fine in factorio).
Or perhaps they thought there would be balance issues if 1-4-1 trains with terminus stations were as fast as 2-4 trains with roro stations.
Perhaps that was just the way it worked when someone wrote it into the code without much thought beyond getting trains to move around automatically, and it has worked so far.
Perhaps the reasons are long forgotten.
I would like it to be opened up to modders even if there are good reasons not to change it in the base game.
The second part of this request would be an option that can be set per train that if all the locomotives (perhaps just one) on the train are facing one direction, should it attempt to path in reverse to get to it's next stop. If this is left false, then it won't break train networks by entering stations in reverse when it would not now.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Add flag to allow reversing_power_modifier in automatic mode
I think i'll put my bet on this one .Zanthra wrote:Perhaps that was just the way it worked when someone wrote it into the code without much thought beyond getting trains to move around automatically, and it has worked so far.
You're right thought that it would be weird if all trains tried pathing in both directions (though with any signals around they couldn't most of the time). But form a pure power contribution standpoint it'd still be nice if a train with at least one loco in each direction had the same power in both directions. As you also noticed factorio doesn't really care about push/pull which would be the only realistic reason to limit power (due to tensile/compression properties of metal).
As a side node i've actually used CCLLCC two-way trains, though not much. Partially because of the looks and partially because it's not actually that great to have to deliver fuel to the middle and and unload from the ends.
Maybe an even nicer solution would be to have a "dual-headed" flag for modded loco prototypes that "simply" allows that prototype to act as both forward and backward loco at the same time. You'd lose the granularity of specifying how much % backwards power it can supply, but overall the effect would be similar. (Hm. Could this actually be "faked" by usind two modded half length, half weight locos? Inventory/Animation would break i guess. )
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Flag to allow rear facing locomotives to power trains
After the last Friday facts, I figured it would be okay to bump this. If this is a won’t implement, no problem, but I think it’s a reasonable addition.
Thanks
Thanks
Re: Flag to allow rear facing locomotives to power trains
Even steam locomotives where capable of running full power in reverse (though they hardly ever did it) if they had something akin to a cars gearbox: https://en.wikipedia.org/wiki/Walschaerts_valve_gear
I don't see how pathfinding in both directions is any hindrance against implementing locomotives running full power both ways.
If players don't want locomotives to change direction they can use signaling to prevent that.
I don't see how pathfinding in both directions is any hindrance against implementing locomotives running full power both ways.
If players don't want locomotives to change direction they can use signaling to prevent that.
My Mods: mods.factorio.com
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Flag to allow rear facing locomotives to power trains
I see no particular need to completely remove one-way locos. Just check if there's locos placed in both directions, or add a checkbox to the loco settings. This topic is imho only about power not about layout. Especially because factorio trains don't magically turn around when leaving a station (like in OTTD), so wagon order matters, and an unexpectedly reversed train can poison your whole main bus before you know it.Optera wrote:If players don't want locomotives to change direction they can use signaling to prevent that.
Re: Flag to allow rear facing locomotives to power trains
Having to change every existing locomotive to bi-directional one by one on a map with over 300 locomotives would be annoying.
A game setting to enable bi-directional power and pathfinding for all locomotives would be the best solution.
Alternativly if it's only a checkbox per locomotive it should be exposed to the api. A mod switching all locomotives is whipped together instantly.
A game setting to enable bi-directional power and pathfinding for all locomotives would be the best solution.
Alternativly if it's only a checkbox per locomotive it should be exposed to the api. A mod switching all locomotives is whipped together instantly.
My Mods: mods.factorio.com
Re: Flag to allow rear facing locomotives to power trains
I think there shouldn't be any problem. Make it that way you still need a forward facing locomotive, but any reverse facing also contribute power. The way I would program trains, they would be a construct with a mass and forward and backward power, contributed by the locomotives paced ether way. Then you would just have to change that calculation and have the reversing locomotives also consume flue and so on.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Flag to allow rear facing locomotives to power trains
mods can actually specify how much reverse power a locomotive has, and for the base game locomotive, I believe this is 50%. So even if you only account for this one, the rear facing locomotive of a double headed train should contribute 50% power to assist the train.
With my mod, the MK3 locomotive provides 90% power (I think) which means there's no signignificant difference to having a double headded train, or a train with 2 lead locos, but the game itself doesn't utilise the rear facing locomotives.
With my mod, the MK3 locomotive provides 90% power (I think) which means there's no signignificant difference to having a double headded train, or a train with 2 lead locos, but the game itself doesn't utilise the rear facing locomotives.
Re: Flag to allow rear facing locomotives to power trains
Sadly reversing_power_modifier is only effective in player driven trains and has no effect on automatic trains whatsoever.
My Mods: mods.factorio.com
Re: Flag to allow rear facing locomotives to power trains
It would be cool if it actually worked in automatic. Then setting it to 1 would make locos a bit more like normal locos which don't care about directionality most of the time.Optera wrote:Sadly reversing_power_modifier is only effective in player driven trains and has no effect on automatic trains whatsoever.
Re: Flag to allow rear facing locomotives to power trains
It's only effective in player driven trains that have no locomotives facing the other direction. If you build a train with 5 forward facing locomotives, and drive it backwards, it's does decently well. If you make it 4 forward, and 1 backwards, and try driving it in reverse manually, suddenly the single backwards locomotive has to haul the other 4 around with no help.Optera wrote:Sadly reversing_power_modifier is only effective in player driven trains and has no effect on automatic trains whatsoever.
I have since posting this started feeling that this thread may be better suited to the balance forums, as it touches on a lot of questions of whether it should be this way or another in the base game, although I would still like to see it available to moders even if nothing is changed in the base game balance.
Re: Flag to allow rear facing locomotives to power trains
Bumping because the point is still valid.
Re: Flag to allow rear facing locomotives to power trains
While it certainly would be nice if it worked in vanilla, there already is a mod for it.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!