train speed
Posted: 19 May 2010 15:41
I've been looking at the source code to figure out how fast are vehicles (trains) in the game actually moving. The wiki says that a train moving at 100mph travels 5.6 tile per day. In source codes I found this:
1. Train::UpdateSpeed in train_cmp.cpp says that a train can travel 3/4 cur_speed every tick.
2. TrainLocoHandler in train_cmp.cpp advances the train one pixel for each 192 accumulated speed (assuming the train is moving parallel to the gridlines).
3. TileVirtXY in map_func.h suggests that one tile is 16 pixels wide.
Now assuming there are 74 ticks in one day, a train travelling at speed 160 (which corresponds to 100mph right?) should move (74*3/4*160)/192/16 = 2.89 tiles per day. Could anyone point out what part(s) of this calculation is(are) wrong?
1. Train::UpdateSpeed in train_cmp.cpp says that a train can travel 3/4 cur_speed every tick.
2. TrainLocoHandler in train_cmp.cpp advances the train one pixel for each 192 accumulated speed (assuming the train is moving parallel to the gridlines).
3. TileVirtXY in map_func.h suggests that one tile is 16 pixels wide.
Now assuming there are 74 ticks in one day, a train travelling at speed 160 (which corresponds to 100mph right?) should move (74*3/4*160)/192/16 = 2.89 tiles per day. Could anyone point out what part(s) of this calculation is(are) wrong?