Fix internal update of train max_speed
Posted: Sun Jul 23, 2017 6:40 pm
I'm not sure where the error is...
(speeds are given in internal m-per-tick)
In my train speed limter mod, I increase (uncap) the max train speed and modify the physics to make effective maxes that resemble the original.. but I've been trying to get trains to behave more correctly; Since I can't get their acceleration/cruising/decelerating state, I don't know when I can apply track modifier to speed...
in my mod I define a 'Q' for quality which is a multiplier applied train speed, and a rail max-speed setting, because some trains were able to overpower the low Q and go pretty fast anyway.
(applying track Q setting continuously)
if I have poor quality tracks that have a constant penalty (Q<1) to train speed, then when trains slow down approaching stops they slow to a crawl... Also if I have just a patch of poor quality track, that slows the train down a lot, and within the deceleration curve of the train before a stop, the train will not re-accelerate back to normal speed on better quality tracks (superior quality tracks will re-boost the train speed if I always apply the speed)
So I tried 'if train is accelerating (current train speed > the prior train speed )' then on high speed rails, trains cap out at the original max speed they were set with (in original mod's data.lua) and not the modified speed (in my data-update.lua). That is I will set a certain speed and they will drop back to their internal max speed of 1.2(hybrid-train original max-speed in data.lua) or 1.5(nuclear-train original max-speed in data.lua) which will make me stop applying the track modifier since they're not accelerating. The max_speed of the train is actually raised (4.0 in my data-update.luq), that is I can push the train this max when continuously applying a Q > 1 that is also greater than their air_resistance. If I don't override the max-speed than their speed is hard limited to their max_speed. I don't really understand why their original max_speed would even be an effect.
I have been playing with just single engines running around on tracks, and have not attached other carraiges which late yesterday I noticed have their own max_speed settings.
From game.enitty_prototypes I'm not able to get any information about speeds; so all of this is based on observations.
(speeds are given in internal m-per-tick)
In my train speed limter mod, I increase (uncap) the max train speed and modify the physics to make effective maxes that resemble the original.. but I've been trying to get trains to behave more correctly; Since I can't get their acceleration/cruising/decelerating state, I don't know when I can apply track modifier to speed...
in my mod I define a 'Q' for quality which is a multiplier applied train speed, and a rail max-speed setting, because some trains were able to overpower the low Q and go pretty fast anyway.
(applying track Q setting continuously)
if I have poor quality tracks that have a constant penalty (Q<1) to train speed, then when trains slow down approaching stops they slow to a crawl... Also if I have just a patch of poor quality track, that slows the train down a lot, and within the deceleration curve of the train before a stop, the train will not re-accelerate back to normal speed on better quality tracks (superior quality tracks will re-boost the train speed if I always apply the speed)
So I tried 'if train is accelerating (current train speed > the prior train speed )' then on high speed rails, trains cap out at the original max speed they were set with (in original mod's data.lua) and not the modified speed (in my data-update.lua). That is I will set a certain speed and they will drop back to their internal max speed of 1.2(hybrid-train original max-speed in data.lua) or 1.5(nuclear-train original max-speed in data.lua) which will make me stop applying the track modifier since they're not accelerating. The max_speed of the train is actually raised (4.0 in my data-update.luq), that is I can push the train this max when continuously applying a Q > 1 that is also greater than their air_resistance. If I don't override the max-speed than their speed is hard limited to their max_speed. I don't really understand why their original max_speed would even be an effect.
I have been playing with just single engines running around on tracks, and have not attached other carraiges which late yesterday I noticed have their own max_speed settings.
From game.enitty_prototypes I'm not able to get any information about speeds; so all of this is based on observations.