Conversion between MPH / Km/h and Tiles per Day

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 171
Joined: 17 Nov 2007 17:23
Skype: ben313371

Conversion between MPH / Km/h and Tiles per Day

Post by Ben1338 »

Hi, hope you all have been having a nice Christmas.

I've been using some aspects of OTTD, such as the cargo payment rate statistic.

But I've been having issues with it, the fact that road vehicles display speed in MPH or Km/h rather than tiles per day (T/D) which makes it hard to calculate how far a vehicle will go in a day and then extrapolate that to any distance covered at any speed.

Are there any conversion formulas between MPH and T/D?
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Conversion between MPH / Km/h and Tiles per Day

Post by Eddi »

i'm sure that is mentioned somewhere exactly, but what i seem to remember how it works:
  • the internal unit is "km/h-ish", which is mph*1.6 (the true conversion factor between mph and km/h is not exactly 1.6, but internally, 1.6 is used)
  • for each speed unit, a vehicle makes 2 substeps per tick
  • each step has 256 substeps, and each tile has 16 steps (works slightly different on diagonals, i think there you have 192 substeps and 8 steps)
  • so a vehicle with 128km/h-ish makes 1 step per tick
  • each day has 74 ticks
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

Re: Conversion between MPH / Km/h and Tiles per Day

Post by _dp_ »

I used formula 1 tile = 192 * 16 * 4 / 3 / 2 kmhish*ticks for diagonal line.
So it should be 1 tile/day = 192 * 16 * 4 / 3 / 2 / 74 / 1.6 ~= 17.3 mph

Don't remember what all that 4 / 3 / 2 means but I was following the OpenTTD code when I made it.
User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 171
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Conversion between MPH / Km/h and Tiles per Day

Post by Ben1338 »

That... Comes really really close to my tests.

The tests were to see how long it would take a train travelling at 343MPH to travel 3430 tiles at max speed (excluding acceleration & deceleration, no breakdowns on completely flat ground), it took 174 days.

Using your formulae, with an addition of converting distance & time into speed (tiles per day) and then converting it into MPH, it comes to 339 MPH, which is really close, within margin.

Thank you everyone who contributed.
_dp_
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 18 Dec 2013 12:32

Re: Conversion between MPH / Km/h and Tiles per Day

Post by _dp_ »

Forgot to actually mention what I used that formula for. You may be interested as well since you're looking into payment rates: https://citymania.org/tools/profit
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 41 guests