Skip to content

Remove `global_slowdown` variable, use a limiter for dtime instead.

Olivia May requested to merge olivia-may/advtrains:hyper into hyper

Remove global_slowdown variable. The lowest global_slowdown could go is 0.1, so it would make trains move at 10x less speed. My commit makes it so the delta time, dtime is limited to a defined amount, advtrains.DTIME_LIMIT. So if a train is moving 30m/s, and the server has a lag spike for 5s, and DTIME_LIMIT is set to 0.5s, then the train would only move 30m/s * 0.5s = 15m. Before my change, if the server was lagging a lot, then global_slowdown would decrease rapidly, and at its worst it would be like the train would be moving 3m/s * 0.5s = 1.5m. My change keeps the DTIME_LIMIT but removes the global_slowdown variable. It might also increase performance because it won't multiply a few variables every server tick. I can't figure out how to test for lag in my singleplayer world, but I have tested the changes and my version loads fine and the trains run at the same speed.

Merge request reports