[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

User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: [v0.1.b] Template based train replacement r24031

Post by FooBar »

EDIT: ignore that, I've trown out my local source copy again and now it apears to be doing something else. Hang on!

EDIT2: I don't know what's up with that when I not throw out the complete source and just do "hg update discard any local changes". But anyways, now it works. Build is attached!
Attachments
openttd-template-based-train-replacement-v0.2-r24054-windows-win32.zip
(5.94 MiB) Downloaded 220 times
Last edited by FooBar on 21 Mar 2012 17:53, edited 1 time in total.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.1.b] Template based train replacement r24031

Post by ffpp »

Wowanxm wrote:It would be great to let the player choose in what depot ro to replace train.
Futhermore, it might be interesting feature if we could insert replacement procedure as a specific order in the train's timetable.
So you want to use it for automatic coupling and decoupling of trains along their route.
Like:
sawmill ----- wood -----> furniture factory ----- goods ------> town
Arie-
Director
Director
Posts: 593
Joined: 20 Jan 2009 16:07

Re: [v0.2] Template based train replacement r24054

Post by Arie- »

Wow, that would indeed be a possibility, and when wagons aren't available in that depot, they'd have to be built. When you leave wagons in a depot, they just stay there. Than you could buy a specific engine which you use to transport empty wagons back to the depots manually where they are needed.
I like where this is going :roll:
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.1.b] Template based train replacement r24031

Post by ffpp »

FooBar wrote:EDIT: ignore that, I've trown out my local source copy again and now it apears to be doing something else. Hang on!

EDIT2: I don't know what's up with that when I not throw out the complete source and just do "hg update discard any local changes". But anyways, now it works. Build is attached!
great, thanks
I still didn't get around to install msvs on my computer
________________________________________________

I just deleted and uploaded the tbtr_v0.2.patch file. It is a hotfixed version because after some restructuring some code I had an oversight in some testcase which I only found while play-testing just now.
(It was: if the incoming train cannot be replaced because of a lack of money and was set to 'service in depot' it wouldn't leave the depot in this particular case)
So for all who downloaded the newest version, please download it again. Sorry :/
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [v0.2] Template based train replacement r24054

Post by Lord Aro »

I got bored.
Have a linux binary

[out of date, removed]

(and a build log)
build.log.txt
(86.43 KiB) Downloaded 225 times
EDIT: Build out of date,so i removed it, i'll try to put a new one up shortly
Last edited by Lord Aro on 22 Mar 2012 10:07, edited 1 time in total.
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2] Template based train replacement r24054

Post by ffpp »

Lord Aro wrote:I got bored.
Have a linux binary
tbtr_v0.2.zip
(and a build log)
build.log.txt
Is this build based on the hotfixed version ?
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: [v0.2] Template based train replacement r24054

Post by Lord Aro »

based on patch in the first post

(i had some troubles patching, [my own, not yours] if it matters)
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: [v0.1.b] Template based train replacement r24031

Post by Zuu »

ffpp wrote:I just deleted and uploaded the tbtr_v0.2.patch file. It is a hotfixed version because after some restructuring some code I had an oversight in some testcase which I only found while play-testing just now.
(It was: if the incoming train cannot be replaced because of a lack of money and was set to 'service in depot' it wouldn't leave the depot in this particular case)
So for all who downloaded the newest version, please download it again. Sorry :/
Always increase the version number if you replace the patch. You could add a "b" like you did before if you don't want to go a full step. By doing so you reduce the risk of people referring to different versions but with the same version name.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2] Template based train replacement r24054

Post by ffpp »

Yes, should have done that ;)
Now there is another hotfix up anyways, as an attachement in the first post.

I found another problem during playtesting where a train for which the primary engine didn't need to get replaced was put into the default group during replacement.
This was due to the same code restructuring that made the v0.2b hotfix necessary before.

________

Edit: now with newest build for testing (linux only so far, sorry) -> first post
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2c] Template based train replacement r24055

Post by ffpp »

thanks, I put it in the first post and will maintain that link for current versions in the future
User avatar
Wowanxm
Engineer
Engineer
Posts: 28
Joined: 09 Jul 2010 18:07
Location: Minsk, Belarus
Contact:

Re: [v0.1.b] Template based train replacement r24031

Post by Wowanxm »

ffpp wrote:So you want to use it for automatic coupling and decoupling of trains along their route.
Like: sawmill ----- wood -----> furniture factory ----- goods ------> town
Moreover. It could be possible to use it for loco change. Like:
STATION A ===== electrified line ===== STATION B === Depot/replace loco ------ non-electrified line ------ STATION C.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.1.b] Template based train replacement r24031

Post by ffpp »

Wowanxm wrote:
ffpp wrote:So you want to use it for automatic coupling and decoupling of trains along their route.
Like: sawmill ----- wood -----> furniture factory ----- goods ------> town
Moreover. It could be possible to use it for loco change. Like:
STATION A ===== electrified line ===== STATION B === Depot/replace loco ------ non-electrified line ------ STATION C.
In that instance, what would the electrified train components do at station b ? stay there or form a new train that goes back to station one ?
Because if you want to change trains up so heavily it might be solvable more easily by just running two different trains.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2c] Template based train replacement r24055

Post by ffpp »

I just realized how annoying it is to create a template that is almost a copy of some running real train (if you want to make only a very slight modification).
So a good next feature would be to clone a template from an actual train and then modify it further.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: [v0.2d] Template based train replacement r24055

Post by FLHerne »

I just realized how annoying it is to create a template that is almost a copy of some running real train (if you want to make only a very slight modification).
So a good next feature would be to clone a template from an actual train and then modify it further.
I was just going to suggest that! :roll:
In that instance, what would the electrified train components do at station b ? stay there or form a new train that goes back to station one ?
Because if you want to change trains up so heavily it might be solvable more easily by just running two different trains.
I'd use this as: Electric loco + 7 carriages -> Depot -> Diesel loco + 7 carriages -> Depot -> Electric loco + 7 carriages...repeat
Leave the electric loco in the depot, then exchange again in the other direction. Would be nice if possible, would make no sense with multiple units instead of individual locos.
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.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2d] Template based train replacement r24055

Post by ffpp »

FLHerne wrote:
I just realized how annoying it is to create a template that is almost a copy of some running real train (if you want to make only a very slight modification).
So a good next feature would be to clone a template from an actual train and then modify it further.
I was just going to suggest that! :roll:
Certain things come to mind only when using the new pieces in a bigger context I guess ;)
That's why there are already a couple of improvements/extensions to the core principal are on my todo list.
FLHerne wrote:
In that instance, what would the electrified train components do at station b ? stay there or form a new train that goes back to station one ?
Because if you want to change trains up so heavily it might be solvable more easily by just running two different trains.
I'd use this as: Electric loco + 7 carriages -> Depot -> Diesel loco + 7 carriages -> Depot -> Electric loco + 7 carriages...repeat
Leave the electric loco in the depot, then exchange again in the other direction. Would be nice if possible, would make no sense with multiple units instead of individual locos.
I was already thinking about that idea and it isn't very high on my list right now. But it should certainly be possible to use the generic replacement mechanism to reorganize trains along their set of orders.
It would not be convenient to issue such orders from the current template replacement gui. I think the main gui should still be used to create templates and the order window could call the list of defined templates as a child-window when so chosen. Like it is done with the refit-orders.

But before I want to go into any such direction I want to make sure that the main things are easy to use and get confident that everything is working as intended. There is also a lot of cleaning up code to do before I want to add anything new to the mess :)
User avatar
Wowanxm
Engineer
Engineer
Posts: 28
Joined: 09 Jul 2010 18:07
Location: Minsk, Belarus
Contact:

Re: [v0.1.b] Template based train replacement r24031

Post by Wowanxm »

ffpp wrote:In that instance, what would the electrified train components do at station b ? stay there or form a new train that goes back to station one ?
It depends on what you're planning to do with carriages at a depot. If we loose cargo when replacing the loco/train (new train => empty wagons), then it'll be useful to get train unload at Station B. And load renewed train at that station after replacement.
If something like this would sometines appear in OpenTTD, then carriages will just stay at station B while electric loco is being replaced at depot.
ffpp wrote:Because if you want to change trains up so heavily it might be solvable more easily by just running two different trains.
Yes, it might be solved now by using two trains. But it is not very realistic. Long-distance trains (espesially passenger trains) change locos, not wagons on their route.
Eddi
Tycoon
Tycoon
Posts: 8254
Joined: 17 Jan 2007 00:14

Re: [v0.2d] Template based train replacement r24055

Post by Eddi »

currently, OpenTTD moves the cargo to the new wagons on autoreplace. (as long as there is enough space)
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.2d] Template based train replacement r24055

Post by ffpp »

The cargo transfer is not yet handled by my patch but is one of the next things to be done. It's one of those essential things to make the patch really useful.
User avatar
ffpp
Engineer
Engineer
Posts: 125
Joined: 29 Jan 2010 12:56

Re: [v0.1.b] Template based train replacement r24031

Post by ffpp »

Wowanxm wrote:
ffpp wrote:In that instance, what would the electrified train components do at station b ? stay there or form a new train that goes back to station one ?
It depends on what you're planning to do with carriages at a depot. If we loose cargo when replacing the loco/train (new train => empty wagons), then it'll be useful to get train unload at Station B. And load renewed train at that station after replacement.
If something like this would sometines appear in OpenTTD, then carriages will just stay at station B while electric loco is being replaced at depot.
ffpp wrote:Because if you want to change trains up so heavily it might be solvable more easily by just running two different trains.
Yes, it might be solved now by using two trains. But it is not very realistic. Long-distance trains (espesially passenger trains) change locos, not wagons on their route.
I put it into the todo list as an advanced feature once the main things are done well.


____________________________________________________________________________________________________

Dear diary,

the new patch for today is up. Files and changelog are included in in the first post, a fresh new screenshot for those too lazy to download and try the patch has been added as well.
TODO-list is growing faster than DONE-list :(

best
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests