advanced vehicle replace for trains

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
speedy64
Engineer
Engineer
Posts: 26
Joined: 01 Jun 2009 11:30

advanced vehicle replace for trains

Post by speedy64 »

Hy

havent found anythink like that - and even not shure if possible - but would be very helpfully ;)

when playing with big trainnetworks and >500 trains over a long time, often trains and waggons change for shure.
maybe i have for example a group of maybe 20 coal-trains using a shared route. for example 2 trains and maybe 30 short coal-waggons behind.
now there comes a new coal-waggon, its faster, bigger, and much longer. ok no problem - using autoreplace and the setting to automatically hold the length he changes the 30 old to maybe 22 new (fake-numbers for example only). anything fine for now. a few years later another coal-waggon comes. also faster, also bigger, but shorter than previews one. now i could change 1:1, but then the train is shorter than wanted... also it is not possible to automatically change the 2 trains against 1 maybe more powerfull or 3 smaller ones... or removing brage-waggons,... or to change 2 long old steam vs 2 shorter electric+1waggon

so my suggest:
couldnt it be possible to build a train "like wanted" - to use the example maybe 1 big train + 27waggons, and then to say "this is wanted, now replace whole group to this sampletrain when in depot next time".

sry dont know if possible ;) but maybe someone understands what i mean :)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: advanced vehicle replace for trains

Post by planetmaker »

speedy64 wrote:(...)replacement options(...)
In my words (to make sure I understood): you would like the option to replace train consists A by another train consist B by means of the autoreplace option.

You know about autoreplace and its limits, and this thing is to my knowledge not possible (yet). It is definitely a "nice to have" feature, though :-), but I also don't know of an existing patch with that functionality.
speedy64
Engineer
Engineer
Posts: 26
Joined: 01 Jun 2009 11:30

Re: advanced vehicle replace for trains

Post by speedy64 »

yes thats what i meaned ;) hm - maybe anybody else knows it or even can say "would be possible" or something? :P
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: advanced vehicle replace for trains

Post by Alberth »

Yes, it'd be nice to have.
One step further, I'd like to do that for the trains at this and this route only (eg the hilly routes).
That rapidly boils down to a redesign of the whole group concept.

Nice to have indeed, but not exactly simple.

@speedy64: Yes, it is possible, but takes a lot of time. Do you care enough to turn the idea into reality?
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: advanced vehicle replace for trains

Post by Kogut »

Similar bat maybe easier
I have 200 trains with one space loco and 13 cars
And about 40 7 tile stations
New loco appeared, unfortunatelly it use 2 space instead of one

Now it result in extremly annoying jams and a lot wasted time. And lost game.

Is it possible to add option to remove fist carriage when single-space-train is replaced by dual-space-train. And duplicate first in reversed situation?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: advanced vehicle replace for trains

Post by Rubidium »

Kogut wrote:Is it possible to add option to remove fist carriage when single-space-train is replaced by dual-space-train. And duplicate first in reversed situation?
Sorry, can't add that function. I'll consider adding it to 0.4.5, which will be released approximately 4 years ago.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: advanced vehicle replace for trains

Post by Kogut »

Why it was rejected?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: advanced vehicle replace for trains

Post by Alberth »

Who says it was rejected?
In fact, Rubidium has just returned from his time travel, and you can now use it since version 0.4.5. See also http://wiki.openttd.org/Autoreplace#Wagon_removal
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: advanced vehicle replace for trains

Post by Kogut »

Thanks for pointing interesting feature!
Note that this only works one way; if you were to replace a train with two engines (e.g. IC125 or some DMUs) with a single engined train, you would shorten the overall length. It is not padded back up to the original length because you cannot specify which carriage would be used to do that.
It can be fixed by duplicating first carriage.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: advanced vehicle replace for trains

Post by Eddi »

it can not, because people may use different wagons in different consists, and some newgrfs may force certain wagons to be on certain positions or amounts, so you can't just duplicate one random wagon.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: advanced vehicle replace for trains

Post by Kogut »

FIRST wagon != random
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: advanced vehicle replace for trains

Post by Alberth »

Kogut wrote:FIRST wagon != random
Sure, but it does not always work either. A better solution is needed instead.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: advanced vehicle replace for trains

Post by Kogut »

It should be option. When it fails?
And delete_first_carriage sometimes broke train (more frequent), and is as an option.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: advanced vehicle replace for trains

Post by Alberth »

I never dared using automatic removal of a wagon. It feels way too fragile to use to me to use in a game.

The overall aim of development is to reduce the number of broken options rather than add new ones.
So yes, you are correct, the automatic removal of wagons is also broken, and should be replaced with a better solution as well.

I believe it is possible to find a better solution that makes both options obsolete. Unfortunately, there are a zillion such points in the game. This one is near the end of my list at the moment.
If you want a solution soon, find a good one, and implement it cleanly.
speedy64
Engineer
Engineer
Posts: 26
Joined: 01 Jun 2009 11:30

Re: advanced vehicle replace for trains

Post by speedy64 »

Hy Alberth

I would be happy to do it for myself - but atm i would say - i easily are not able to do it for myself :( i have done only a few small things in C before - never more than 100lines... far away from saying i could do something like that...
my own "language" is mostly php, html, xml and such "web"-tools... and a little basic/pascal from schooltime :P yes i am thinking about learning an additional one and atm moving around between C(++/#) or Java (because using linux very much...) but i think u know how long it takes to come far enough to build something in such a big (and very nice) project.

i really dont know how it does that autoreplace atm... but when its possible to say "replace car x with car y", why shouldnt it be possible to say "if option sampletrain is set, replace waggons x with waggons y"... but ok maybe its much more complicate ;) for shure there are a lot more options like fright-types and so on to look at. but that was why i meaned a sampletrain - a kind of "dont care about the old frights, settings and soon, easily take anything from that one" - and only for a single shared timetable to be shure they all go same way...

a few months ago i tried to update an old separate-timetable-patch to trunk... "only" a little more than 1000 revs :P there i saw: there is very much movement in the code :) new widgets (what the hell are this? :P) and so on... it took a few days to find anything. at least i could do it for trunk, my later try to update also for cargodist failed as i couldnt find any old cargodist-version to look the differences.

but time will come :) thanks
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: advanced vehicle replace for trains

Post by Alberth »

Hai speedy64,
speedy64 wrote:I would be happy to do it for myself - but atm i would say - i easily are not able to do it for myself :( i have done only a few small things in C before - never more than 100lines... far away from saying i could do something like that...
The only thing you really need is enough will power to make it happen.
Anything else can be learned.

Learning takes time, but hey, it is a hobby, it does not need to be finished any time soon, does it?
speedy64 wrote:but i think u know how long it takes to come far enough to build something in such a big (and very nice) project.
yes I do :D (I spent 1.5 years designing and implementing new widgets)
Be patient, make a master plan with steps so you understand where you want to go (and what is part and what is not part of the plan), then start at step one. You also will need to start again from scratch a few times. It is all part of the learning process.
Realizing that you did something wrong, and that all your hard work is for nothing, really ruins your day. However, in hind sight, trying it again always brought new insights, and resulted in an even better project result in the end.
speedy64 wrote:i really dont know how it does that autoreplace atm... but when its possible to say "replace car x with car y", why shouldnt it be possible to say "if option sampletrain is set, replace waggons x with waggons y"... but ok maybe its much more complicate ;) for shure there are a lot more options like fright-types and so on to look at. but that was why i meaned a sampletrain - a kind of "dont care about the old frights, settings and soon, easily take anything from that one" - and only for a single shared timetable to be shure they all go same way...
Like you, I have no clue how it works, and neither how it should work in the new enhanced way. (I may be a dev, but I have seen about 20% of the code, 10-15% or so I really understand, so the remaining 90-85% is still to discover for me!)
speedy64 wrote: there i saw: there is very much movement in the code :) new widgets (what the hell are this? :P)
Code ages rapidly indeed, I think it is a good sign.
speedy64 wrote: and so on... it took a few days to find anything. at least i could do it for trunk, my later try to update also for cargodist failed as i couldnt find any old cargodist-version to look the differences.
My standard approach when I have to find out something, is to document it using doxygen comments. That way, the information is preserved, and others (and myself too in the future) don't have to dig again.

Good luck with plotting your plan.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: advanced vehicle replace for trains

Post by Eddi »

speedy64 wrote: a few months ago i tried to update an old separate-timetable-patch to trunk. [...] my later try to update also for cargodist failed as i couldnt find any old cargodist-version to look the differences.
cargodist shouldn't touch the timetable code, so the trunk patch should apply to cargodist almost cleanly.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 6 guests