Dynamic train composition? (Decoupling/Shunting/etc..)

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
User avatar
kyosuke1989
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 24 Mar 2008 13:04
Location: Finland

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by kyosuke1989 »

SirOzlington wrote:in my patch, the wagons turn around if necessary keeping the order

to clarify: the whole group of wagons turns, as if they had a locomotive in the front and were turning. so the a-b-c-d becomes d-c-b-a if the locomotive is approaching from the other side
How hard it would be to have wagons unreversed on that same situation?
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by SirOzlington »

shouldn't be a big problem, just got to reverse the order
Eddi
Tycoon
Tycoon
Posts: 8257
Joined: 17 Jan 2007 00:14

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by Eddi »

you probably run into all sorts of (newgrf) problems if you modify the consist outside a depot
User avatar
ColdIce
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 25 Apr 2006 10:22
Location: Bucharest

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by ColdIce »

amazing patch :bow: please open a new topic for this. this is the patch of the year
The rest is confetti!
User avatar
kyosuke1989
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 24 Mar 2008 13:04
Location: Finland

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by kyosuke1989 »

ColdIce wrote:amazing patch :bow: please open a new topic for this. this is the patch of the year
I think too that it would be nice :)
warman45
Engineer
Engineer
Posts: 34
Joined: 29 Sep 2008 11:17

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by warman45 »

i don't know if anyone's interested but i came up with an idea that could make this feature work. unfortunately like most ideas it requires a partial rewrite of train behavior (better than a full rewrite though)

there are trains and locos, they move between stations and terminals.

we will use the term Train-Unit or TU to describe the complete set of vehicles that move from a point to a destination. it may consist of a single locomotive and many independent trains.

a train is a series of cars carrying a common item and heading to a common location. in some ways they behave like a train does currently. they do not separate from each other and as such can be treated as a single long unit. (note it may be possible to add locomotives to a train. this locomotive acts to provide extra power, but loses the ability to path-find and make independent decisions. it is always relocated to either the front or the back of the train-unit when the train is connected to a locomotive. to prevent TUs with locomotives randomly placed in the center. ) the train may be issued orders to pick up goods at a station, and drop off goods at a station. the "wait for full load" and "unload all" commands may be issued to a train, and supersede the locomotives orders (the locomotive will stop till the train completes the command")

locomotives are independent vehicles that supply power to a train. the locomotive makes pathing decisions, acts independently, and may separate from trains. the locomotive may travel without a train, may carry empty trains, and may carry full trains. locomotives are issued go to orders. the locomotive may also be ordered to pick up a train at a location if one is available. the train will carry a number identifying it with respect to the locomotive. this number is only for the locomotive. IE a locomotive ordered to pick up a train at terminal A will assign that train number 1 regardless of the trains actual identity. in this manner further orders may be given to the effect of deposit train 1 at terminal B.

a station is a location where goods may be loaded onto a train, or deposited from a train. train cars may not be left at a station. stations can be made so that a train passes through both ends.

a terminal allows trains to be stored. a terminal may only be approached from a single direction. trains sitting in a station may load and deposit cargo. a locomotive may deposit a train at a terminal, and another locomotive may pick up the train.
warman45
Engineer
Engineer
Posts: 34
Joined: 29 Sep 2008 11:17

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by warman45 »

please forgive the double-post. it is necessary to separate the two ideas i had.

there is another way to achieve this goal. instead of having pre-built trains, you can treat trains like cargo.

in this system locomotives are separate entities. locomotives act like cars except instead of picking up resources they pick up cars. these cars are either full or empty cars. a locomotive ordered to pick up empty cars will not pick up cars that contain any material. locomotives order to pick up full cars may pick up cars that are not full but contain material unless the wait for full load order is issued. a locomotive ordered to drop off full cars of a type and then immediately pick up empty cars of the same type from the same station will not decouple and will instead wait for the existing cars to be emptied. locomotives may be ordered to only pick up empty cars of a certain length (pick up empty oil car of length 6 for example). locomotives order to a station with multiple sidings will search for it's good in a siding. proceed to that siding and load the cars. the locomotive may have a restriction that it cannot move until the cars are completely full, and so may be forced to wait for the cars to fill.

cars may either be empty or "full" though full does not necessarily mean that they are at capacity, merely that they contain resources. cars act like a commodity to locomotives, but may themselves contain commodities. when a locomotive drops off cars in accordance with a unload cars of type x order, the cars will automatically load if possible. if not possible the cars will wait. when a locomotive drops off full cars the cars will attempt to empty themselves. if ordered to transfer cars the cars will neither try to empty or fill themselves.

industries process their manufactured goods and empty cars to produce full cars, however the cars will not move from their location nor will they disconnect from the group of cars with which they are linked.

here's an example: a locomotive will deposit 6 empty tanker cars to the oil well industry. the locomotive may then move on to it's next objective. the oil industry accepts the empty cars, which are considered an industry input. the cars remain on the station where they were deposited. the industry will slowly add material to the cars. "processing" cars and material into full cars. another train (or even the same train) may be given the order to head to the station and pick up full cars of oil. the train will move to the station, and head towards the location containing full cars. the train will wait for the cars to be full, then proceed towards the oil refinery. the train will then drop off the full oil cars. the oil refinery will process the full oil cars into empty oil cars. the locomotive however has orders to proceed with a full load of empty tanker cars and so waits for the process of emptying to be finished. the locomotive then proceeds to move the cars to the next ordered destination.

i believe this system is simpler than the previously mentioned one. some things to note: multiple units can be created by linking locomotives. it may even be possible to create locomotives that behave like cars. this system would require a partial rewrite at least. the hardest thing to achieve is likely treating cars as both a commodity and an entity at the same time, having them occupy a set location, interfere with pathing, and move all while being loaded onto another entity like cargo.
User avatar
eastpath
Engineer
Engineer
Posts: 19
Joined: 01 Aug 2011 18:04
Location: Chester, UK

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by eastpath »

I've been thinking about similar in terms of dragging electric trains on non-electrified lines e.g. the former Pendolino drags on the North Wales Coast where the loco was attached at Crewe.

I think it would be a good addition.
Living proof that you're never too old to play!
metralha761
Engineer
Engineer
Posts: 1
Joined: 27 Feb 2013 15:10

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by metralha761 »

Hello there!

Like they said, it will be a great patch and give much more dynamic to the game.

I'm here to give a tip, is to hard to give an ID to a group of alone cars (cars without a engine)? Because with this we don't need away points or something, just need the ID and check the state, if true go to them else pass to other.

I think with this its possible to have more than 1 train engine to do the job.

Oh and with this, the group need something like a flag to put them occupied/busy for other trains engine don't pick them.
User avatar
doxlulzem
Traffic Manager
Traffic Manager
Posts: 161
Joined: 05 Mar 2014 21:44
Skype: carl.stonehouse1
Location: Teesside, North Yorkshire

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by doxlulzem »

I think this would be cool, and here's an idea

Train one:
go to station X
go to marshalling yard X
request decouple X X cars
request couple X Y type cars
go to station Y

Train 2:
go to marshalling yard X
couple with X X cars
decouple X X cars from train 1
decouple X X cars
couple with X Y cars
couple cars to train 1
decouple X Y cars
go to marshalling yard X
IJN Takao is life. Why did the Shinano get converted? Gotta love NeuroTec for Garry's Mod. I even have a server!
How Can Mirrors Be Real If Our Eyes Aren't Real? - Jaden Smith 2014
kutagh
Engineer
Engineer
Posts: 17
Joined: 30 Aug 2013 09:01

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by kutagh »

Perhaps we should start from scratch and actually start documenting what this system should be able to do, rather than going "I want to be able to couple/decouple trains!". By dividing this up into significant smaller issues, we will be better aware of what is specifically required in order to achieve our goal (not just that we can actually couple or decouple, but to actually implement it into OpenTTD in a manner that it adds to the gameplay). This allows more developers that are interested into this but discouraged by the sheer amount of work required to start working together using a documentation that allows them to divide the work into separate interacting systems.

To start, I have written this documentation for the mechanics of (de)coupling, which is a required component for shunting.
The documentation is on ideone since it is quite big: http://ideone.com/0zWOwt
I'm sure some of you will say that I forgot some aspects (properly being able to reverse trains instead of just flipping them) but keep in mind that this documentation is about the bare minimum for (de)coupling to be useful in the game and that it does not include the requirements for shunting, which is a different usage (that builds on (de)coupling). If you think I have missed something for (de)coupling specifically, feel free to say so. There still needs to be documentation for the UI etc. which I hope you will help on documenting it.
User avatar
furo-nyan
Engineer
Engineer
Posts: 9
Joined: 06 Feb 2014 05:39
Location: Berlin, DE

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by furo-nyan »

kutagh wrote:To start, I have written this documentation for the mechanics of (de)coupling, which is a required component for shunting.
The documentation is on ideone since it is quite big: http://ideone.com/0zWOwt
I thought about this topic a few times earlier and wondered how you can handle splitting trains and to reunite them.
I don't know if some of you can read German. On Wikipedia there is a good description of how it's done in real life but the English Wikipedia is not that detailed in this case:
http://de.wikipedia.org/wiki/Fl%C3%BCgelung

To sum it up for English speakers:
You normally use trains with cabs at both ends being able to couple automatically. In OpenTTD this would apply to the train types having an engine at both ends. One train waits at the station for the other train to unite. Until decoupling they run as one. When splitting the train there would be the possibility first the front train leaves and if the track is empty the second train leaves or the second train runs in the other direction at the same time as the first train.
Actually in real life it's also normally not allowed to send two trains on the same track. There is a special kind of signal (at the middle of the platform) allowing the train to enter the same track, to stop and then to couple. I will explain later how I suggest this in OpenTTD. After splitting trains the first part can leave as normal, the other one waits, just like when waiting in front of path signal (or leaves in the other direction)

My idea is a bit different from kutaghs. OpenTTD already has groups we could use. We create 2 different groups which represent our 2 lines. At the station where the trains are supposed to unite we tell the train to wait at the beginning of the platform (or the end if it's a train that just help out on a crowded line as "double size" or so), then wait for a train of the other group. When a train of the other group comes to the station it should check if there is already a train waiting for a "coupling partner". If so, they should unite and run with shared orders until we tell them to decouple. If there is no "coupling partner" waiting the train should wait at the beginning (or end) of the platform as mentioned earlier. I would also add that you should be able to enter a maximum waiting time, if no partner arrives to leave the station alone. This is for the case if there was a traffic jam on one branch the partners don't arrive and the trains waiting at the platform may cause another traffic jam with blocking the tracks.

How do you see this?
You can allow trains to ignore signals manuall,y so this feature already exists. If you see the partner train of the other group you should stop at the other end of the platform and then unite to shared orders until decoupling.
When creating timetables you can say "unite with Train of group xyz" and "split train from other groups"

I am looking forward to your answers and ideas

Summary:
Creating Timetables:
go to station <x>, wait for train of group <y> [optional: for 30 days], wait at end of the station (or if train should increase capacity on a certain part of the route wait at the beginning)
when entering the station check if train of group <y> is already waiting, if yes stop at the beginning of the platform (if the other group increases capacity without own branch stop at the beginning of the platform)
When splitting trains and both go same direction the following train should wait for the platform to be empty and then continue journey as usual

Feature: Share orders with another group (if united)
User avatar
Awesometrains
Traffic Manager
Traffic Manager
Posts: 129
Joined: 22 Nov 2015 17:07

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by Awesometrains »

ashchetum wrote:One way to go about this (in my opinion) is to make a list of stock, then give orders to engines to "pick up car 'x' and then pick up car 'y' and take them to 'z' ". I have the feling that would take a lot of re-codeing (which i couldn't do because I code in python and have no idea what openttd is writen in) that would cause some problems in the overall program. That would also cause problems for avid ottd gamers who are used to the traditional way.
ah yes , that's better than this depot stuff
Qa'pla!
Jim_the_Chair
Engineer
Engineer
Posts: 3
Joined: 02 Apr 2016 13:46

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by Jim_the_Chair »

One way to think of the coupling and uncoupling would be how it is done in Train Simulator. It would say something along the lines of 'couple to wagons x,y,z...'. I don't know how hard this would be (probably very) but for this to work, a feature could be added where you tell the train to enter station, a box is added slowing you to uncouple from the wagons, do something else, then re-couple to the wagons, with the order specifying the wagons to couple to.
User avatar
ashchetum
Engineer
Engineer
Posts: 108
Joined: 09 Mar 2008 20:35
Location: Smack dab in the middle of USA

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by ashchetum »

Awesometrains wrote:
ashchetum wrote:One way to go about this (in my opinion) is to make a list of stock, then give orders to engines to "pick up car 'x' and then pick up car 'y' and take them to 'z' ". I have the feling that would take a lot of re-codeing (which i couldn't do because I code in python and have no idea what openttd is writen in) that would cause some problems in the overall program. That would also cause problems for avid ottd gamers who are used to the traditional way.
ah yes , that's better than this depot stuff
I've not been on this forum in years, jees you dug that one up lol. I maintain though it would be epic to be able to drop off and pick up cars. Unfortunately that will probably never happen. The game engine is too primitave, it will be ineteresting to see what happens in the future with ottd and its competitors. I feel like the simutrains team or someone could create something even deeper in the future.
Image
Image
Image
Image
Image
Props to the devs of OpenTTD, you guys make magic!
User avatar
Awesometrains
Traffic Manager
Traffic Manager
Posts: 129
Joined: 22 Nov 2015 17:07

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by Awesometrains »

Jim_the_Chair wrote:One way to think of the coupling and uncoupling would be how it is done in Train Simulator. It would say something along the lines of 'couple to wagons x,y,z...'. I don't know how hard this would be (probably very) but for this to work, a feature could be added where you tell the train to enter station, a box is added slowing you to uncouple from the wagons, do something else, then re-couple to the wagons, with the order specifying the wagons to couple to.
This is exactly what I was thinking of when making a thread about it!!!
Qa'pla!
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by JacobD88 »

ashchetum wrote: I maintain though it would be epic to be able to drop off and pick up cars. Unfortunately that will probably never happen. The game engine is too primitave, it will be ineteresting to see what happens in the future with ottd and its competitors...
Presumably you've never seen the work of SirOzlington?
They had some video of such a thing in game.
https://youtu.be/d9d7wfgMTMg

Does anyone know what became of SirOzlington or their patch? Can the code be obtained for others to look at?
User avatar
kamnet
Moderator
Moderator
Posts: 8548
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by kamnet »

No code was ever posted. He left the community a short time after posting the videos.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by JacobD88 »

kamnet wrote:No code was ever posted. He left the community a short time after posting the videos.
Well at least we can say it's possible; the problem is most things are possible - it's just the cost in time/effort/money. As i have learnt with my own efforts patching.
Ah well, maybe in time someone will decipher the information from the video and make an effort themselves on implementation; we can but hope :) A lot has changed since the days of TTDP/OTTD and the "Impossible features" list...
matthewmwps
Engineer
Engineer
Posts: 2
Joined: 05 Oct 2016 06:16

Re: Dynamic train composition? (Decoupling/Shunting/etc..)

Post by matthewmwps »

I know that this idea is now probably dead, but I cant stop thinking about this so i want to add my own two cents into the idea.
I don’t fully understand the coding language used in open ttd, however that doesn’t stop me from brainstorming an idea of how this idea could become a reality
If a freight car was changed into a locomotive with 0 horse power, then it would be able to load and unload itself independently without a locomotive, while still requiring one to be able to move itself from point a to b.
From there, the only real thing left to work out if the coupling and uncoupling of these cars and having that being identified by the game and reacted too accordingly.
I do also recall, that each carriage is given its own unique value. If this is true than it could be used in the coupling system by having orders that are able to identify that value and use it to disconnect or separate any cars in front/behind of that carriage value, and create a new train with said carriages value.
Again, I do not know the specifics in terms of how the programing within this software functions, I just couldn’t stop thinking about how awesome this could be if implemented. Hopefully this help someone who knows what they are doing with coding this game create this.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 8 guests