Dynamic train composition? (Decoupling/Shunting/etc..)
Moderator: OpenTTD Developers
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Two ideas for handling NewGRF problems, they might not cover all required cases:
1) Introduce a new flag/callback (?) for wagons, "soft coupled", returns whether the front and/or the back of the wagon can only be attached/detached in the workshop (depot). The opposite (hard coupled) means the wagon-wagon bond can never be broken by orders, and when the train is running a series of hard coupled wagons count as a single unit. Only the player can break hard wagon-wagon bonds, and only on trains stopped inside a depot. A NewGRF that doesn't support the callback is assumed to not know about dynamic consists and the wagons are considered all hard coupled.
2) The result of every callback for every wagon is frozen when a train is started inside a depot. Even if the engine is decoupled and a different engine is attached, all wagons still behave as if it was the original consist. Even if the train visits a depot as part of the orders, if it doesn't stop there (and wait for the player to start it again) the values remain frozen.
The soft/hard coupling flag would let you still build MU consists inside a depot, and would allow you to have two short MU consists couple to a single longer consist, but each MU can't be broken up.
1) Introduce a new flag/callback (?) for wagons, "soft coupled", returns whether the front and/or the back of the wagon can only be attached/detached in the workshop (depot). The opposite (hard coupled) means the wagon-wagon bond can never be broken by orders, and when the train is running a series of hard coupled wagons count as a single unit. Only the player can break hard wagon-wagon bonds, and only on trains stopped inside a depot. A NewGRF that doesn't support the callback is assumed to not know about dynamic consists and the wagons are considered all hard coupled.
2) The result of every callback for every wagon is frozen when a train is started inside a depot. Even if the engine is decoupled and a different engine is attached, all wagons still behave as if it was the original consist. Even if the train visits a depot as part of the orders, if it doesn't stop there (and wait for the player to start it again) the values remain frozen.
The soft/hard coupling flag would let you still build MU consists inside a depot, and would allow you to have two short MU consists couple to a single longer consist, but each MU can't be broken up.
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Very good idea, which I think could fix a lot of problems bought upjfs wrote:Introduce a new flag/callback (?) for wagons, "soft coupled"
Even betterjfs wrote:A NewGRF that doesn't support the callback is assumed to not know about dynamic consists and the wagons are considered all hard coupled.
Less good. Some callbacks rely on dynamic things, such as speed or age or the current age or if the vehicle is reversed.jfs wrote:The result of every callback for every wagon is frozen when a train is started inside a depot.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Livery over-rides are daft anywayGwyd wrote:What about livery overrides?

NewGRF shouldn't be changing capacity based on lead engine, that's sillyin particular a change in capacity may occur.

I basically agree though that this needs a lot of care. Neat feature though, the video in previous page shows it off well

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..)
Well RUKTS used the first one to cause the second for every MUandythenorth wrote: Livery over-rides are daft anyway...
NewGRF shouldn't be changing capacity based on lead engine

Re: Dynamic train composition? (Decoupling/Shunting/etc..)
can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
yeah while we're at it we can just sell the coal at the mine and buy it at the power plantANIKHTOS wrote:can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
why even run any kind of transport service when we can just teleport stuff with money
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..)
well teleport is a form of transportationDrury wrote:yeah while we're at it we can just sell the coal at the mine and buy it at the power plantANIKHTOS wrote:can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
why even run any kind of transport service when we can just teleport stuff with money

cheers
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
You can make more money in early game, if you put more effort in it. It's the part of game, when you actually need the money.ANIKHTOS wrote:can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
You need one less locomotive for a route, because you can let load wagons without it, while the expensive locomotive is moving all the time and making money. For routes, where you can use only 2 trains, you save 50% money on locomotives so you can have more trains for less money.
-
- Engineer
- Posts: 29
- Joined: 31 Oct 2014 18:24
- Location: London, Ontario
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Finally! my dream of Dynamic trains is possibly coming true, and soon i could make massive yards to hold all my rolling stock and have a truly realistic north american setup!
-
- Engineer
- Posts: 29
- Joined: 31 Oct 2014 18:24
- Location: London, Ontario
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
ANIKHTOS wrote:can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
spiting a train into 2 and then merge it again?
apart from a perfect timing if the time is off then it will cause mroe wait?/
and if this happens in the platforms then you will loose that platform for long
better is it is done only in depot??
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
i load the coal i move it to the power factory i unload it i sell the wagons sent back the engine buy wagons load and repeat.
but if we gone have this feature lets take it one step more
sell teh whole train and the engines and then buy it again at the mine
no need for return rail, all engines will be max re ability everything perfect lol
but is anyone of you really need this feature and having it will make sense??
actaully, this has plenty of use in game for me at least, since if i have multiple types of freight headed in the same relative direction, i just slap it all on one train to take it down then separate to smaller trains/trucks to finish the trip, but with the ability to decouple the train, i can break it up and have those smaller trains come right off hte big one without having to buy more freight cars, all i would need is new locomotives, then the locomotives that came down with the big haul, can take go back with a big haul of different freight that came from a few other small trains getting put together, and before you say anything about having to haul a full empty train back, just stage how you move the cars, take few empties on a big haul with mostly full cars, such as is done IRL, and thus making even more of a "realistic" train configuration. basically you just have to make sure you are getting your locomotives around well really, also gives more reason to have a power move to. and can give old locomotives a reason to stick around on your lines as they could just be used as help for heavier consists.
i am still so grateful to those who work on this, its something hte game has needed and i have been wanting for a long time.

Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Karn wrote:
You can make more money in early game, if you put more effort in it. It's the part of game, when you actually need the money.
You need one less locomotive for a route, because you can let load wagons without it, while the expensive locomotive is moving all the time and making money. For routes, where you can use only 2 trains, you save 50% money on locomotives so you can have more trains for less money.
okey so it is for early game
and maybe later on for new routes with industries producing too little
the engine will all the time going up and down the map, but every trip it will change wagons
so the engine will not wait in the station
can i ask something?
how it will choose the wagons??
it will take the ones that are loaded the more??
because me even early in the game i try to make the biggest run possible with the money at hand
so putting 2-4 trains is not that far fetch since the trains will spent lot of time travelling
not perfect so my question is if the engine can choose 2 waiting wagons will be therea choice to choose the most loaded one??
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
This patch is completely unrelated to selling/buying wagons via orders, IMHO.ANIKHTOS wrote: apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
...
the only thing that could make any sense in the game as it is
it the ability to sell and buy wagons in the roders
There is many ways to utilise dynamic train composition, of course in case in regular openttd game, which is fast and easy in term of money making, such micromanagement can be a waste of time, but in case of daylenght patch+hard economy setting,
such patch can be very useful, if it would allow to attach helper locomotives for uphill route, or switch steam/diesel to electric as shown on TV (YT

Another uses: leave wagons for loading, pick other groups of wagons which are already loaded - no pay for locomotive waiting.
Or last but not least - possibility of cargo distribution - one train can supply many stations.
About late train: if I understand correctly, locomotive can pick any waiting train, so it will not stuck forever in case of train desynchronisation.
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.
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.
- FulliAutomatix
- Engineer
- Posts: 120
- Joined: 24 Aug 2014 12:20
- Location: Kaon Prison, Cybertron
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
I'd say the main use of this patch is realism (as I demonstrated in the posted video).ANIKHTOS wrote:can i ask a question?
apart that this feature is used in real life
in what scenario it will actual be of any use in the game??
Some of us (me as an example) play this game to simulate a real life network. The ability to move around rolling stock and locomotives gives a massive advantage.
Finally I'll be able to fill up my yards (that albeit are just decoration) with something useful, like coaches that are waiting for their next working, stored freight wagons that are waiting for their next loads, locomotives in for maintenance etc.
To the logistical player that builds this game for functionality, I it may not be the best (although the example of saving money on locomotives early game is also a great mechanic).
TLDR; For the eyecandy player like me, this is absolutely perfect to simulate real life better.
Known as StarRaid/UnholyPhish on other platforms
Some links to stuff I've made:
-=RUKTS=- | -=NML Py-Patcher (a Python 3.0 pre-compiler)=- | -=Screenshots=- | -=Doom Soundtrack port to OpenTTD=- | -=Heightmaps collection=-

Some links to stuff I've made:
-=RUKTS=- | -=NML Py-Patcher (a Python 3.0 pre-compiler)=- | -=Screenshots=- | -=Doom Soundtrack port to OpenTTD=- | -=Heightmaps collection=-

Re: Dynamic train composition? (Decoupling/Shunting/etc..)
However those that can change dynamically while the train is running shouldn't be changing any wagon length properties anyway, it would cause exactly the same problems, right? Perhaps more correct would be to keep a whitelist of callbacks allowed when the train is running?Gwyd wrote:Less good. Some callbacks rely on dynamic things, such as speed or age or the current age or if the vehicle is reversed.jfs wrote:The result of every callback for every wagon is frozen when a train is started inside a depot.
I have no experience building NewGRFs, only some basis technical knowledge from reading about it and following the original development of it for TTDPatch back then, so I hope someone else can use this to build on

Re: Dynamic train composition? (Decoupling/Shunting/etc..)
When you load a savegame, most trains are not in a depot. The callbacks MUST return the same value whether the vehicle is in the depot or not, which it won't be able to do if they're split up. Splitting vehicles up without changing how callbacks operate will not work.
He's like, some kind of OpenTTD developer.
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Version 0.3
This should be more stable, but there are still bugs present.
Feature - coupling train depending on full/empty and cargotype of wagons.
Also I decided to remove experiment with reversing because I think it deserve separate patch. As result, articulated vehicles bug is fixed now.
Edit: 0.3 is replaced with 0.4 in the future post
This should be more stable, but there are still bugs present.
Feature - coupling train depending on full/empty and cargotype of wagons.
Also I decided to remove experiment with reversing because I think it deserve separate patch. As result, articulated vehicles bug is fixed now.
Edit: 0.3 is replaced with 0.4 in the future post
Last edited by Karn on 10 Jun 2018 15:05, edited 1 time in total.
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
that is a possiblility, but that effectively disables the shunting feature for all existing NewGRFs, which is a rather harsh limitation. so we should try to explore less harsh solutions, before considering this.jfs wrote: A NewGRF that doesn't support the callback is assumed to not know about dynamic consists and the wagons are considered all hard coupled.
while that is probably true, just saying "don't do that" is not going to solve any problems.andythenorth wrote:NewGRF shouldn't be changing capacity based on lead engine, that's silly
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
Maybe we just overcomplicate things and nothing special is needed. Maybe all we need is the current depot check and as a bonus check, if length of vehicle(s) changed. (Or capacity too, if any NewGRF does it without changing length)
Re: Dynamic train composition? (Decoupling/Shunting/etc..)
I got the patch crashing a bit (both trains and the game itself) but in the end I figured out what I was supposed to do - not overcomplicate things with waypoints and just trust the train to figure out who to couple to.
https://gfycat.com/WatchfulAmpleHammerheadbird
Honestly this patch is quite impressive, I like how simple to use it turned out to be. Good job.
https://gfycat.com/WatchfulAmpleHammerheadbird
Honestly this patch is quite impressive, I like how simple to use it turned out to be. Good job.
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..)
Whoever says this is silly himselfandythenorth wrote:NewGRF shouldn't be changing capacity based on lead engine, that's silly

The French Narrow Gauge Train Set is now released! Get it here
Who is online
Users browsing this forum: No registered users and 3 guests