OpenTTD

Tasklist

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

Attached to Project: OpenTTD
Opened by FooBar (foobar) - Sunday, 19 January 2014, 10:45 GMT
Type Feature Request
Category NewGRF
Status New
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

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: https://www.tt-forums.net/viewtopic.php?p=1109187#p1109187

It would be grand if this feature could be added to the game. Thanks!
This task depends upon

Comment by Michael Blunck (mb) - Sunday, 19 January 2014, 13:33 GMT
[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 (<num>), then this specifies how much faster empty train wagons are allowed to go. The default for this is 20 km/h.
[/quote]

regards
Michael
Comment by FooBar (foobar) - Sunday, 19 January 2014, 13:42 GMT
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.
Comment by Michael Blunck (mb) - Sunday, 19 January 2014, 14:04 GMT
> 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.
Comment by FooBar (foobar) - Sunday, 19 January 2014, 14:16 GMT
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.
Comment by Michael Blunck (mb) - Sunday, 19 January 2014, 15:29 GMT
> 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.
Comment by andythenorth (andythenorth) - Thursday, 31 August 2017, 21:55 GMT
I am+1 to Michael's comments: this isn't needed. But it's not a democracy eh? :) I've left it open.
Comment by Michael Blunck (mb) - Friday, 01 September 2017, 05:53 GMT
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.
Comment by andythenorth (andythenorth) - Friday, 01 September 2017, 06:36 GMT
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  FS#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.

Loading...