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

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

User avatar
Snail
Tycoon
Tycoon
Posts: 1283
Joined: 28 Apr 2003 18:52
Contact:

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

Post by Snail »

Ok, "maybe" I haven't been very constructive either :p so I decided to try this patch out. First thing first, let me say I'm very intrigued by its possibilities!

So, what I did was to construct a very simple line, and then run a short train on it. I sent it to a station and then ordered it to decouple.

In my initial consist (a locomotive and 3 pax coaches), the wagons' livery and recoloring were chosen according to the type of engine (through a callback, not livery override). Right upon decoupling, the wagons lost their engine-driven livery and reverted back to their default looks.
Now, this is not really optimal... Ideally, it'd be nice if they kept their livery as of when they left the depot. Perhaps creating a "shadow engine" would be a solution? As discussed, the only alternative to avoid this magical livery change upon decoupling, would be to clutter the purchase list with infinite wagon variants, which I don't think would be a great solution.

In any case, after decoupling, I sent the lonely engine through a couple of waypoints, and then gave the order to "couple any train". Unfortunately, almost immediately after, the game crashed with the attached error message...
error message after giving the order to couple
error message after giving the order to couple
ng_decouple_error_0.png (67.02 KiB) Viewed 523 times
I'm using my own trackset. Could this be the cause of the crash?
I'm also attaching all the docs created during the crash. Hope they can be useful to fix this...

Cheers!
Attachments
crash_20180612.zip
*.log, *.sav, and *.png file
(508.78 KiB) Downloaded 163 times
The French Narrow Gauge Train Set is now released! Get it here
Karn
Traffic Manager
Traffic Manager
Posts: 128
Joined: 02 Oct 2011 18:56

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

Post by Karn »

Thank you for bug report. It can't handle network without signals (or possibly with block signals), it crashed when it got to decision point, which is intersection. I'll fix this soon.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

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

Post by Wahazar »

Karn wrote: I ran to few problems and opened questions that made me remove it, maybe he had solutions for them. Those were:
1) Should info about train stay in first vehicle, or should there be something like consist for whole train, that contains order and other important things that are stored in first vehicle?
a) if no, then how to copy orders without making crazy duplicate code and NewGRF problems
b) if yes, how to access variables in reasonable way and how many changes are needed
2) How to deal with articulated vehicles both on map and in train gui
3) How to reprogram the reverse function, it has calls from various places and most of code assume, the train can't flip. It's especially problem for 1)a)
Some my toughs (points numbering doesn't reflect directly to above questions):
1. timetable can be stored in any vehicle, not only powered one.

2. reversing at the end of track: Whole train should be rebuild from back to forth: last vehicle first, first vehicle last, timetable should be assigned to new first vehicle, and standard reverse function can apply (thus articulated vehicles can be reoriented as usual).

3. reversing by decoupling/coupling: locomotive is decoupled, run around and couple to the back of the vehicles chain: train chain is being rebuild starting from locomotive and is ready to go backward (pushing would be considered as reversing from p.2).
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 »

Please continue discussion related to my patch in this thread viewtopic.php?f=33&t=83374
There is new version too with bugfixes for reported crash of game and reported crash of train after decoupling in end station.
SantaFe675
Engineer
Engineer
Posts: 3
Joined: 25 Jun 2016 22:35

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

Post by SantaFe675 »

Karn wrote:Please continue discussion related to my patch in this thread viewtopic.php?f=33&t=83374
There is new version too with bugfixes for reported crash of game and reported crash of train after decoupling in end station.
Holy crap I didn't know this existed. This is really cool, and honestly if it can be fully implemented, could allow for true "mixed" freights like what are common in real life, hauling multiple types of cargo and then dropping it off for a local unit to deliver. It would put the smaller locomotives in the game to good use too, especially with NewGRF's.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 9 guests