#### BerndtToast

##### Guest

First of all - I apologize if this is in the wrong forum - I have been searching for a 'programming' thread on the .US forums, but have had no luck finding anything.

Anyways - I have been working on a program which automatically calculates the travel times of my cities to a particular (target) city. Right now I am using a homemade excel file which helps, but isnt automated at all, so it still takes quite some time to 'set up'

I have done a lot of digging, and I believe I have found all of the necessary information to 'solve' the problem, however I am having trouble getting the exact timing down...

My goal was to figure out the Same Island attack code first, then apply that code to other islands as well.

To get the same island attack times, I needed:

1. Island type list

2. City offset position per island type.

I found both of those, and successfully calculated the same island attack timing by getting the distance between the 2 points ( pythags theorem), multiplying that by 50, adding the 'set up time' and then dividing it by the unit speed.

**Total attack time = (Distance * 50) + Set up Time / Unit speed**

**Worked like a charm! Simple enough..**.I figured the same 'formula' could be applied to the 'Inter island' attacks...but no its not that simple. using the same formula for inter island attacks doesnt even come close to calculating the actual time...(im talking its hours off the real time)

After doing some more digging, I found that you need to apply the following to each 'island' coordinate.

**Island_X = X-coordinate * 128**

Island_Y(XEven) = Y-coordinate * 128 if x is even

Island_Y(XOdd) = 64 + Y-coordinate * 128 if x is odd

Island_Y(XEven) = Y-coordinate * 128 if x is even

Island_Y(XOdd) = 64 + Y-coordinate * 128 if x is odd

Well, after applying that little tid-bit of info, it greatly improved my calculations...I am now within around 1-7 minutes of the actual time, but I am struggling to figure out how to 'pin point' the timing so its the dead on... what am I missing?

How do I tie in the 'Offset X, Offset Y' coordinates into the inter island attack formula...that is basically my main issue at this point

I am sorry for the long message - am just hoping someone stumbles upon this who can provide some insight into this!