OpenTTD

Tasklist

FS#6004 - Vars to check power and weight of vehicle/consist required

Attached to Project: OpenTTD
Opened by George (George) - Saturday, 03 May 2014, 06:57 GMT
Type Feature Request
Category Vehicles
Status New
Assigned To No-one
Operating System All
Severity High
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

r26438

I could not make vars E8 and E4 work (http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#_VehicleArray), so I suppose they are for TTDP only.
Because of that I URGENTLY need vars for current consist/vehicle power and weight (http://newgrf-specs.tt-wiki.net/wiki/NML:Vehicles#Vehicle_variables), as we have current_max_speed for example.
This task depends upon

Comment by frosch (frosch) - Saturday, 03 May 2014, 08:24 GMT
Var E4 is available for trains. Mind it's only valid for the front vehicle.
Comment by frosch (frosch) - Saturday, 03 May 2014, 08:29 GMT
Actually, it's F4, not E4.
Comment by frosch (frosch) - Saturday, 03 May 2014, 08:34 GMT
While OTTD actually support var F4, TTDP does not. That page from Marcin must refer to some ancient TTDP. Current TTDP has these variables:
http://projects.tt-forums.net/projects/ttdpatch/repository/entry/trunk/inc/veh.inc#L70

As such even OTTD is wrong in supporting F4. Please don't use Marcin's site.
Comment by George (George) - Saturday, 03 May 2014, 09:53 GMT
Anyway an NML property to check weight and power (even for head engine only) is necessary
Comment by George (George) - Saturday, 03 May 2014, 16:35 GMT
BTW, it would be also nice to know, if a train is accelerating or breaking.
Comment by Michael Blunck (mb) - Saturday, 03 May 2014, 20:29 GMT
> BTW, it would be also nice to know, if a train is accelerating or breaking.

Acceleration is given by TTD var 0x37 (0xB7).
Comment by George (George) - Saturday, 03 May 2014, 20:45 GMT
I can't find any information that it can be negative (breaking)
Comment by frosch (frosch) - Saturday, 03 May 2014, 21:29 GMT
Variable 4C "current_max_speed" was added for that purpose. (which can be compared to "current_speed")
It can be used to identify whether a vehicle is idling at max speed resp. is braking or whether it tries to accelerate.

IIRC there is already some vehicle set which uses that var for running cost, likely a pikka set. Or was it snail?
Comment by George (George) - Saturday, 03 May 2014, 21:42 GMT
does it mean current max speed in stations is 0?
In case it is 60 kmh how can I recognise that a train is breaking from 60 to 0 kmh?
Comment by frosch (frosch) - Saturday, 03 May 2014, 21:51 GMT
It is also affected by slowing down in stations.
However, it does not reach zero. Wrt. stopping (also at signals or due to breakdowns) you have to check the current speed for zero.
Comment by George (George) - Saturday, 03 May 2014, 22:03 GMT
So if current_max_speed < current_speed -> the train is breaking?
Comment by frosch (frosch) - Sunday, 04 May 2014, 12:26 GMT
In theory yes, but practically "braking" does not exist. In most cases braking is almost instant.
So practically there are only these cases:
"current_speed == 0" -> vehicle is waiting
"current_speed != 0 && current_speed < current_max_speed" -> vehicle is accelerating
"current_speed >= current_max_speed" -> vehicle is idling at speed limit
Comment by George (George) - Sunday, 04 May 2014, 17:17 GMT Comment by George (George) - Saturday, 18 October 2014, 10:22 GMT
4 months and no result in adding a simple patch???
Please provide the required vars
Comment by frosch (frosch) - Saturday, 18 October 2014, 15:01 GMT
Fine then, here's the list of stuff that needs to be done:
- Check when the variable changes values.
- Check what stuff (e.g. cached train variables) needs invalidating, when NewGRF decide to use weight to change properties.
- Check what advanced settings influence weight (e.g. freight weight modifier), whether they are changeable in multiplayer, and whether it is worth to forbid changing them.
- Check the use case 'running cost', whether the result is actually well-defined when using weight, or whether it depends on circular/different evaluation order.

All in all, likely 10 hours of work left.

(Personally, I do not consider a complex 'running costs' mechanics, that is most likely un-noticable in-game, worth the effort. But that's only my opinion.)

Loading...