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

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
ciniNPC
Engineer
Engineer
Posts: 1
Joined: 21 Oct 2016 15:01

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

Post by ciniNPC »

if anything it could be easily done but people have yet to taken the proper amount of time to create this. if one person can do it with some simple codes why couldn't the people who work for the game do it. They technically have all the material to do so plus half of the things needed to do it are in game. yes i may not be at the level of smartness when it comes to coding but its just simple logic. Hopefully our sugesstions will be taken into consideration even though this topic has gone to complete nothing
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

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

Post by supermop »

ciniNPC wrote: if one person can do it with some simple codes why couldn't the people who work for the game do it.
I am sure they could, the only problem is that there are no people who are employed by OpenTTD. The game is free, and open sourced, with development done by volunteers writing and reviewing patches in their leisure time as a hobby - no one is paid any money to work on OpenTTD.

I am sure if you wanted to spend enough money to pay the salaries of a team of developers, you could easily produce a commercial fork of the game that includes this feature, but then you might as well just write a new commercial game. It's not clear though that the market demands realistic shunting enough to support such a game, seeing as only one person ever wrote a patch, and never shared their code.
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 »

To say this is a simple bit of code is a huge myth; everything from how collisions are handled, to how each "vehicle" in a train is tracked by the game needs to be considered and appropriate solutions and mechanisms coded into the software. It's not an easy project to undertake and the impact on the rest of the game needs to be bought into account as well.

In short, if it was easy, it would have been done. If it was quick, it would have been done. If it added something substantially new and different to the game it would have been investigated more thoroughly and most likely done. But many years since TTDP and latterly OTTD first considered such a feature neither games have achieved adding it to trunk.

I hope it comes eventually, but there's a lot of investment both of time and knowledge that is required to bring such a patch to fruition
User avatar
Pilot
General Forums Moderator
General Forums Moderator
Posts: 7629
Joined: 04 Aug 2010 15:48

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

Post by Pilot »

ciniNPC wrote:if anything it could be easily done but people have yet to taken the proper amount of time to create this. if one person can do it with some simple codes why couldn't the people who work for the game do it. They technically have all the material to do so plus half of the things needed to do it are in game. yes i may not be at the level of smartness when it comes to coding but its just simple logic. Hopefully our sugesstions will be taken into consideration even though this topic has gone to complete nothing
I'm sure the Devs are going to love you, saying that it can be "easily done" and that "when it comes to coding, its just simple logic"... Code is not a simple thing to do, I know because I've written fairly simple code and it took me a long time. The code required to implement such a change also has the ability to require changes to code elsewhere in the game, which just adds to the time. As has been said, the Devs do this on an unpaid, voluntary basis, and I'm sure that they love it when people say what they do is "simple", especially people who don't actually know what they are talking about.

Whilst many of us, myself included, would love to see this implemented into the game, we can't just go around insulting the Dev's and undermining the hard work that they have put into this game, that we love, for free. This adds very little to game play value, whereas other things (such as Infrastructure Sharing) have the ability to open up whole new ways of playing in the game, and these too, are yet to be implemented.

At the end of the day, patience is the key. If someone can write a good enough Patch, it may get added into one of the Patch Packs, and you can play it there. Maybe you could actually give the coding of such a patch a go. In the meantime, however, it is a waiting game.
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 »

Someone is still working on this? :)

https://www.youtube.com/watch?v=vFoy5H2Cc_A

I'll be very happy if someone manages to make this to nice patch and clear out issues arising from it. :)
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

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

Post by Pyoro »

I'll believe it once I see an actual patch posted somewhere ;)
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

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

Post by Gwyd »

If you scroll up a bit, you'll see it was worked on, but the Dev lost interest (?) and never posted the code.
User avatar
jamespetts
Engineer
Engineer
Posts: 2
Joined: 24 Jan 2018 02:19
Location: London
Contact:

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

Post by jamespetts »

I have looked at this thread with some interest as I am in the process of planning the (eventual) implementation of something functionally equivalent in Simutrans-Extended, and am interested to see how other games go about doing or attempting to do this or something like it. I imagine that many of us recall Railroad Tycoon's very basic implementation of consist orders in which carriages and wagons would magically materialise and de-materialise on demand such that players never had to haul empties: the system was simple to interact with (and I imagine very simple to code), but terribly unrealistic.

Doing this realistically turns out to be fantastically complicated no matter what the code-base because of the inherent complexity of shunting operations on railways, and the very great many theoretical possibilities to be contended with.

The scheme that I have provisionally designed for Simutrans-Extended, as discussed in some detail here is, as will be seen, highly complex. It may be a considerable time before I get around to implementing it, but I have set out the design now, as I am planning to overhaul the scheduling system to an extent, and want to make sure that the code that I write for that will support the planned train re-combination features in due course.

Does anyone know of any other games of this genre that have actually done this successfully? It would be interesting to learn from how they do it.
User avatar
Drury
Tycoon
Tycoon
Posts: 2168
Joined: 09 Dec 2008 16:20
Skype: yes
Location: Slovakia
Contact:

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

Post by Drury »

jamespetts wrote:Does anyone know of any other games of this genre that have actually done this successfully? It would be interesting to learn from how they do it.
There's this mod for Factorio if you want a look

Image

Only dumb people quote themselves, and only the truest retards put such quotes in their forum signatures
-Drury
User avatar
jamespetts
Engineer
Engineer
Posts: 2
Joined: 24 Jan 2018 02:19
Location: London
Contact:

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

Post by jamespetts »

Interesting, thank you. I do not think that that specific approach would work in Simutrans-Extended very well, but it is interesting to see how others do it nonetheless.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

Changing train composition on station is rather hard to code (how to handle collisions, timetables etc),
but what about changing train composition via depot orders?
There is Template Replacement patch, which is very close to such approach.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Karn
Traffic Manager
Traffic Manager
Posts: 128
Joined: 02 Oct 2011 18:56

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

Post by Karn »

After so much waiting I made a patch for this. There are bugs and possible crashes at the moment, but it's doing something. I'll make a separate thread after I'll think it's good enough. Also any ideas for patch name?

https://github.com/Palo123/OpenTTD-YPS/tree/Decouple
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

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

Post by Gwyd »

Karn wrote:After so much waiting I made a patch for this. There are bugs and possible crashes at the moment, but it's doing something. I'll make a separate thread after I'll think it's good enough. Also any ideas for patch name?

https://github.com/Palo123/OpenTTD-YPS/tree/Decouple
Very exciting! Any chance you could release a compile?
User avatar
FulliAutomatix
Engineer
Engineer
Posts: 119
Joined: 24 Aug 2014 12:20
Location: Kaon Prison, Cybertron

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

Post by FulliAutomatix »

Karn wrote:After so much waiting I made a patch for this. There are bugs and possible crashes at the moment, but it's doing something. I'll make a separate thread after I'll think it's good enough. Also any ideas for patch name?

https://github.com/Palo123/OpenTTD-YPS/tree/Decouple
A: Holy crap, this is amazing!

B: I salute you for being able to get such a monstrosity somewhere in this game. I hope you can make something great from this. :D

It's quite weird because I was brain storming how such a feature would work in OpenTTD the other day :P
arikover
Route Supervisor
Route Supervisor
Posts: 466
Joined: 15 Jun 2007 09:27
Skype: madchimiste
Location: Berlin, Deutschland

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

Post by arikover »

Karn wrote:After so much waiting I made a patch for this. There are bugs and possible crashes at the moment, but it's doing something. I'll make a separate thread after I'll think it's good enough. Also any ideas for patch name?

RTS: Realistic Train Shunting?

https://github.com/Palo123/OpenTTD-YPS/tree/Decouple
Nice! I tried it, and managed to decouple a train, sent the engine to the depot, and was not able to recouple it afterwards. Could you explain how your patch is used? A "decouple/recouple for dummies" would be helpful...
Karn
Traffic Manager
Traffic Manager
Posts: 128
Joined: 02 Oct 2011 18:56

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

Post by Karn »

arikover wrote:
Karn wrote:After so much waiting I made a patch for this. There are bugs and possible crashes at the moment, but it's doing something. I'll make a separate thread after I'll think it's good enough. Also any ideas for patch name?

RTS: Realistic Train Shunting?

https://github.com/Palo123/OpenTTD-YPS/tree/Decouple
Nice! I tried it, and managed to decouple a train, sent the engine to the depot, and was not able to recouple it afterwards. Could you explain how your patch is used? A "decouple/recouple for dummies" would be helpful...
Here are conditions that should be met for succesful coupling/decoupling:
1. Decoupling and coupling works only in station due to complicated corner cases.
2. To decouple train: Train needs order with station, which is set to Decouple, it's another option for station, like FULL_LOAD
3. To couple train:
3.1 You need wagons at the station with active order WAIT_FOR_COUPLE.
3.2 Then you need Locomotive with Order GO_TO_COUPLE (6th option in GO_TO dropdown selection).
3.3 You need to use Path based signals.
3.4 Train with active GO_TO_COUPLE can pass only 1 Path based signal in it's direction.
3.5 Train with active GO_TO_COUPLE looks for first train with active WAIT_FOR_COUPLE order.
4. Limitations:
4.1 At the moment, only single simple Locomotive can decouple from/couple to wagons (Without articulated parts or dualheads).
4.2 Train length can't exceed lenth of station platform.
4.3 Train length shouldn't be too much shorter than station platform due to bug with implicit orders (fix in progress)

Steps by step guide:
1. Build a nice station "A" with rairoads around, don't forget to use PBS.
2. Build a spot "B" with waypoint next to station, where Locomotive can wait.
3. Make sure, there is one Path signal pointing from "B" to "A"
4. Create Orders: 1: station "A" with decouple option, 2: waypoint "B" 3: Go To Couple Train, 4: ???, 5: Profit

Update 1: for some reason it always crash with allowed 90° turns, I highly recommend forbidding 90° turns before the issue is fixed
Update 2: should be fine now

Example in the picture
decouple.png
decouple.png (174.99 KiB) Viewed 4128 times
Last edited by Karn on 01 Jun 2018 08:33, edited 1 time in total.
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 »

Intresting developement. :) How does the wagon order apply? Does it reverse if the locomotive comes to fetch the wagons from opposite direction on station, or does it stay unreversed, so locomotive could change heads?

Doesn't do much if wagons on consist form symmetric train and the possible reversing does not appear any different than non-reversing, but if the consist uses several different types of wagons with unsymmetric placing on consist, wagon order that stays unreversed when locomotive comes to the other head of wagons could look somewhat pleasing.

And this opens many gameplay possibilities in terms of cost efficent locomotive usage on smaller producing industries. :) Just wagons waiting for the load on the station, while the locomotive is making some other productive work.

Also, in theory there could be electrified mainline with extension of non-electrified tracks, and locomotive change electric -> diesel on station in between and vice versa.
User avatar
JGR
Tycoon
Tycoon
Posts: 2557
Joined: 08 Aug 2005 13:46
Location: Ipswich

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

Post by JGR »

This looks very interesting.

A couple of thoughts though:
  • This assumes that free wagon chains have the same properties as when attached to a locomotive, this isn't the case for many NewGRF vehicles (e.g generic MU wagon vehicles).
    This is likely to be highly problematic if you save/load in the decoupled state, or if you switch the coupled locomotive to a different model.
  • What about having more than one locomotive at the front? Should both/all be decoupled, or just the first, and can the remaining locomotives move independently?
  • How does this interact with cargodest (link capacity estimation, etc)?
  • Should decoupling passenger wagons be allowed?
  • What about coupling extra locomotives on the back (e.g banking engines)?
  • Fancier concepts like splitting trains in half and sending them separate ways would be very nice, but would probably cause too many issues with NewGRFs and user order management, but might be worth considering?
Ex TTDPatch Coder
Patch Pack, Github
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

Some my toughs:
1. great patch, hope that it would be possible to split train, it would help with better goods distribution. However I have no idea, how to handle it with existing GUI and train structure.
2. there is a "reverse on waypoint" patch, I recommend to merge it here :)
3. train should not reverse automagically at the and of the track, instead, it should go backward and speed penalty should apply in such case (for example 20 mph) if there is no locomotive at the front of the train.
There should be possibility to suppress such penalty (to enable cars with driver cab), not very elegant but simple way for grf makers is to make cab car with very low 1 hp power, thus it would be treated as locomotive.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

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

Post by Gwyd »

Um could a UI for uncoupling be worked like the refit menu i.e you drag along your selection
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: Ahrefs [Bot] and 3 guests