Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trains: run speed callback on train departure or on finishing loading/unloading #5869

Closed
DorpsGek opened this issue Jan 19, 2014 · 9 comments
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

foobar opened the ticket and wrote:

What I would like to achieve is a rail wagon that has a higher speed limit when empty than when loaded.

For this I need the speed callback (CB 36), but this is not called on enough occasions to accomplish this. From my testing:

The speed callback runs:
- When a train exits the depot, and
- When a train reverses.
(Speed did not change on bridges, r26189)

What I would need for my purpose is that the callback also runs, either:
- When a train starts moving, or
- When a train finishes loading/unloading.

I've attached a test NewGRF in the TT-Forums topic which further discusses this: http://www.tt-forums.net/viewtopic.php?p=1109187# p1109187

It would be grand if this feature could be added to the game. Thanks!

Reported version: trunk
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/5869
@DorpsGek
Copy link
Member Author

mb wrote:

[FooBar]

What I would like to achieve is a rail wagon that has a higher speed limit when empty than
when loaded.

For this I need the speed callback (CB 36), [...]

This feature had been implemented in TTDPatch almost 10 years ago, and without using a special callback:

[quote="TTDPatch manual"]
WagonSpeedLimits
Limit the speed of trains with freight wagons
2.0.1 alpha 39 or later (November 15, 2004)

...

If the switch has a parameter (), then this specifies how much faster empty train wagons are allowed to go. The default for this is 20 km/h.
[/quote]

regards
Michael


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment12930

@DorpsGek
Copy link
Member Author

foobar wrote:

Interesting feature, but from what I gather that applies to all wagons, right?
I would like to set this on a per wagon basis, possibly with variable speed bonuses depending on the wagon. And certainly not for passenger carriages.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment12931

@DorpsGek
Copy link
Member Author

mb wrote:

Interesting feature, but from what I gather that applies to all wagons, right?

Yes, of course. Because in a train, the wagon with the lowest speed usually determines the speed of the whole consist.

I would like to set this on a per wagon basis, possibly with variable speed bonuses depending on the wagon.

I don´t see why you should want to do this?

And BTW, most vehicle stats are being cached for efficiency reasons, and your proposal would need a quite substantial introduction of extra occasions to run a CB.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment12932

@DorpsGek
Copy link
Member Author

foobar wrote:

Some wagons in real life allow for a higher speed when empty, others don't.

I think this is a nice addition to a vehicle set to give the purchasing of cargo wagons some more dynamic. Think for instance the choice between a wagon with a fixed speed and slightly higher capacity compared to a wagon with a higher empty-speed but slightly reduced capacity. If you have a line that takes coal to the other side of the map and returns with iron ore, you may want to go with the higher capacity. If on the other hand the train returns empty, the higher empty-speed wagon may be more beneficial.

As for the efficiency, I'm not the one to decide upon that. Let's leave that to the OpenTTD developers. If you run it additionally only on "finish loading/unloading" (i.e. "depart from station"), I think the overhead is quite limited.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment12933

@DorpsGek
Copy link
Member Author

mb wrote:

Some wagons in real life allow for a higher speed when empty, others don't.

I know. That´s why I proposed that (implemented) TTDPatch feature 10 years ago.

Think for instance the choice between a wagon with a fixed speed and slightly higher
capacity compared to a wagon with a higher empty-speed but slightly reduced capacity.
If you have a line that takes coal to the other side of the map and returns with iron ore, you
may want to go with the higher capacity. If on the other hand the train returns empty, the
higher empty-speed wagon may be more beneficial.

Honestly, IMO this is "rivet counting" at its best. Especially because it doesn´t come "for free", but needs additional use of callbacks and whatnot. And most of the time, trains in TTD are "block trains" anyway, and hence the requested behaviour could be modelled by the old "waggonspeed limit" feature as well.

As for the efficiency, I'm not the one to decide upon that. Let's leave that to the OpenTTD
developers.

Well, I have my reservations to that point. Most of the time OTTD´s "nomenklatura" likes to talk bad about the (once inherited) newGRF feature at all, but OTOH a lot of additional newGRF features with very limited scope (or questionable benefit) has been added in recent times. Most of the time, I see myself between these extreme positions, prefering to act restrictively with regards to "new proposals" when in doubt.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment12934

@DorpsGek
Copy link
Member Author

andythenorth wrote:

I am+1 to Michael's comments: this isn't needed. But it's not a democracy eh? :) I've left it open.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment14687

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 1, 2017

mb wrote:

This is not needed. I´m achieving the desired effect in DBXL 0.9 by a combination of CB36 both for wagons and engines. O/c, this is still overhead, rather than just getting that old TTDPatch feature. S.a.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment14690

@DorpsGek
Copy link
Member Author

DorpsGek commented Sep 1, 2017

andythenorth wrote:

What's different in the cb36 for ships than trains? Squid grf runs ships faster empty, based on load state, in retrospect it's a BAD FEATURE, but eh, can't win them all. For ships, the station trigger on cb36 seems reliable enough.

Note also in #6249, George asks specifically for the values to be re-cached on leaving station, not just triggered. That's a more precise variant of this request, so I closed # 6249 as duplicate, but the specific detail needs to be noted here.


This comment was imported from FlySpray: https://bugs.openttd.org/task/5869#comment14691

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) component: NewGRF This issue is related to NewGRFs enhancement labels Apr 7, 2018
@andythenorth
Copy link
Contributor

Let's close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

2 participants