[v2.1.0] Template based train replacement [OpenTTD 1.9.3]

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

HapticTactic
Engineer
Engineer
Posts: 23
Joined: 15 Mar 2019 19:56

Posibility to replace wagons only?

Post by HapticTactic » 15 Mar 2019 20:02

Hello, I am new here but I have been playing OTTD for quite some time now :-)

I love this feature!

I have a question:

Is it possible to create a template that would replace only wagons for all trains in a given group? Let's say I have a train that has an obsolete engine which is not available anymore and I want to keep that engine and just remove or add wagons according to the template. Is it possible to do that somehow?

Thank you!

Best regards

McZapkie
Tycoon
Tycoon
Posts: 1176
Joined: 18 Jan 2014 18:10

Re: [v2.0.0] Template based train replacement

Post by McZapkie » 15 Mar 2019 21:23

Generally good idea, to have possibility of cloning consist regardless of any vehicles accessibility.
Sometimes I need to make action similar to HapticTactic, or opposite (keep wagons, change locomotive, or just add/rearrange wagons), but it is not possible to create new template.
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.

User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: Posibility to replace wagons only?

Post by ffpp » 16 Mar 2019 12:18

HapticTactic wrote:Hello, I am new here but I have been playing OTTD for quite some time now :-)

I love this feature!

I have a question:

Is it possible to create a template that would replace only wagons for all trains in a given group? Let's say I have a train that has an obsolete engine which is not available anymore and I want to keep that engine and just remove or add wagons according to the template. Is it possible to do that somehow?

Thank you!

Best regards
Hi!

that is possible, but you need to have an existing template which contains this obsolete engine.
You can always create a new template from an existing train by cloning it, so if you have some train with the old engine, you should be able to create a template containing the old engine.
You can then modify it to contain the new model wagons. Just select the template from the list and click "Delete last engine" to remove the old wagons from the template, select a new type of wagon from the engines list on the left and click "Add engine" to add it to the selected template.
With that template you can keep the old loco around.

I just tried to test it but couldn't because the old engines wouldn't expire when I cheated the date from 1900 to 2050... I tried with the default engine set and with the UKRS 2.0 train set. Do you have an example of a newgrf where the engines are set to expire?

McZapkie
Tycoon
Tycoon
Posts: 1176
Joined: 18 Jan 2014 18:10

Re: Posibility to replace wagons only?

Post by McZapkie » 16 Mar 2019 18:31

ffpp wrote: You can always create a new template from an existing train by cloning it, so if you have some train with the old engine, you should be able to create a template containing the old engine.
Actually it is not possible (at least for patch version implemented in JGRPP) to make new template by cloning existing train with expired vehicles.
The question is, if it is possible to fix it, or maybe such assertion is deeply build into copy function?
My experimental openTTD server: 149.156.194.203:3979 non-standard client, now testing: JGRPP http://tiny.pl/ggnch
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, preindustrial houses, wired, ECS industry extension, V4 CEE train set.
Addicted to freeciv longturn.

User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: Posibility to replace wagons only?

Post by ffpp » 17 Mar 2019 07:27

McZapkie wrote:
ffpp wrote: You can always create a new template from an existing train by cloning it, so if you have some train with the old engine, you should be able to create a template containing the old engine.
Actually it is not possible (at least for patch version implemented in JGRPP) to make new template by cloning existing train with expired vehicles.
The question is, if it is possible to fix it, or maybe such assertion is deeply build into copy function?
Ah I see, JGRPP is using an older version of the patch. I reworked a lot of things for version 2.0.0. In that version what you described works just fine.
For 2.0.0 I had made a pull request into the openttd's master branch. I am working on this integration at the moment. But I can also try to see with JGR whether an update of tbtr in his PP would be an option as well.

Anyways, thanks for pointing this out.

HapticTactic
Engineer
Engineer
Posts: 23
Joined: 15 Mar 2019 19:56

Re: Posibility to replace wagons only?

Post by HapticTactic » 17 Mar 2019 15:26

ffpp wrote:
McZapkie wrote:
ffpp wrote: You can always create a new template from an existing train by cloning it, so if you have some train with the old engine, you should be able to create a template containing the old engine.
Actually it is not possible (at least for patch version implemented in JGRPP) to make new template by cloning existing train with expired vehicles.
The question is, if it is possible to fix it, or maybe such assertion is deeply build into copy function?
Ah I see, JGRPP is using an older version of the patch. I reworked a lot of things for version 2.0.0. In that version what you described works just fine.
For 2.0.0 I had made a pull request into the openttd's master branch. I am working on this integration at the moment. But I can also try to see with JGR whether an update of tbtr in his PP would be an option as well.

Anyways, thanks for pointing this out.
Excellent. Thank you for your time. I will try my lobbying skills with JGR to include the latest version of your patch in his pack! :-)))))

HapticTactic
Engineer
Engineer
Posts: 23
Joined: 15 Mar 2019 19:56

Re: [v2.0.0] Template based train replacement

Post by HapticTactic » 27 Mar 2019 18:59

ffpp, I have asked JGR about updating the template feature. I was under the impression that he uses directly your code but it seems to be more complicated. See our conversation about it:
HapticTactic wrote:Hi guys, hi JGR!

...

I have a question about ffpp's "Template based train replacement" patch you are using in your pack. Would it be possible for you to update it to the latest version with your next or future JGRPP updates? There is at least one crucial feature in the latest version of "ffpp's TBTR" that I would, personally, love to see in the game. It allows for creating template clones from trains that contain obsolete vehicles. The version you are using currently in JGRPP does not allow this. It would be an extremely useful feature for us who love to play with the templates feature.

...
JGR wrote: The implementation of TBTR which I have is loosely based on https://github.com/flitzpiepe/OpenTTD_T ... d82a6a59aa partly updated to match KeldorKatarn's fork (JokerPP) (971ba4928a5c7c7916fea55d91a3b6dd5bba140c), with a few dozen changes/fixes on top.
The commit in KeldorKatarn's branch is now gone as he periodically rebased it.
I don't know what version this may correspond to in terms of the forum thread.
Enabling creating templates with obsolete vehicles seems doesn't seem like a big change. If there is a commit where it's implemented and it is compatible I could cherry pick it, otherwise I can look into the possibility of implementing it directly in due course.
I am a bit lost at the moment in who did what etc and what would be the easiest way for JGR to update the feature.

User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v2.0.0] Template based train replacement

Post by ffpp » 28 Jul 2019 07:20

At the moment I am ironing out some issues with the current version and I would like to add 2 small features than I will have another go at having the patch merged into the trunk of openttd. Then it could just be removed JGR's patch.
But of course it would be better to have the newer version of TBTR used by other people to spot possible bugs before requesting the trunk merge.

User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v2.1.0] Template based train replacement [OpenTTD 1.9.3]

Post by ffpp » 08 Oct 2019 16:54

New version 2.1.0 released.

New features:
- templates can be refitted (whole chain or just single vehicles)
- can select individual template vehicles for easier modification of templates
- can double click on an engine to create new template or add it to the currently selected one
- small fixes here+there
- merged against the latest stable version of openttd, 1.9.3

Linux binaries + screenshot in the OP

Feedback would be great, btw :]

gGeorg
Engineer
Engineer
Posts: 6
Joined: 02 Apr 2019 01:17

Re: [v2.1.0] Template based train replacement [OpenTTD 1.9.3]

Post by gGeorg » 24 Oct 2019 20:12

Hello,

I was needing this functionality for years, well decades :D.
However, I dont know how-where to activate this patch.
Didnt find it on the online content feature, on the GIT page I am lost. Is there some easy way to use it?
Win7 user

Thx

User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v2.1.0] Template based train replacement [OpenTTD 1.9.3]

Post by ffpp » 25 Oct 2019 16:48

kamnet wrote:
25 Oct 2019 04:01
gGeorg wrote:
24 Oct 2019 20:12
Hello,

I was needing this functionality for years, well decades :D.
However, I dont know how-where to activate this patch.
Didnt find it on the online content feature, on the GIT page I am lost. Is there some easy way to use it?
Win7 user

Thx
https://wiki.openttd.org/Patches
Hi,

to enable the feature in the game:


from the train groups gui, under "Manage List" and select "Template Replacement".

use the key combination [ctrl] + [e].

Did you get it to work?

gGeorg
Engineer
Engineer
Posts: 6
Joined: 02 Apr 2019 01:17

Re: [v2.1.0] Template based train replacement [OpenTTD 1.9.3]

Post by gGeorg » 28 Oct 2019 13:41

ffpp wrote:
25 Oct 2019 16:48
kamnet wrote:
25 Oct 2019 04:01
gGeorg wrote:
24 Oct 2019 20:12
Hello,

I was needing this functionality for years, well decades :D.
However, I dont know how-where to activate this patch.
Didnt find it on the online content feature, on the GIT page I am lost. Is there some easy way to use it?
Win7 user

Thx
https://wiki.openttd.org/Patches
Hi,

to enable the feature in the game:


from the train groups gui, under "Manage List" and select "Template Replacement".

use the key combination [ctrl] + [e].

Did you get it to work?
The main problem is, how to install the patch, not how to find it in the UI.
I founded there is an JGRs multipatch whiich combines some other patches. Unfortunately, this also changes lot other things.
But yes, thanks to JGR I finaly make it work, and your tool does exactly what I wanted.
It iis a shame that this part of UI isnt included int the main game build.
It would be greate if you could add latest OTTD version + your_patch = compiled.exe for windows.
Its beond most people skill to prepare this before gameplay.

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 6 guests