Moderator: Graphics Moderators
Then I coded it to have 0 power after it reached a certain speed. This didn't work, the power only changing after it moved to a different railtype or it was told to stop/start. There may be other triggers I don't know about but there are some properties that can't change on the fly effectively; length, power, capacity etc
You are reverse-engineering when OpenTTD runs the callbacks. Generally: they are only run when appropriate - they are computationally expensive. Thus different callbacks are triggered by different situations or situation changes only, some are called regularily every X game ticks..Ruiluth wrote:As an experiment, I created a locomotive whose power and tractive effort vary with its speed, as described herel. (TL;DR, a steam locomotive is a constant force machine up to a certain speed, and after that becomes a constant power machine.) However, something I'm noticing in tests is that the tractive effort and power don't update during running. Running cost does as it should, but for some reason, power and tractive effort are frozen at their 0 mph levels from the moment it leaves the depot until it returns. Is this just a quirk of NML or OpenTTD, or is there something I can do to make this work?
Not all properties can change at all times - by design. In other words: a callback needs being called to take any effect - and not every callback is called at all times, but only when OpenTTD calls it upon the vehicle
Properties affecting the motor of a vehicle only can change when in depot or when the tracktype changes. A running vehicle neither realistically nor ingame can change its maximum power, its tractive effort, etc when it is running - it is an inherent property determined by the motor and the environment - both do not change. It's OpenTTD's job to take the vehicle properties and move it according to that. And that includes limiting acceleration by either available power or tractive effort. IIRC that's already done - for ages. See https://wiki.openttd.org/Tractive_Effort and links therein.
Similarily, the cargo capacity can and will only change in depot and in stations. Similar arguments go for other properties and related callbacks.
Users browsing this forum: No registered users and 3 guests