View Single Post
11-12-11, 02:08 PM   #9
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
It's a bit hard to explain, so I'll show some examples of what I mean;

TaxiNodes.dbc contains the columns:
TaxiId, mapId, x, y, z, name, ...

TaxiPath.dbc contains the columns:
PathId, fromTaxiId, toTaxiId, cost

TaxiPathNode.dbc contains the columns:
PathNodeId, PathId, counter, mapId, x, y, z, ...

Combining these information tables you can combine a start and a destination, for example in TaxiNodes.dbc Stormwind is #2 and Goldshire is #582.

Then you check TaxiPath.dbc if you have a PathId for a path fromTaxiId=2 and toTaxiId=582, if not then that taxi path does not exist.

If you do on the other hand, you look the nodes in the path (the mount follows these node by node) in TaxiPathNode.dbc where you look up all PathNodeId where PathId=TaxiPath.PathId and you get a list where counter goes from 0 up to the last node (SW->GS has 16 nodes along the flight path).

Each flight position has coordinates, they are relative to the map and we know the mapId in case we need to translate coordinates (i.e. flying from one map to the other, e.g. maybe it affects the distance calculations, not sure, maybe not).

Anyway, mathematically you can iterate a path of many nodes and each step you take you compare this with the previous (or next, depending how you program it) and get a distance difference by putting the coordinates in a formula, then if you know how fast you are moving you can calculate the time between each node and sum them all up for the total travel time from start to finish.

The only problem so far is the possibility of a "wobble", like this:

Fig. 1 is how the math would calculate distances, straight lines from one point to the other. Fig. 2 is how it feels in the game, you don't fly and instantly turn once you hit a node, instead the game does some sort of wobble to make the transition smooth between nodes.

TaxiNodes = positions you can land and take off
FlightNodes/(I call them nodes in this post) = the orange dots in between the air, not visible but you go from one to the next like waypoints.

*Edit*

SDPhantom the coordinates are on this form (one random line from both files that contain coordinates):
2,0,-8841.05957031,489.656005859,109.607002258,"Stormwind, Elwynn",0,541,1,0.00998003967106,0.0101744187996,
35,6,0,0,-8852.65039063,496.459991455,111.040000916,0x0,0,0,0,
You have the mapId (0 in this case) and the coordinates, it does look like continent coordinates, yes.

*Edit 2*
Just figured I'd put an example output so far, the time is about right for this specific path, but need to find the speed value, it may be variable or constant if lucky. At the moment the speed was set to 30.33... but need to test with more FP to see if it applies to them or not, I think not because of this wobble I mentioned in the post.
Flying path #557 for 1020 copper:
- #128; Shattrath, Terokkar Forest
- #121; Allerian Stronghold, Terokkar Forest
- parsing nodes along path...
-> #start to #14252 (+0.15 seconds)
-> #14252 to #14251 (+0.71 seconds)
-> #14251 to #14250 (+1.48 seconds)
-> #14250 to #14249 (+2.33 seconds)
-> #14249 to #14248 (+2.47 seconds)
-> #14248 to #14247 (+3.21 seconds)
-> #14247 to #14246 (+5.81 seconds)
-> #14246 to #14245 (+13.83 seconds)
-> #14245 to #14244 (+7.16 seconds)
-> #14244 to #14243 (+4.55 seconds)
-> #14243 to #14242 (+4.87 seconds)
-> #14242 to #14241 (+6.92 seconds)
-> #14241 to #14240 (+4.93 seconds)
-> #14240 to #14239 (+5.49 seconds)
-> #14239 to #14238 (+5.59 seconds)
-> #14238 to #14237 (+3.15 seconds)
-> #14237 to #14236 (+1.66 seconds)
-> #14236 to #end (+0.06 seconds)
=> arrived destination after 74.36 seconds!

Last edited by Vlad : 11-12-11 at 02:16 PM.
  Reply With Quote