[v2.1.0] Template based train replacement [OpenTTD 1.9.3]
Moderator: OpenTTD Developers
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
Thanks for your feedback ffpp!
Yes, the clone button is a good choice to clone templates. In my opinion this is the only choice.
> - During the creation of a template, it is complicated to get an engine to be the first vehicle in the chain: this is also the same when dealing with a train in a depot, only that there you have multiple lines available to make things easier. Should be improved as well.
The behavior is diffent from the depot. I am trying to create some screenshots later.
Yes, the clone button is a good choice to clone templates. In my opinion this is the only choice.
> - During the creation of a template, it is complicated to get an engine to be the first vehicle in the chain: this is also the same when dealing with a train in a depot, only that there you have multiple lines available to make things easier. Should be improved as well.
The behavior is diffent from the depot. I am trying to create some screenshots later.
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
Look at the screen shots below. I have tried to document the facts in this way.
While creating the screen shots I pressed for few seconds the Ctrl key (+S). I held a waggon. When I release the (mouse or ctrl?) button, I got the following error message.
This happened one time. I can not reproduce it again.
While creating the screen shots I pressed for few seconds the Ctrl key (+S). I held a waggon. When I release the (mouse or ctrl?) button, I got the following error message.
Code: Select all
Assertion failed at line 67 of src/train_gui.cpp: selection != INVALID_VEHICLE
- Attachments
-
- 01-try-to-move-first.png (16.2 KiB) Viewed 12622 times
-
- 02-move-forward-one-by-one.png (19.78 KiB) Viewed 5779 times
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
Oh yes, I've seen another little problem. Look at the screen shot(s) again.
- Attachments
-
- waggons-overlap.png (12.73 KiB) Viewed 12619 times
Re: [v0.4c] Template based train replacement r24093
@Eisenbaehr,
I checked the things you mentioned.
- You're right, the main gui needs the ability to scroll horizontally, I didn't notice this yet because my game settings don't allow for such long trains
- moving template vehicles inside the chain vs depot movement: I'm not sure if I understand you.
I think you mean that you cannot make a template vehicle the new head of its chain by moving it to the front. But this is the case for the real trains inside a depot as well. You cannot make a vehicle != first the new head of the chain, you have to make it the second vehicle and then move the current head backwards. Just tried it. Please correct me if you where meaning something else.
- I will look at the savegame with the crash, maybe it happens again for me.
I checked the things you mentioned.
- You're right, the main gui needs the ability to scroll horizontally, I didn't notice this yet because my game settings don't allow for such long trains
- moving template vehicles inside the chain vs depot movement: I'm not sure if I understand you.
I think you mean that you cannot make a template vehicle the new head of its chain by moving it to the front. But this is the case for the real trains inside a depot as well. You cannot make a vehicle != first the new head of the chain, you have to make it the second vehicle and then move the current head backwards. Just tried it. Please correct me if you where meaning something else.
- I will look at the savegame with the crash, maybe it happens again for me.
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
> I did not notice this yet because my game settings do not allow for searching long trains
Long? The trains have 30 cars only
The move ... I think you misunderstood me, unfortunately. The problem is really very striking. So I think it might be due to NewGRF Train Set. However, there are no problems in the depot.
By, for example Cloning, is a train correctly in the template. The locomotive is at the start, the cars behind it.
If I simply click on a wagon, for example the 5th, the locomotive will be placed in this position. Now I have to click five times on a wagon behind the locomotive to get right back in the first place. It works no other way to do this.
The next time I make a video
Long? The trains have 30 cars only
The move ... I think you misunderstood me, unfortunately. The problem is really very striking. So I think it might be due to NewGRF Train Set. However, there are no problems in the depot.
By, for example Cloning, is a train correctly in the template. The locomotive is at the start, the cars behind it.
If I simply click on a wagon, for example the 5th, the locomotive will be placed in this position. Now I have to click five times on a wagon behind the locomotive to get right back in the first place. It works no other way to do this.
The next time I make a video
Re: [v0.4c] Template based train replacement r24093
I would say a train with 30 cars is pretty long...Eisenbaehr wrote:>Long? The trains have 30 cars only
Re: [v0.4c] Template based train replacement r24093
As long as the engine can still pull itEisenbaehr wrote: Long? The trains have 30 cars only
Ah, I know now what is going on... This is a known bug/stupidity which annoyed me such much as well, that I corrected it immediately for my playtesting version but it is not included in the v0.4c. But this bug will be gone in the next release. This is also the reason why I didn't understand you, I had totally forgotton that this issue was there in the last release version.Eisenbaehr wrote: By, for example Cloning, is a train correctly in the template. The locomotive is at the start, the cars behind it.
If I simply click on a wagon, for example the 5th, the locomotive will be placed in this position. Now I have to click five times on a wagon behind the locomotive to get right back in the first place. It works no other way to do this.
No need !Eisenbaehr wrote: The next time I make a video
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
Du Humpen!
Thx for the facility!
Btw.: ?? A 30-car long train is completely normal? Where do you live that you think this is not normal?? (Max. 250 axes or 700 meters.)
This old one has 21-23 (?) cars, 30-32 (?) cars, over 40 cars.
Thx for the facility!
Btw.: ?? A 30-car long train is completely normal? Where do you live that you think this is not normal?? (Max. 250 axes or 700 meters.)
This old one has 21-23 (?) cars, 30-32 (?) cars, over 40 cars.
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
Now you can easily de- or increase the transported volumes by move a train (with Ctrl to get the complete route) from one to another group with a different template. Very very nice
But, I'm very afraid to say that there is the next assertiation-problem.
First a few words about a few priority issues.
To scrolling is dirty by click on an arrow of the scroll bar or mouse wheel.
You should disable sorting on template-id. It is better to sort by creation time. Or new templates never get old template-ids (auto increment).
When old templates will be deleted, there are many holes. Now, new templates created, they are scattered everywhere. But this is only a very small problem.
Now to the assert-problem.
I had used the Replace All Templates-Function. By the NewGRF Train Set, there are two cars with the same name. "Schüttgutwagen" One for 80 and 120 km/h. In the interface, the difference was not seen, unfortunately. Whatever... first, I selected on the left side, so I think, the wrong car and clicked Replace All. Nothing happened. I chose the other, and clicked again on Replace All. What I chose on the right I can not remember. I selected Apply and the stone get to run... Maybe this has nothing to do with the error. But maybe it helps somehow.
In the attachment is the savegame before the assertiation fails.
First, pause game and stop all trains. Goto train 110. Let him go.
Train 110 will now go into the depot. When he arrived, so it crashes.
You will find most NewGRFs that I used here.
Please make a note of this post. I forgot that the error happened before. I wondered just why this is so familiar to me.
But, I'm very afraid to say that there is the next assertiation-problem.
First a few words about a few priority issues.
To scrolling is dirty by click on an arrow of the scroll bar or mouse wheel.
You should disable sorting on template-id. It is better to sort by creation time. Or new templates never get old template-ids (auto increment).
When old templates will be deleted, there are many holes. Now, new templates created, they are scattered everywhere. But this is only a very small problem.
Now to the assert-problem.
Code: Select all
Assertion failed at line 535 of src/aaa_template_vehicle_func.cpp: !part_of_chain || new_head->IsPrimaryVehicle()
In the attachment is the savegame before the assertiation fails.
First, pause game and stop all trains. Goto train 110. Let him go.
Train 110 will now go into the depot. When he arrived, so it crashes.
You will find most NewGRFs that I used here.
Please make a note of this post. I forgot that the error happened before. I wondered just why this is so familiar to me.
Re: [v0.4c] Template based train replacement r24093
I also noticed some bugs but fortunately I was able to extract some cases where exactly those bugs happen. So I can actually fix them
For example: Please don't use the ReplaceAll-Function as of now. It felt stable when I developed it but it seems my test cases weren't sufficient at all back then.
Another problem seems to be (for me at least) that when templates get switched around or changed, normally the [group->replacement->template]-connotations are being kept consistent. But with regards to multiple railtypes this seems to be lacking in some instances. Which leads to trains trying to use a nonexisting template which will lead to segfaults. (If the main gui says 'uses template of different railtype', better check if there really *is* a different railtype which has a legal template set of the selected group).
All this will be fixed in the future of course, I'm just very short on time at the moment.
For example: Please don't use the ReplaceAll-Function as of now. It felt stable when I developed it but it seems my test cases weren't sufficient at all back then.
Another problem seems to be (for me at least) that when templates get switched around or changed, normally the [group->replacement->template]-connotations are being kept consistent. But with regards to multiple railtypes this seems to be lacking in some instances. Which leads to trains trying to use a nonexisting template which will lead to segfaults. (If the main gui says 'uses template of different railtype', better check if there really *is* a different railtype which has a legal template set of the selected group).
All this will be fixed in the future of course, I'm just very short on time at the moment.
-
- Engineer
- Posts: 62
- Joined: 29 May 2006 06:59
- Location: Germany
Re: [v0.4c] Template based train replacement r24093
> If the main gui says 'uses template of different railtype', better check if there really *is* a different railtype which has a legal template set of the selected group
I remember that the interface was confusing. Some templates showed "uses template of different railtype" although this was not true.
> > I would say a train with 30 cars is pretty long...
>
> Btw.: ?? A 30-car long train is completely normal?
Yesterday I read an article on Wikipedia about the first railroad in the world.
The English article differs from the German. This surprises me. ...however...
http://en.wikipedia.org/wiki/Stockton_a ... operations
> ...in 1863 that, for the inaugural run, a locomotive pulling 33 waggons...
http://de.wikipedia.org/wiki/Stockton_a ... Lokomotive
> Am 26. September 1825 fanden Probefahrten und am darauf folgenden 27. September die Jungfernfahrt statt. Der Zug bestand aus 36 Wagen...
> On 26 September 1825 were trial runs and the following 27th September, the maiden voyage instead. The train consisted of 36 cars ...
I remember that the interface was confusing. Some templates showed "uses template of different railtype" although this was not true.
> > I would say a train with 30 cars is pretty long...
>
> Btw.: ?? A 30-car long train is completely normal?
Yesterday I read an article on Wikipedia about the first railroad in the world.
The English article differs from the German. This surprises me. ...however...
http://en.wikipedia.org/wiki/Stockton_a ... operations
> ...in 1863 that, for the inaugural run, a locomotive pulling 33 waggons...
http://de.wikipedia.org/wiki/Stockton_a ... Lokomotive
> Am 26. September 1825 fanden Probefahrten und am darauf folgenden 27. September die Jungfernfahrt statt. Der Zug bestand aus 36 Wagen...
> On 26 September 1825 were trial runs and the following 27th September, the maiden voyage instead. The train consisted of 36 cars ...
Re: [v0.4c] Template based train replacement r24093
Yes, I'm currently looking for more instances during playing where this happens because during the more basic tests before the last release I didn't notice any such behaviour.Eisenbaehr wrote:> If the main gui says 'uses template of different railtype', better check if there really *is* a different railtype which has a legal template set of the selected group
I remember that the interface was confusing. Some templates showed "uses template of different railtype" although this was not true.
The only thing I would say against 30-cars long trains would be that it might not make too much sense with regards to the map size. I image it to look a bit weird when a train's length already covers half the distance between two cities.Eisenbaehr wrote: > > I would say a train with 30 cars is pretty long...
>
> Btw.: ?? A 30-car long train is completely normal?
Yesterday I read an article on Wikipedia about the first railroad in the world.
The English article differs from the German. This surprises me. ...however...
http://en.wikipedia.org/wiki/Stockton_a ... operations
> ...in 1863 that, for the inaugural run, a locomotive pulling 33 waggons...
http://de.wikipedia.org/wiki/Stockton_a ... Lokomotive
> Am 26. September 1825 fanden Probefahrten und am darauf folgenden 27. September die Jungfernfahrt statt. Der Zug bestand aus 36 Wagen...
> On 26 September 1825 were trial runs and the following 27th September, the maiden voyage instead. The train consisted of 36 cars ...
I like to play with a 4x cargo weight multiplier, btw. This gives a stronger role to the slow-but-strong freight engines and also gives incentive to use multiple engines per train even later in the game.
Re: [v0.4c] Template based train replacement r24093
Having been away from OpenTTD for a while I find this a very interesting patch I'd like to try out.
I did actually about 5 years ago suggest that the current way of handling trains/routes which are more or less vehicle/set based should be changed to route based, and I guess this is as close as it gets:
"Routes" primary way to handle traffic: http://www.tt-forums.net/viewtopic.php?f=32&t=34086
I did actually about 5 years ago suggest that the current way of handling trains/routes which are more or less vehicle/set based should be changed to route based, and I guess this is as close as it gets:
"Routes" primary way to handle traffic: http://www.tt-forums.net/viewtopic.php?f=32&t=34086
Re: [v0.4c] Template based train replacement r24093
Hello and thanks,
I've been away from the project for some time due to finishing my diploma and starting to work but I kept it in the back of my head that there are things left to do and things left to fix here.
I definitely want to finish and refine it and propose it for trunk integration once I meet the needed criteria.
I've been away from the project for some time due to finishing my diploma and starting to work but I kept it in the back of my head that there are things left to do and things left to fix here.
I definitely want to finish and refine it and propose it for trunk integration once I meet the needed criteria.
Re: [v0.4c] Template based train replacement r24093
Good to know it isn't abandoned, it's become almost indispensable to me now I've got used to relying on it .ffpp wrote:I've been away from the project for some time due to finishing my diploma and starting to work but I kept it in the back of my head that there are things left to do and things left to fix here.I definitely want to finish and refine it and propose it for trunk integration once I meet the needed criteria.
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.
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.
Re: [v0.4c] Template based train replacement r24093
Finally resuming this.
I updated the first post with a plan/tasks for version0.5, namely:
- move the current version (v.0.4c) to newest trunk
- move to git
- split patch in smaller sub-patches
I updated the first post with a plan/tasks for version0.5, namely:
- move the current version (v.0.4c) to newest trunk
- move to git
- split patch in smaller sub-patches
Re: [v0.4c] Template based train replacement r24093
It's good to see this patch back in development, I found it really useful for dealing with UKRS!
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.
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.
Re: [v0.4c] Template based train replacement r24093
I fixed it up to compile against the newest trunk, it wasn't even that much work. I discovered that I couldn't make it compatible to trunk and cargodist at the same time anymore, but it is only a tiny fix that is necessary to get the trunk version to compile against cd as well.
It's in saveload.h:
where cargodist also has apended two items of its own. So this must be integrated manually.
I wanted to apply for getting my patch into trunk any time in the future but there is most likely a lot of work ahead for that to happen.
I've set up a git repository which will help in splitting the code up into reviewable sizes and I'm currently cleaning this up from debugging-leftovers and such.
There should still be instances of bad coding style inside, like using command functions not via the DoCommand() wrapper but rather directly. And I have to think about network-safety too.
Patch v0.5 will be simply a recent trunk-compilable one, with another version integrated into cargodist.
It's in saveload.h:
Code: Select all
/** Type of reference (#SLE_REF, #SLE_CONDREF). */
enum SLRefType {
REF_ORDER = 0, ///< Load/save a reference to an order.
REF_VEHICLE = 1, ///< Load/save a reference to a vehicle.
REF_STATION = 2, ///< Load/save a reference to a station.
REF_TOWN = 3, ///< Load/save a reference to a town.
REF_VEHICLE_OLD = 4, ///< Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
REF_ROADSTOPS = 5, ///< Load/save a reference to a bus/truck stop.
REF_ENGINE_RENEWS = 6, ///< Load/save a reference to an engine renewal (autoreplace).
REF_CARGO_PACKET = 7, ///< Load/save a reference to a cargo packet.
REF_ORDERLIST = 8, ///< Load/save a reference to an orderlist.
REF_STORAGE = 9, ///< Load/save a reference to a persistent storage.
REF_TEMPLATE_VEHICLE = 10, ///< Load/save a reference to a template vehicle,
I wanted to apply for getting my patch into trunk any time in the future but there is most likely a lot of work ahead for that to happen.
I've set up a git repository which will help in splitting the code up into reviewable sizes and I'm currently cleaning this up from debugging-leftovers and such.
There should still be instances of bad coding style inside, like using command functions not via the DoCommand() wrapper but rather directly. And I have to think about network-safety too.
Patch v0.5 will be simply a recent trunk-compilable one, with another version integrated into cargodist.
Re: [v0.4c] Template based train replacement r24093
A small bugreport via Trond: the crash when push template replace button in vehicle window which called from station gui.
Quick fix:
vehicle_gui.c near line 160:
And yes: it also causes crash/desync on network games, so i've disabled it.
Quick fix:
vehicle_gui.c near line 160:
Code: Select all
DropDownList *BaseVehicleListWindow::BuildActionDropdownList(bool show_autoreplace, bool show_group)
{
DropDownList *list = new DropDownList();
- if (show_autoreplace) list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, false));
+ if (show_autoreplace) {
+ if (!_networking) list->push_back(new DropDownListStringItem(STR_TMPL_TEMPLATE_REPLACEMENT, ADI_TEMPLATE_REPLACE, false));
+ list->push_back(new DropDownListStringItem(STR_VEHICLE_LIST_REPLACE_VEHICLES, ADI_REPLACE, false));
+ }
Re: [v0.4c] Template based train replacement r24093
I didn't abandon this project, but I didn't have time to come back to it yet (this happens when you start too many projects at once and have only little time after work).
I didn't take care of any network compatibility with this mod so far, either ^^
I didn't take care of any network compatibility with this mod so far, either ^^
Who is online
Users browsing this forum: No registered users and 5 guests