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
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)