Replacing whole trains

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Post Reply
mates
Engineer
Engineer
Posts: 6
Joined: 30 Dec 2005 10:11

Replacing whole trains

Post by mates »

What about replacing whole train units instead of replacing each wagon type separately.
You would be able to change train length and cargo type structure more easily.

Or easier variant: Just switching between already existing train units. (no need of "template creator")
Attachments
Photoshoped example.
Photoshoped example.
Trainreplace.png (54.93 KiB) Viewed 1339 times
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: Replacing whole trains

Post by lawton27 »

That would undoubtedly be a nice feature to add. But dare I say tricky to implement, and if it is implemented I think the UI would be hard to follow, I took a good long time trying to work out your example, possibly that's just me though :D

Yeh nice idea, it would be nice to hear from a dev or experienced coder of OTTD about this.
mates
Engineer
Engineer
Posts: 6
Joined: 30 Dec 2005 10:11

Re: Replacing whole trains

Post by mates »

I made new example picture/screen. Hope it is more understandable.
Image
Attachments
Trainreplace.png
Trainreplace.png (107.45 KiB) Viewed 1339 times
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Replacing whole trains

Post by Alberth »

Nice start, but you have to think bigger imho.

- There is no reason to limit it to trains only.

- You need to include some form of groups. Like now, people want to replace consists only at routes/lines/groups X, Y, and Z.

- How does the current game play and group-based play work together? In my view, the current game play is easy to explain and to do for younger children. Doing everything based on groups/templates (like eg Simutrans does) would exclude that target audience.

I have no clue at all how that would work. There are a few proposals, but they are all incomplete.



Literally yesterday, I found the first hurdle of your proposal.
Currently OpenTTD does not understand templates at all, it only knows actual consists (= trains in current use). In other words, to get templates in the game, you need to introduce templates, and then re-think and re-implement the entire vehicle command system in terms of templates, from buying vehicles, to giving orders, replacing, and selling.
mates
Engineer
Engineer
Posts: 6
Joined: 30 Dec 2005 10:11

Re: Replacing whole trains

Post by mates »

OK it is quite hard to understand and implement. So, would be possible just switching between two already existing train units? Like this: very similar to replace vehicles window. Image
Just bit tricky when there are two same looking differently refitted trains.
Attachments
Trainreplace2.png
Trainreplace2.png (19.43 KiB) Viewed 1339 times
broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Re: Replacing whole trains

Post by broodje »

I'm not to fond of a template library myself, but that might be because I play with grouped trains. Wouldn't it be possible to ad an option 'replace with consist' in the drop down box 'Replacing' in the replace train window?

Then you click the consist you want to replace in the group, and build your new train there. If you have more consists in one group you can select them from the list on the left (see image). I guess the selected consist should have a white outline around it.

I guess code-wise it would still need a template library, but you won't see it as user, and I think it is fairly in line with the normal engine/wagon replacement menu. The only new think would be the 'new consist' row.
Attachments
replace consist.png
replace consist.png (29.8 KiB) Viewed 7084 times
replace menu.png
replace menu.png (75.17 KiB) Viewed 7084 times
mates
Engineer
Engineer
Posts: 6
Joined: 30 Dec 2005 10:11

Re: Replacing whole trains

Post by mates »

I think it's good idea. I made variant without the new consist row. It could be done in any depot, than would train appear in currently used trains. I think this is easier to implement.
Image
Attachments
Trainreplace3.png
Trainreplace3.png (30.25 KiB) Viewed 1339 times
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3426
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Replacing whole trains

Post by Emperor Jake »

This is a great idea :D For me it would be most useful in adding two or more carriages to trains, after I extend my stations as demand increases. It would also be useful for replacing MUs that require a different configuration to work or look good. Or to replace a large steamer or articulated locomotives with a pair of newer locomotives while keeping your consist. Or even if you want to replace some of the carriages in your consists, like an extra mail car. Or rearrange them. Or keep the train lengths correct if you upgrade from 5/8 length wagons to full length.

There are so many possibilities here, I really think this should be implemented. :wink:
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

Re: Replacing whole trains

Post by chickenbc »

I`m studying source codes in order to implement these features, especially 'autoreplace_gui.cpp' and 'autoreplace_cmd.cpp'.

These codes are totally only dealing with replacing engine or wagon, not both. Each replacing gui and command are work with 'EngineID', but if we want to replace whole trains, we need some other stuffs. Trains are essentially 'chains of' each vehicle. So, IMO we need to change codes quite a lot.

Also, We need to think about it : Where we save the "templates"? I think there are 3 choices.

1) Save it to settings. ( I think 'openttd.cfg' is good.)
-> Similar to copy&paste patch, I think. But it is much complex than it. Since we have so many NewGRFs. Not only each NewGRF, but also a set of NewGRFs. (For example, 'templates using 2cc Trainset' and 'templates using 2cc Trainset and NuTracks' are totally different, since the latter makes incompatible trainsets with former one.)

2) Save it to each save-files.
-> Quite reasonable... but we need to think about savefile compatibility, moreover, If we made a trainset from one game, we can`t use it for other games.

3) Do not save: Each template is generated based on the what we have in each game.
-> If we do, we don`t need to think about savefile compatibility, and so DIRTY NewGRFs... yes it is good. But We have to make at least one trainset in the game, which may be frustrating sometimes.


Give another opinions, i`ll read it, and try to make this kind of patches.... If Something goes well, I`ll post later.
broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Re: Replacing whole trains

Post by broodje »

I'd go for 3. In fact in my opinion the consist only has to be saved as long as you are replacing it. In other words, as soon as you press 'stop replacing' the whole template isn't needed anymore. Just the way it works for replacing vehicles or wagons.

I'm not to fond of saving the consist as a template, it has way to many way's it can break. (keep it simple!)
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Replacing whole trains

Post by FooBar »

I would avoid the template thing completely and limit the choice of consists to already existing trains. If you want to replace with something completely different, buy one of those in a depot first (or overhaul an existing train first, since you're replacing it anyway).

The list of available options should be filtered for duplicates and vehicles that are unavailable. The property section in the lower part should display the properties of the full consist with e.g. total power and total capacity (per cargo type).

That way I think the implementation can remain just as effective, yet simple enough to be acceptable in OpenTTD. It also can co-exist with the existing group options (also limiting consist replace to a group) and the current replace vehicle feature (with the addition of a precedence order).

While replacing trains, the easiest way is just to delete the old one, clone a new one and put the orders of the old into the new (all functions available to OpenTTD). Better would be to take existing wagons and engines into account to avoid high costs: if a certain vehicle is used in both consists, it will not be sold and re-purchased.
chickenbc
Engineer
Engineer
Posts: 29
Joined: 20 Jan 2008 05:30
Location: Seoul, Korea

Re: Replacing whole trains

Post by chickenbc »

Oh, I forgot about something.... We have save states about each trainset is in replacing or not... There is no effort not to modify savefiles, since it is impossibe.

One another choice is, mix 2 and 3 : We can replace whole train from existing trainset OR artifical trainset, which can be made in replacing window and will be saved in the savefiles.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: Replacing whole trains

Post by ffpp »

*bump*

without ever seeing this thread, I had a similar idea while playing.
Trying to implement this idea it slowly grew more sophisticated until it looked like the first picture in this post.

a few days after uploading the patch, I found this post and was astounded that this had been in the planning before and how similar the suggestion looked to what I did myself.

I thought this deserved a bump as notification on the topic ;)
Here's the patch:
http://www.tt-forums.net/viewtopic.php?f=33&t=58904

I actually cross-linked the two threads now
J0anJosep
Traffic Manager
Traffic Manager
Posts: 139
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Replacing whole trains

Post by J0anJosep »

ffpp wrote:*bump*
I thought this deserved a bump as notification on the topic ;)
Here's the patch:
http://www.tt-forums.net/viewtopic.php?f=33&t=58904
I actually cross-linked the two threads now
I really like that patch. Templates are really helpful here. They aren't really difficult and can be defined for each group.

Easier ideas as consists and others may work, but will face problems as:
- Two groups of trains with identical engines: I expand the stations for the first group of trains. I want to make trains for the first group but not for the second. So "replacing whole trains" should work for groups of vehicles (or shared orders vehicles).

To avoid templates and replacing whole trains, work with groups. For each group of vehicles (on its group statistics), define a vehicle of this group as "the template". Then, if we want the group of vehicles to be changed, we should send "the template" to depot and make the desired changes. Then, when the others vehicles of the group are on a depot, replace the whole train as a copy of "the template".

The only changes needed are:
- Save/Load: on save/load of a group, save/load "the template" vehicle of the group (or NULL if not defined). (easy)
- On autoreplace functions (probably I'm missing something):
1) when "the template of a group" changes and is send out of depot, send the rest of vehicles of the group to service and autoreplace them;
2) when "the template" reaches depot, apply global and local autoreplace (if it changes, apply 1) );
3) when autoreplace (global/local) is changed send a) only template vehicle to depot if a template is defined or b) all group vehicles if no template is defined (medium)
- GUI: define/remove template for each group, icon showing that a template is defined for a group... (easy)

I think it is an easy workaround, but to do so, you should work with groups of vehicles...
Formerly known as Juanjo
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: Replacing whole trains

Post by ffpp »

A little problem with that suggestion might be that you might have a case where many groups should contain the same kind of trains, for instance imagine a typical PAX game with many passenger lines and vehicles are grouped by line.

Then, for each single group you would need to send one train to the depot, modify it and set it as master.
With generic template trains, you can easily have multiple groups use the same kind of trains and control this from within a single gui with very few clicks.
J0anJosep
Traffic Manager
Traffic Manager
Posts: 139
Joined: 06 Aug 2011 15:51
Location: Spain

Re: Replacing whole trains

Post by J0anJosep »

ffpp wrote:A little problem with that suggestion might be that you might have a case where many groups should contain the same kind of trains, for instance imagine a typical PAX game with many passenger lines and vehicles are grouped by line.

Then, for each single group you would need to send one train to the depot, modify it and set it as master.
With generic template trains, you can easily have multiple groups use the same kind of trains and control this from within a single gui with very few clicks.
You can (temporarily) put all those vehicles into the same group.

Although I like both ideas: defining virtual templates or defining a vehicle inside a group as master.
Formerly known as Juanjo
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: Replacing whole trains

Post by ffpp »

In principal you could even combine both ideas.
Like, if a group has no template defined, use its master for replacement.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: Replacing whole trains

Post by FLHerne »

Obvious answer would be a tree of/nested groups. :wink:
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: Google [Bot], Google Adsense [Bot] and 1 guest