VaultNetwork.net Vault Network Boards
Author Topic: Distance in AC [Locked]
Chazcon  3 stars
Title: FOR THE VITAE!
Posts: 524
Registered: 2001-12-11 13:57:12
Old question, but how to calculate distance in AC across landblock boundaries?


These formules give heading & distance WITHIN a landblock:


EW1 = (Target EW) - (my EW loc)

NS1 = (Target NS) - (my NS loc)

distance = sqrt(sqr(NS1) + sqr(EW1))

Heading = ARCTAN(EW1/ NS1) * ( 180 / PI )


(ElgarL)


But if the start and end locations are in two different landblocks, how does one navigate? Do you first do a calc to the target landblock, and then switch to X,Y coordinates to navigate to the desired location?


Or is there a trig formula that will give a heading and distance?


The map in AC is made up as follows:


- landblocks are 8*8 squares

- squares are 24*24 units

- world is 255*255 landblocks (2040*2040 squares)

- center (in squares) is at 1020,1020

- the divide by 10 was a nice scaling factor which seems to give the right results (matches ac's map coords after rounding to one decimal place)

- For outdoors, the lower 7 bits of the landblock value represent which of the 64 squares within the landblock you are standing on. The value is 1 in the south west corner of the landblock, 8 in the north west corner, 57 in the south east corner and 64 in the north east corner (ie. count each column south to north). Not sure why they didn't have the south west corner as zero, could have saved a bit.


(antishreth)

 

-----signature-----
Chazcon - Aluvian swordsman
You say, "FOR THE VITAE!"
Ru tells you, "CHAZ!"
Simply Red tells you, "I am SO not recovering your body!"
-- Good times.
MT_Gouru  3 stars
Posts: 666
Registered:
WorldFilter has a method that will take two different objects and calculate the distance between them. IIRC correctly, it has a method you can give coords to as well. That is easiest/best way.
Chazcon  3 stars
Title: FOR THE VITAE!
Posts: 524
Registered: 2001-12-11 13:57:12
thanks Gouru

 

-----signature-----
Chazcon - Aluvian swordsman
You say, "FOR THE VITAE!"
Ru tells you, "CHAZ!"
Simply Red tells you, "I am SO not recovering your body!"
-- Good times.

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.