train speed
Moderator: OpenTTD Developers
train speed
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?
Re: train speed
afair, trains move twice every tick, not sure how that affects your calculation, though.
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: train speed
To find out how fast they are *actually* moving I would count the number of pixels they travel per second. Because they are usually moving diagonally, you may need some help from our friend pythagoras
</unhelpful coments>
</unhelpful coments>
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: train speed
Aha! Thanks Eddi. So does that mean that the train would move 5.78 tiles / day? Why does wiki mention 5.6?
Re: train speed
Except classical geometry doesn't really work in TTD land. TTD's squares are actually circles.andythenorth wrote:To find out how fast they are *actually* moving I would count the number of pixels they travel per second. Because they are usually moving diagonally, you may need some help from our friend pythagoras
</unhelpful coments>
Re: train speed
*brain explodes*
The TT forums trivia tournament! Come along and join in the fun
http://www.funtrivia.com/private/main.cfm?tid=90722
http://www.funtrivia.com/private/main.cfm?tid=90722
Re: train speed
Squares don't look like squares in OTTD, you have to use diamonds instead.
If we need a diamond, we usually just tape a bunch of triangles together.
If we need a diamond, we usually just tape a bunch of triangles together.
Jon
Re: train speed
They're not squares or diamonds.audigex wrote:Squares don't look like squares in OTTD, you have to use diamonds instead.
If we need a diamond, we usually just tape a bunch of triangles together.
Check out how many regular-length train vehicles fit on a tile in each of the 4 orientations...
Re: train speed
haha I know - but I refused to miss an opportunity to paraphrase a simpsons quote.
Jon
Who is online
Users browsing this forum: No registered users and 9 guests