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

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

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 we just sort the number of warongs in a depo and show a fake image off them in game

so its coal wagons to be sorted here the gets how many
For Community Integrated Version http://code.google.com/p/civopenttd/
555gln22
Engineer
Engineer
Posts: 120
Joined: 09 Sep 2008 19:48

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

Post by 555gln22 »

Bump...

I would love to do dynamic train composition...
Formerly known as 'davepoth'
oberhümer
Tycoon
Tycoon
Posts: 1283
Joined: 23 Oct 2009 19:35
Location: Here and there, sometime or another

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

Post by oberhümer »

Well, if you´d like to, do it!
--- Licenses: GNU LGPL, version 2 or newer, code and graphics. CC-By-SA, graphics, alternatively. If you're using any, I'd like to hear about it --- Call them "track types" ---
--- Mostly inactive developer for: NuTracks - Central European Train Set --- Running/compiling for: Linux (x86) - Android - Windows (32/64 bit) ---

--- Need a file packer? 7-Zip --- BOINC - use your computing power to benefit science --- Block trackers, not ads --- Unix in dispersible pellets, the formula for the future. ---
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 »

crakinshot wrote:(small bump).

Hi,

In reply to last post: I think it could work with cargodest, but you'd have to assign a destination to each wagon. i.e a wagon is going from A-B-C. During B, however, it is decoupled, waits, coupled, and then continues to C.

General comment: I like the idea of shunting and coupling, and by implication bigger depo's. Personally, I've been following OpenTTD for a while, and I've been wanting a reason (task) to join in, and this seems to be it. Here are my views. There are two problems here: Shunting and Train Composition; they are different in practice, but can be combined. Personally, once you have Shunting you can do the rest far more easily.

The basics of shunting is that a train needs to transfer from one track to another, like so.
Image

This requires
  • Remove train 'flipping' - current mechanism to change direction
  • Train Reversing - a train at least appears to be reversing
  • Correct Path Finding - given that Yafp might not find a path if it requires stopping and reversing, some work might be needed.
Once you have that mechanism you can go onto the more complex stuff. Specifically, like in reality, if shunting train wants to pass a Danger signal (red) it needs permission from the signal box. Similarly, in OTTD, you'd need an update of the signaling system or at least the train mechanics so that a train could enter into a block already occupied, without the trains crashing. Anther feature which would be nice would be track labelling. So, in the order you'd have "Goto STATION, on PLATFORM 3" OR "Goto STATION, on any pratform" OR "Goto STATION, use platforms 3-to-5". You'd then derive that so you'd have "Goto TARGET, use TRACK CONDITION"... so then you can apply it to stations or depo yards. The general idea here being, rather than break the track mechanics you'd simply use the already (high customisable) station mechanic for the 'shunting Yards'.

Dynamic train composition is very different. You could essentially add the feature in pretty quick if everything happens in the existing depos. The main difficulty is the wagon labelling and making it easy to use. Also, I can imagine how it could go very wrong if designed incorrectly. For instance, do you explicitly reference the wagons, or do you go with a more implicit method. For instance, you can have a train leave 4 coal wagons at a Station/depo and then have another train pickup ANY/AMOUNT coal wagons from said station and take them to a destination. This way you're not breaking the CargoDest mechanic, just expanding upon it. Rather than the cargo being left at a station/depo you've left the wagons. Almost exactly the same thing, especially if its all done in a depo. Of course, it would get complicated if you actually had a huge shunting yard, where the wagons are real. BUT, given what I've already mentioned about the shunting yards being stations, once the wagons have stopped and have been decoupled, they are 'in the station' as cargo ready to be taken to a destination.

Not a good solution, but one that probably would make it easier (for the user) to have several trains transfer wagons to a destination.

Well just some thoughts. I'll definiatly have a go at getting the OpenTTD code compiling and play around to see how it all works. Anyone else seriously thinking or working on shunting/decoupling?

Hmm, good points there. My conceptual appoach to shunting would be like this:

-Shunting unit. Defined same way as train, but without wagons or coaches. Only motive power. Has a programmable order list, which it runs with loop in auto-mode, like normal train. It could be also manually overridden to do single, user defined runs. Would serve as line-running train's motive power, in certain services, where, for example, tractive power is changed from electric to diesel or backwards. Programming is done via gui.

-Consist. Defined same way as train, but without motive power, and hasn't got any programming in it. Just a bunch of wagons/coaches, which form a consist. Has a unique name, which it can be called on programming.

-Consist group. Consists which form a certain service, for example, coal loading/unloading circulation, are defined to group, and they are more easy to address, so adressing single consists is not always necessary, for example on long routes where there is 4 consists running on trains, and so addressing a single consist is impossible on a case like that, because single consist's location wouldn't be there where it would be wanted.

-Shunting safe point. Point, located such way on railyard it does not interfere with mainline traffic, or if located on mainline, mainline traffic should be low. Shunting unit can reverse it's moving direction (but not the normal turn-the-graphics and whole train way!) here. Only direction of moving is changed. Shunting safe points could be stacked, and every shunting safe point should have a nearby shunting area (along with paraller run-around track), which is used to run around specific consist, for example when there is a terminus waiting ahead to which consist must be reversed so that it can be run out from it, without any futher reversing, or for another example, when there is a change of train direction, or traction from diesel to electric in a train.

-Shunting area. Resembles current stations, but platform isn't usually used by trains, it is used by shunting units. Shunting area is a temporary wainting area for "consist run-around", when driving direction or
having the consist pushed from back is needed.

-Waiting area. Resembles current stations, but platform is used for arriving consists on arriving trains, and for waiting consists to depart, and when "line-running" locomotive has orders to pick up consists, they go with them.

-Loading area. Same thing as stations, but platforms are for consist waiting for full/half/etc load or unload..

Here's demonstration map for shunting unit coding.
Image

Code example..:
(defined shunting unit SU1 and 5-wagon petrol consist)

Code: Select all

couple consist "petrol" #coupling to the consist itself, consist just created at depot
go to SA1 #move consist to shunting area, shunting unit on head
decouple consist "petrol" #decoupling
go to SSP2 via SSP1 #shunting unit goes to Shunting safe point 2 via Shunting safe point 1, via paraller track
go SA1+couple to consist "petrol" #shunting unit goes from previous position to Shunting area 1, and couples to consist from opposite direction
go to SSP2 #shunting unit moves consist to Shunting safe point 2
Push-go (load) to "petrol1" #shunting unit pushes consist to petrol1-loading point from Shunting safe point 2
decouple consist "petrol" #decoupling
go to Depot #go back to depot to wait
And so. This method would be fairly easy to program with gui.
Next piece of code would be waiting loop for bringing back the loaded consist from petrol loading station, and having it transferred to waiting area WA1..

Code: Select all

(Waiting loop)
1 if consist "petrol" state is full, then go to get_petrol else go to 2
2 go to 1
Real waiting loop could have had many more if-beginning stuff... But then get_petrol:

Code: Select all

go to SSP2 #goes near petrol
go to "petrol1"+couple to consist "petrol" #explains itself
go to WA1 #goes to waiting area 1
decouple consist "petrol" #explains itself
go to Depot #explains itself
And then, consist "petrol" could be addressed by some other shunting unit, or it can be coupled to some train, which heads somewhere else.

Any comments, is this anything even near possible to implement? Gui for programming list is a must thing to have, in my concept.

Unfortunately, i am not into coding, but on conceptual level, i have ideas.
Attachments
Shunting example
Shunting example
SHUNT.png (21.74 KiB) Viewed 1309 times
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

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

Post by SirOzlington »

Hi,

this is not exactly what you guys want, but I wrote a little patch that allows you to couple your trains.

http://www.youtube.com/watch?v=_ApnuGMzEeM

It's still buggy and I kinda lost interest in developing it, but it seems to be working nicely so far. (never actually played a real game with it on)
User avatar
Kraks
Engineer
Engineer
Posts: 73
Joined: 23 Jun 2010 20:53
Location: Moscow, Russia

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

Post by Kraks »

It's very interesting! :bow:
Image
Image
Image
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

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

Post by Lord Aro »

SirOzlington wrote:Hi,

this is not exactly what you guys want, but I wrote a little patch that allows you to couple your trains.

http://www.youtube.com/watch?v=_ApnuGMzEeM

It's still buggy and I kinda lost interest in developing it, but it seems to be working nicely so far. (never actually played a real game with it on)
Please, post the patch :)
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

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

Post by SirOzlington »

I coded it a bit further
http://youtu.be/d9d7wfgMTMg

There's still some cases to handle and some issues to solve, for example: which platform should the train take? Atm I'm handling that with waypoints, as you can see in the clip.
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 »

:shock: WOW!! :bow: Please don't lose motivation on this patch! This would be a HUGE improvement to the game play!
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 »

Amazed that this isn't getting more attention - looks really fun! Does it would with multi-headed trains?
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

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

Post by SirOzlington »

multi head creates a lot of crashes still

the engines drive with the distance they had bevore uncoupling etc.
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

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

Post by ZxBiohazardZx »

this would be best if you can also decouple parts of the wagons and merge them up into a bigger chain like in real life

aka coal from A, wood from B, iron from C, all to shunting grounds (D) , there merge them up into a ABC train that goes from D to destination E, where it can be splitted in individual components again

(or wood/iron (75%/25%) from A oil/iron from B via D to E, allowing to splint into the wood/iron and oil/iron original components again

aka you have "wagon-subset" id and a "locomotive" id

i think the dutch NS implemented this as "treinwagon-stam" (a fixed set of wagons, that can be pulled/pushed/coupled as long as they stay in that order)
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

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

Post by SirOzlington »

That would be more interesting, but is a lot harder to code and needs a different approach than mine. It's possible tho.
User avatar
Wowanxm
Engineer
Engineer
Posts: 28
Joined: 09 Jul 2010 18:07
Location: Minsk, Belarus
Contact:

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

Post by Wowanxm »

SirOzlington wrote:I coded it a bit further
http://youtu.be/d9d7wfgMTMg
SirOzlington, that's shocking cool! :shock: This would be the greatest patch in OTTD since cargo destinations/distributions appeared! Please, don't give up improving your patch!
User avatar
DanMacK
Tycoon
Tycoon
Posts: 3906
Joined: 27 Feb 2004 20:03
Location: Ontario, Canada
Contact:

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

Post by DanMacK »

Interesting DEvelopments, I look forward to your next update.
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 »

SirOzlington wrote:I coded it a bit further
http://youtu.be/d9d7wfgMTMg

There's still some cases to handle and some issues to solve, for example: which platform should the train take? Atm I'm handling that with waypoints, as you can see in the clip.
Now here's a brave and kind of rude suggestion: A completely new patch that would give each platform it's own "waypoint" ID

I don't even know if it's doable, but it would help way more than just this problem.
Image

Only dumb people quote themselves, and only the truest retards put such quotes in their forum signatures
-Drury
User avatar
Expresso
Tycoon
Tycoon
Posts: 1760
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

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

Post by Expresso »

On top of that, to make this work better, it would be nice if a vehicle can check whether there are wagons on a platform and where the cargo contained in those wagons want to go. This would required a lot of code, though.
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 »

The use of waypoints in this patch are same as shunting safe points on my conceptual approach. Some waypoint graphics with just mock-up of shunting signals could be nice.

Hmm, if you have one non-symmetric bunch of wagons, and leave them on station, and then run to the other side of wagons and then couple on them, do the wagons turn around (last one becomes first one) or are they in original order?
SirOzlington
Engineer
Engineer
Posts: 20
Joined: 03 Feb 2012 16:42

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

Post by SirOzlington »

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
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 3 guests