How to convert distance into travel time

strico10

Guest
I made a code using blue jay java and the public text files to find the closest enemy city to a given city. Just to give a simple explanation of how it works:
Input: City, Player, Alliance, Enemy Alliance(s)
Output: Closest Enemy City, Player, Alliance, Distance

Instead of outputting distance, I would like it to output the time it would take to travel by transport boats, but I do not understand the conversion.

For example, it takes 7h50min to travel a distance of 70.3757 with a transport boat (speed: 16).

My Question is what formula is used to take the input (70.3757 and 16) and make the output (7h50min).
 

strico10

Guest
I asked a very simple question? I am looking for the formula to convert distance into travel time. If it is to difficult for you then dont answer it, but I assume someone must know it.
 

Kevinkingeen

Guest
Here is how to do it:

Code:
double distance = 57.0104203;
int distance2 = round(distance) - 2;  // 55
double time = (distance2 / unitspeed) * 2;
 

.Pete.

Guest
Hi,
I already posted a collection of useful algorithms on the german forum :D
Among other things, the exact calculation of travel times is described there as well.

First, you need the exact distance in pixels on the world map. Once you got this, you can go on.

The total travel time is calculated by the following formula:

total travel time = setup time + unit travel time

Where setup time is 15 mins on a speed 1 world, 00:07:30 on a speed 2 etc.

So, how to calculate the unit travel time?

Unit speed is given in Pixels per 50 seconds. So the unit travel time can be calculated by:

unit_travel_time = distance * 50.0 / unit_speed

I hope, these few hints bring you fourth :D

Kind regards,

Pete