Dynamic train composition? (Decoupling/Shunting/etc..)
Moderator: OpenTTD Developers
-
- Chief Executive
- Posts: 658
- Joined: 11 Nov 2007 12:06
- Contact:
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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
so its coal wagons to be sorted here the gets how many
For Community Integrated Version http://code.google.com/p/civopenttd/
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Bump...
I would love to do dynamic train composition...
I would love to do dynamic train composition...
Formerly known as 'davepoth'
-
- Tycoon
- Posts: 1283
- Joined: 23 Oct 2009 19:35
- Location: Here and there, sometime or another
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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. ---
--- 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. ---
- kyosuke1989
- Transport Coordinator
- Posts: 273
- Joined: 24 Mar 2008 13:04
- Location: Finland
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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.
This requiresOnce 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'.
- 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.
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.
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
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
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
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
- SHUNT.png (21.74 KiB) Viewed 2785 times
Projects in progress: Finnish Trainset (DevZone)| Finnish Rail Infrastructure and Stations Set (DevZone)
-
- Engineer
- Posts: 20
- Joined: 03 Feb 2012 16:42
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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)
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)
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Please, post the patchSirOzlington 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)

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
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
-
- Engineer
- Posts: 20
- Joined: 03 Feb 2012 16:42
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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.
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.
Re: Dynamic train composition? (Decoupling/Shunting/etc..)


Do you like drones, quadcopters & flying toys? Check out Drone Strike Force!

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets

Base Music Sets: OpenMSX | Scott Joplin Anthology | Traditional Winter Holiday Music | Modern Motion Music
Other Projects: 2CC Trams | Modern Waypoints | Sprite Sandbox & NewGRF Releases | Ideabox | Town Names | Isle of Sodor Scenario | Random Sprite Repository
Misc Topics: My Screenshots | Forgotten NewGRFs | Unfinished Graphics Sets | Stats Shack | GarryG's Auz Sets
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Amazed that this isn't getting more attention - looks really fun! Does it would with multi-headed trains?
-
- Engineer
- Posts: 20
- Joined: 03 Feb 2012 16:42
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
multi head creates a lot of crashes still
the engines drive with the distance they had bevore uncoupling etc.
the engines drive with the distance they had bevore uncoupling etc.
-
- Tycoon
- Posts: 1534
- Joined: 14 Mar 2006 12:46
- Location: Netherlands
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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)
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)
-
- Engineer
- Posts: 20
- Joined: 03 Feb 2012 16:42
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
That would be more interesting, but is a lot harder to code and needs a different approach than mine. It's possible tho.
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
SirOzlington, that's shocking cool!SirOzlington wrote:I coded it a bit further
http://youtu.be/d9d7wfgMTMg

Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Interesting DEvelopments, I look forward to your next update.
Regards,
Dan MacKellar
================
Projects in Progress
North American Renewal Train Set Topic,Canadian Train Set Website, Canadian Train Set Development Topic, Finnish Train Set Website,Visit my Train Gifs Site

CN Boxcar drawn by Dave Hersrud
Dan MacKellar
================
Projects in Progress
North American Renewal Train Set Topic,Canadian Train Set Website, Canadian Train Set Development Topic, Finnish Train Set Website,Visit my Train Gifs Site
CN Boxcar drawn by Dave Hersrud
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Nice videos.
It would be interesting to see how this patch works with newgrfs where vehicles modify their behaviour according to position in consist, lead vehicle ID, etc.
It would be interesting to see how this patch works with newgrfs where vehicles modify their behaviour according to position in consist, lead vehicle ID, etc.

FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Now here's a brave and kind of rude suggestion: A completely new patch that would give each platform it's own "waypoint" IDSirOzlington 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.
I don't even know if it's doable, but it would help way more than just this problem.
Only dumb people quote themselves, and only the biggest idiots put such quotes in their forum signatures
-Drury
-Drury
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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.
- kyosuke1989
- Transport Coordinator
- Posts: 273
- Joined: 24 Mar 2008 13:04
- Location: Finland
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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?
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?
Projects in progress: Finnish Trainset (DevZone)| Finnish Rail Infrastructure and Stations Set (DevZone)
-
- Engineer
- Posts: 20
- Joined: 03 Feb 2012 16:42
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
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
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
Who is online
Users browsing this forum: No registered users and 4 guests