Page 1 of 11

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

Posted: 17 Jun 2009 10:28
by pekelnik
I suppose some discussion happened about this. How hard would it be to introduce it in-game? Is there any way how to do a hot-fix (such as using a invisible loco and then swapping it with the real one)?

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

Posted: 18 Jun 2009 01:07
by Eddi
this is a very hard project.

any kind of decoupling currently can only be done in a depot, this would have to be made more flexible (by either extending depots to something station-like, or allowing decoupling at stations. then, the collision detection must be fixed, so a shunting engine meeting up with a train does not crash.

also, a system of giving orders about shunting operations (which might be very complex) has to be introduced, and a graphical interface must be designed.

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

Posted: 18 Jun 2009 08:53
by pekelnik
So a lot of work needed, but not technically impossible due to some design constraints? I am going to check the documentation to see how hard it would be. I can possibly give this to a student as a project, as it might be nice and interesting to use openTTD as a shunting-yard simulation for instance.

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

Posted: 19 Jun 2009 21:00
by 555gln22
Nothing impossible I think, although it'll be a lot of work to change the way that the system works. You'd need to figure out a way of making sure there were enough carriages in the depot, or at least a way of handling it when there isn't, and then an extra custom order based on "go to depot", and then a new window to set the new consist, and then an efficient way of storing that info as an order.

The next bit, the actual shunting yard, would be a lot harder as there's nothing that OTTD does that's close to the behaviour you are looking for. It would be mighty cool though.

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

Posted: 20 Jun 2009 01:48
by SirXavius
I'm not sure if i'm understanding right what the request is (but i AM sure i'll be slapped down if i'm not! :D ), but if the issue is about trading cars in and out as you would in a depot, i thought about this workaround (still needs HC changes)....

In the depot window, each line of cars is numbered (up to, say, 255), so that when a train enters, it is placed into "Line x" (perhaps at the top as it is now). Cars can be built and moved to any of the numbered lines. When the user wishes to trade cars, there could be an order to "Send cars y - z to line x" or "Pickup all cars from line x". This seems to be the most straightforward way of directly manipulating what cars a train retrieves or decouples.

How involved would that be to accomplishing the goal? What possible problems could arise?

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

Posted: 20 Jun 2009 06:01
by Eddi
i do not think dealing with absolute numbers is the right approach for a generic and flexible order system.

i was more thinking in the lines of:
front engine: take [between <m> and] <n> [full|empty] wagons [of <cargo>] that go to <destination>
other engines, wagons: attach to a consist going to <destination>

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

Posted: 24 Jun 2009 12:56
by Leanden
I think some sort of shunting decoupling system would be immense, especially if wagons could sit independantly from locomotives. (But a new system would have to be integrated into the game to allow each carriage to have an individual ID so that they can sit independantly.

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

Posted: 24 Jun 2009 13:00
by Yexo
Leanden wrote:I think some sort of shunting decoupling system would be immense, especially if wagons could sit independantly from locomotives. (But a new system would have to be integrated into the game to allow each carriage to have an individual ID so that they can sit independantly.
Just for our information, every carriage has an unique ID.

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

Posted: 24 Jun 2009 13:05
by Leanden
A process by which a carriage can be identified by the user ingame using a GUI while the carriage is not attached to a locomotive.

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

Posted: 24 Jun 2009 15:56
by Expresso
A process by which a carriage can be identified by the user ingame using a GUI while the carriage is not attached to a locomotive.
Maybe an additional tab for the vehicle window; carriages waiting in depot... maybe accessed by double-clicking on the depot button? It could list parts of the train waiting in a depot and at which order number they will be switched/attached.

Currently vehicles disappear from the map when they enter a depot and a depot has its own built in signal for entry and exit. A depot can essentially contain infinite vehicles.

So, in order to get a depot which looks and works like a shunting yard, you'd effectively need to give the depot behavior like normal tracks and stop vehicles from disappearing from the map. That'll give you the shunting yard you'd want (at least in part). Vehicles bought and sold should appear in the shunting yard, as well as the depot window.

Maybe different signals could be used inside the depot to tell the trains where it is safe to stop and where not? Another useful tidbit of those signals could be to tell the game which tiles are the actual depot slots.

But... errr... such a change would require a complete rewrite of how depots work for trains... and this is lots of work.

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

Posted: 25 Jun 2009 03:53
by ashchetum
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.

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

Posted: 25 Jun 2009 15:02
by Leanden
I expect it would be an entirely optional function, as such an update would completely remake the game!

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

Posted: 25 Jun 2009 23:54
by ashchetum
A remake wouldn't be so bad would it? You could leave the orginal tracking system still there, just add the other feature and a "switch" in the options menu so you could have both in one game, and leave multilayer compatibility there.

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

Posted: 26 Jun 2009 00:03
by Benny
ashchetum wrote:A remake wouldn't be so bad would it
Yes it would. Especially if you don't REALLY wan the feature yourself, just ask Belugas.

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

Posted: 26 Jun 2009 01:12
by ashchetum
Hmm. I shouldn't of said "remake" I should of said "It wouldn't be bad to add a new function would it?". Excuse my ability to confuse.

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

Posted: 26 Jun 2009 07:31
by Benny
As Expresso wrote:

Expresso wrote:But... errr... such a change would require a complete rewrite of how depots work for trains... and this is lots of work.

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

Posted: 26 Jun 2009 08:58
by Leanden
would that really be such a bad thing, the depots are awfully designed!!! This way we could have multitile depots and depots in stations as well.

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

Posted: 26 Jun 2009 22:20
by sean16
I love this idea, although I recognise the work that will have to be put in to make it a reality.

I think that what will have to happen is that trains will have to be bought on special 'depot' tiles, in stations, or even just in stations. The train will then slide out of this tile like a depot (Maybe with an animation of cars being lifted onto the track via a crane), and into the platform/out of the station. Then as part of the orders system, the train should be able to drop a number of cars to be picked up. However, for this to work properly, there will have to be a way of picking the cars back up, without blocking the 'drop off'.

I can see this working by having the depot's in the station have a button to link the pick up with a waiting bay, so this will be automatically configured in the order.

Also, to prevent the train going in too early, there will have to be a wait for min cars and a max cars to pick up part of the order. This will prevent a train taking, say 20 cars, making the length ~10 tiles (depending on the cars) when the train can only run on a 5 tile line. This should be measured in tiles to keep it simple.

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

Posted: 26 Jun 2009 22:40
by Benny
Uh, well, EMUs and DMUs are very rarely decoupled. :|

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

Posted: 26 Jun 2009 22:46
by sean16
welll, yh. Um, sorry about that, but I picked the first cargo type that came to my head, just imagine that they are coal trucks...