Autoreplace Wagon Removal suggestion

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
Honza_
Engineer
Engineer
Posts: 122
Joined: 29 Aug 2010 10:29

Autoreplace Wagon Removal suggestion

Post by Honza_ »

Hello there,
last night I was thinking about autoreplace behavior when you are replacing e.g. TIM with SH40 (what no one would probably due, because TIM is better, but in some vehicle sets you can have stronger one-headed engines than two-headed once) you lost one wagon to your lenght.
Since there is wagon removal condition, that works vice versa to keep the length fit in stations (considering one build trains as long as the stations are), why dont do it something like Keep train lenght function, so in the opposite condition the wagon is added to keep the lenght and utilize the amount of total cargo for trains. In case train consists of more wagon types, the one added wagon could be the first or last of the consist, so player can have some control about it, or what you think is best.
I have no clue how difficult this could be to involve. But this addon could be very handy.
What do you think as developers?

If I want to be a little more demanding, somethimes one uses more engines, e.g. when trains are weak and when stronger comes, and only one engine is enough, one has to replace them manually. Do you accept the challenge? :-)
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: Autoreplace Wagon Removal suggestion

Post by XeryusTC »

So if someone has a train which carries both passengers, mail and goods what kind of wagon should be added? What do you base it on? Adding the wagon of which the most are in the consist might not work as good as someone might want to have something else added. And what happens if you had two dual head engines (so 4 in total), would it replace both with just one or would the total be 4? I think it would be quite hard to make this so that it fits everyone's wishes at all times.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Autoreplace Wagon Removal suggestion

Post by Alberth »

@Honza_:
Until we have a brain interface to query your brain, there is no general way to magically decide the right wagons to add.
We could add the first wagon that fits, but that is bound to be wrong, and we would get loads of complaints about that.
Honza_
Engineer
Engineer
Posts: 122
Joined: 29 Aug 2010 10:29

Re: Autoreplace Wagon Removal suggestion

Post by Honza_ »

As I have written in my first post. Easily the last wagon could be added. So if player wants some wagon, he just build the train in such way, that the last wagon would be the one he wants after replace. And or to make it easier, the wagon will be added to keep train lenght only in case all wagons are the same so
having TIM with 12 coal wagon -> replace to SH40 -> SH40 with 13 coal wagons
having TIM with 6 livestock and 7 grain -> replaci to SH40 -> SH40 with 6 livestock and 7 grain

Forget about the replacing trains with more engines, I know it is difficult and cant be coded whatsoever.

And furthermore, I made a suggestion, you are the developers, so you think it is:
nice - you find the way to code it
bad - forget about it

But why the hack do you ask me for solution, since I am C++ virgin, I dont know
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Autoreplace Wagon Removal suggestion

Post by Eddi »

what if the train set requires you to have the last wagon as a brake wagon? having two brake wagons doesn't make sense, and you can't add a different wagon in the end.

there's so many things that can go wrong... there's no useful way to decide things.

the problem has nothing to do with C++...
Honza_
Engineer
Engineer
Posts: 122
Joined: 29 Aug 2010 10:29

Re: Autoreplace Wagon Removal suggestion

Post by Honza_ »

Yes, yes, seems to me you see only the problems, did anyone try see the advantages?

Lets have this:
200 2-headed trains
You replace all 2-headed engine for 1-headed: for example the last wagon of consist will be added, what may happen:
- we had all wagons the, we get one new and lenght is the same, hooray, we dont need to go to depot to add mannualy
- we had some mixed wagons and get one we dont wanted (pax, mail, brake) - not ideal, so ok, lets go to the depot
RESULT: if we had 100 one wagon type trains and 100 mixed we saved manual replacement (wagon adding) for 100 trains

Now you could say, hard to do, useless, blahblah, ok, lets think beyond
- player has already some control about all that and that is - groups - you can select even now different conditions for autoreplacing by creating groups
- even if it is "impossible" to create some reasonable behavior with adding wagon to keep lenght, it could at least add wagon to trains where all wagons are of the same type and leave the mixed trains on the lenght miuns 1

If you dont want to think about that function or think it is useless, you probably wont contribute with anything inteligent to the discussion, as we say in Highland - think before going on the Hill :)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Autoreplace Wagon Removal suggestion

Post by planetmaker »

Honza_ wrote:Yes, yes, seems to me you see only the problems, did anyone try see the advantages?
Without the corner-case problems being solved or decided how to handle, all advantages in other cases are not possible. So thinking about them before declaring a suggestion as "must have" and "easy to implement" is definitely one thing to do.

The only solution I currently see is that not an automatism handles this (as it will fail in corner cases, nearly irrespective how intelligent you make it), but rather go for a replace consist A by consist B.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Autoreplace Wagon Removal suggestion

Post by Alberth »

Honza_ wrote:Yes, yes, seems to me you see only the problems, did anyone try see the advantages?
Yes.

Others have suggested (and it seems like a good idea to me) to split the concept of train layout (the consist) from actual trains, that is, you can have a collection of consists separate from having a train with that layout. (It was called 'train template library'.)
That means you don't change trains, you change consists, and trains attached to that consist (probably via groups) change along with it.

It would solve your problems, as well the problems of many others.

I also looked into how to actually make that happen.
It turns out, to have consists as separate concept in the game, you need to rewrite the entire vehicle creation, vehicle renewal, vehicle replacement, and deletion code.
For added fun, the whole group code has to be changed too.

This is a big change. I have just started looking into it. At this time, I don't even understand how you would play the game if you had all those things. I think it takes me at least a year (if I can bear working on this for so long). Then it needs to be coded, which is another 2-3 years work.
Honza_ wrote:as we say in Highland - think before going on the Hill :)
As we say, you should check the facts before claiming people are not willing to think along with you.


If you are brave enough to actually do some work on this problem, I need answers to the following questions (and more, probably, as I have no idea what happens if you introduce this):

a) what would be the new windows that we need to have?
b) how would building a new vehicle look like?
c) how would autoreplace work?
d) how would autorenew work?
e) how to deal with 'old' consists?
f) how would building a new vehicle look like if you don't want to use consists?
g) how would autoreplace work if you don't want to use consists?
h) how would autorenew work if you don't want to use consists?
i) any question that comes up while thinking about the above.

f-h are for preserving the current simple way of enjoying trains & building. I think they are very useful for newbies and young children, so I want to keep them.

good luck, you will need it.

Sincerely,
Albert
Honza_
Engineer
Engineer
Posts: 122
Joined: 29 Aug 2010 10:29

Re: Autoreplace Wagon Removal suggestion

Post by Honza_ »

Thanks for answer, Alberth.
Alberth wrote: I think it takes me at least a year (if I can bear working on this for so long). Then it needs to be coded, which is another 2-3 years work.
3 years hard work only for adding one extra wagon when autoreplace would result in shorter train? Why do make more work on this?
Now I have feeling I had expressed my sugestion very badly. Again, my suggestion is behavior, when in case 2-headed engine is replaced qith 1-headed engine, the empty place is replaced with a wagon, which already is in consists (e.g. the wagon that the trains contains the most)

To your question, which I can answer only with my foggy knowledge ot how this all works
Alberth wrote: a) what would be the new windows that we need to have?
No new window, just instead of "Wagon Removal On/Off" there could be something like "Keep length On/Off"
Alberth wrote: b) how would building a new vehicle look like?
Why would you change that? If you find current code(which I have no idea how it works) dull, serve yourself. The suggestion doesnt need to do that.
Alberth wrote: c) how would autoreplace work?
As b). I think I describe it already in previous post. If you can replace engine for engine, is replacing engine for engine+wagon more difficult?

Alberth wrote: d) how would autorenew work?
As b). Absolutely no change, why anyway?

Alberth wrote: e) how to deal with 'old' consists?
As b). I am not developer, not my question to answer.
Alberth wrote: f) how would building a new vehicle look like if you don't want to use consists?
g) how would autoreplace work if you don't want to use consists?
h) how would autorenew work if you don't want to use consists?
i) any question that comes up while thinking about the above.
Question which are interesting to aks but has no reference to suggestion. Please, take no offense with my answers, but this is the way as I see it. Maybe I had stroken my head with massive piece of rock this morning, which has made me out of my mind.

So simple (or perhaps not) question to make me understand this, so I could stop asking no more stupid questions:
Is it, or how difficult is to autoreplace 2-headed engine for 1-headed engine+1 wagon (lets say the last wagon of the whole train, no matter what the wagon is)?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Autoreplace Wagon Removal suggestion

Post by Alberth »

Honza_ wrote:So simple (or perhaps not) question to make me understand this, so I could stop asking no more stupid questions:
Is it, or how difficult is to autoreplace 2-headed engine for 1-headed engine+1 wagon (lets say the last wagon of the whole train, no matter what the wagon is)?
Not, but then the next person comes along, that wants a subtle different change, and the next, and the next, and ... . The GUI gets a mess, since you need a button for each case, and code-wise, each extension needs its own new piece of code, so you get one big mess of small additions.
(Many players think that everybody plays OpenTTD in the way they do. That is simply not true, there are many different ways to play the game. Each player thus has subtle different ideas about what he needs.)

Since the above does not work, the only viable solution is to deal with the problem such that it will cover all possible requests in this area.
In the end that means (I think) that you want to express 'change trains of this consist to trains of that consist'.
That leads to my previous post, with several years of work.

(Note such long times are mainly due to not being able to work fulltime on it. Progress is not fast if you work less than a day / week on it, or so.)
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: Autoreplace Wagon Removal suggestion

Post by Rubidium »

The point Alberth tried to make is that this wagon addition is, like wagon removal, all in the class of consist management. When autoreplace was initially developed there were only "normal" wagons and "normal" engines and dualhead engines. Now with the addition of NewGRFs autoreplace has become obnoxiously complex.

For example:
  • some wagons can't be attached to some engines
  • some magic rules for wagon attachment, e.g. a vehicle is only valid when it has an even number of wagons
  • wagons and engines have varying sizes, from 1/8 of an original wagon to in theory 800/8.
  • wagons bought later can have different characteristics, including attachment to certain types of engines.
All these limitations make the "wagon addition" feature very complex, while it gives fairly little freedom to the user.

The long standing idea is to move from autoreplacing parts of consists (trains) to replacing/upgrading complete consists. This basically means that you (virtually) modify one train and then apply those changes to all trains sharing that consist. As a result autoreplace can also be used to replace a single grain wagon with a livestock wagon, or allow the user to "select" which wagon to add when the consist gets shorter. It also allows the user to add wagons beyond the length of the current train, e.g. if the current train is 31/8 long with a 15/8 engine, then replacing the 15/8 engine with a 8/8 engine would mean the wagon addition won't add a 8/8 wagon as that's longer than the 7/8 that the engine got shorter, but with the virtual consist you could still add the wagon. Even one of another type not used in the train yet.

It will, in effect make autoreplace much easier as well; most sanity checking can already be done at the moment of constructing the (virtual) consist meaning it is less likely to fail during the actual autoreplace.

Given the drawbacks of adding just the "add wagon" feature and the (massive) benefits to the (bigger) consists rework we rather implement the consist stuff than to add a feature with a long list of exceptions so we can just drop it when the consist rework is done.
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Autoreplace Wagon Removal suggestion

Post by Wolf01 »

XeryusTC wrote:So if someone has a train which carries both passengers, mail and goods what kind of wagon should be added?
Could I reverse the problem? If the player autoreplaces an engine with one a bit longer, what kind of wagon should be removed? I usually use mixed mail-passengers trains and always the auto removal of wagons removes the *only* mail wagon, which is directly behind the engine, so I'm forced to not auto remove wagons (or at least put the mail wagon at the end, but I like them at the beginning).
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: ZaphodB and 13 guests