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

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

Well for shunting, the very first thing would be a train run around. i.e. the main engine units decouple, run around the train and recouple on the other side.

Unfortunately, I can see that the current platform method would make terminals very difficult. Real terminals usually have two tracks quite close to one another with platforms only on one side. The track usually have a cross-over point toward the beginning of platforms so that units can run around the consist. So you'd have to fall-back to the train flipping method (existing behaviour).
User avatar
railwayman
Engineer
Engineer
Posts: 122
Joined: 14 Jan 2009 17:16
Skype: dinozaurs97

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

Post by railwayman »

You would need something like this, right?
Attachments
2.PNG
2.PNG (6.01 KiB) Viewed 6620 times
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

Exactly, but for terminals you couldn't have a run-around in the platforms without altering the code to support them (middle tracks), so unless you do some drastic altering of the station code you'd have to stick with the existing behaviour. Or have a cross-over point just ahead of the terminal.

Or you could have it so the run-arounds are done elsewhere. So the train would reverse until it found a place to run-around. You could do this begin with, i.e., add support for reversing trains and have them go to a depo when they need to change direction.
Attachments
Rarfingbridge Transport, 10th Feb 1950.png
Rarfingbridge Transport, 10th Feb 1950.png (68.47 KiB) Viewed 6587 times
Benningville Transport, 12th Feb 1950.png
Benningville Transport, 12th Feb 1950.png (38.33 KiB) Viewed 6588 times
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

In Leipzig (which is one of the biggest terminal stations in Europe), traditionally a second engine takes over from the other end, leaving the original engine behind. This creates some kind of engine rotation among N trains and N+1 engines.

In modern times, this system has been replaced by trains having steering wagons on the other end, so they now usually run backwards with the engine pushing.

If you want to introduce useful shunting, it should cover both these scenarios (with the push-pull-ability of a consist defined by the newgrf)
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

This is the main problem with the idea of shunting:

Image

It could need a new pathfinder, or at least an extension onto Yapf to solve it. Essentially the existing pathfinder doesn't seem to be able to see that if it goes to the first station and reverse, it can get to its target.
Attachments
pathfindingproblem.png
pathfindingproblem.png (76.36 KiB) Viewed 795 times
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

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

Post by 2007Alain2007 »

Cant it push the wargons becuse at some ponit in this patch it will have to do that

Am i rember right there was a GRF the did not flip the train
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

Well this is what makes shunting difficult. Fully enough, NTP does actually stop at the station and turn around, while the newer pathfinders get lost and carry on until the end of the track. Train composition (on its own) is pretty straight forward in my book, you'd just do it in the depo... "pick up 5 coal wagons from depo X". "leave coal wagons"... etc...
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

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

Post by 2007Alain2007 »

could you bring out that patch with the depots? :bow:

Also after that is out more players will get an idea what your doing?

Also this old pots might help out http://www.tt-forums.net/viewtopic.php?f=32&t=30346

becuse i think thats were he might have been heading
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

I'll give it a shot, I was working on platform orders, but I needed to check out the ordering system and how it worked. I guess I can try to put on an extension for leaving/picking up wagons.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

the reason why YAPF can't handle turning around (except in depots) is that it can't properly handle the length of a train. because if a train is longer than the platform, it might not be able to use the next switch. you are free to try and solve that, though.
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

hmm... interesting. I admit, I'm still learning the "in's and out's" of this game... so I'm always appreciative of any correction on my current thinking, or any new piece of information that adds to it.

I'll have a real proper look at yapf this weekend and run through it line by line. Coincidently, one of the thoughts I had was can you handle the length of the train in picking a reserve position?

One of the ideas I had was to actually perform a path finding from the target tile... so not only do you try to find a path to the target, from a position; you try to find the position from the target. With this you have a postion whereby both paths meet. Once you have a joining position you simply find a safe distance ahead of this tile for the train to stop, so that the condition (IsBehind(TileIndex(junction_join_pos), TrainEnd(train), TrainDirection(train)) is true.

Easier said than done, I know.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

a hint on how to incorporate train length in the reversal calculation might be the platform penalties (too short/too long)

and i'd advise you to not look too deep into the YAPF internals, unless you want to go insane from template magic... there are only very few interface functions that need touching (e.g FollowTrack or somesuch)

a concept on how to achieve the reversal: pass an additional parameter in FollowTrack that gives the tile, trackbit and the distance in "train length" + [0..1). for straight tiles you add 1, for diagonal tiles you add 0.5, so you always have two tiles to consider
User avatar
61653
Tycoon
Tycoon
Posts: 2095
Joined: 29 Sep 2009 09:13
Location: Batley, the People's Republic of West Yorkshire.

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

Post by 61653 »

surely it'd not be too difficult for those that know how to code (i.e. not me) , to have divide/combine options in the directions menu, particularly with DMUs/EMUs: eg:

---Train 1---
1. Go to (Station A)
2. Go to (Station B) (Join Train 2)
3. Go to (Station C)
4. Go to (Station B) (uncouple from Train 2)

---Train 2---
1. Go to (Station D)
2. Go to (Station B) (Join Train 1)

The train with the lowest number would be the lead vehicle(s) when joined, for the sake of routing. Train 2 would only be treated as a separate entity when decoupled.
There is of course the issue of the trains crashing once they've separated, but that's already been mentioned anyway.
I was social distancing before it was cool 8)
Formerly known as 47434
Last train journey I could be bothered to look up the headcode for: 04/02/2016, Mirfield to Batley, 2J34 1459 Huddersfield to Leeds, Northern Rail 144015
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

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

Post by DaleStan »

47434 wrote:The train with the lowest number
What about named trains? What about two trains with exactly the same name?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Nite Owl
Tycoon
Tycoon
Posts: 1889
Joined: 06 Mar 2007 19:32
Location: In The Dark

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

Post by Nite Owl »

Two trains with exactly the same name would not be a problem as OpenTTD does not allow you to have two vehicles of any type with the exact same name. However, problems with names would arise no matter what the trains may be called - default or otherwise. What does the train's name become once the two or more trains are joined. What happens when they split again in regard to names. The names would somehow have to be stored with each now joined section while it is part of the larger train so that each section could regain its name upon separation. I believe this falls into the category of 'too much work for too little gain'.
Humor is the second most subjective thing on the planet
------------------------------------------------------------
Brevity is the soul of wit and obscenity is its downfall
--------------------------------------------------------
Good Night And Good Luck - Read You Soon
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

Well I've played with RailSimulator and RailWorks before. The way that game deals with the problem is to label every unit with a number. Then train commands deal with coupling and decoupling individual units.
2007Alain2007
Chief Executive
Chief Executive
Posts: 658
Joined: 11 Nov 2007 12:06
Contact:

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

Post by 2007Alain2007 »

you would need to add names for all locos

so in a 2 loco train your have loco 1 and 2

but what about the wargons how will theres be named

also what about the limt off 5000 trains i could see a proble there
For Community Integrated Version http://code.google.com/p/civopenttd/
User avatar
crakinshot
Engineer
Engineer
Posts: 62
Joined: 14 Sep 2009 14:31
Location: North Wales

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

Post by crakinshot »

Hmm well you wouldn't make every wagon/train unit into an individual Train in OTTD... wouldn't make sense. What you'd want is to separate it all out. So you have a list of units, where they are, what they are, what is connected in front and behind, etc, etc. That way they can be anywhere, on their own or connected and still be rendered.

Then you'd have a Train Driver, which would be the orders (essentially the existing functionality), which attaches to a train unit from the main list. These are the ones you'd want to limit.
sean16
Engineer
Engineer
Posts: 61
Joined: 07 Feb 2009 21:05

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

Post by sean16 »

afaik, there is already a numbering system in place, for the grouping list. Even changing the train name doesn't change the order the trains appear in the grouping list, so this could be used instead of the train name.
formerly known as seandasheep
555gln22
Engineer
Engineer
Posts: 120
Joined: 09 Sep 2008 19:48

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

Post by 555gln22 »

I think the last time this was discussed it turned out that every single loco and wagon did have a unique ID. If that's the case then it would be possible.
Formerly known as 'davepoth'
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 3 guests