OBD:AKVA/0x24: Difference between revisions

cleanup
m (short strips wrap around too)
(cleanup)
Line 1: Line 1:
{{OBD_File_Header|align=center|type=AKVA|prev=AKOT|next=BINA|name=BNV Node Array|family=Level|onistuff=akva}}
;Overview
----
This is the pathfinding grid data, linked to from the BNV chunk of an [[OBD:AKVA|AKVA]].


The example below is the grid of BNV number 32 from '''level1_Final'''.
The pathfinding grid is made of equally sized tiles and it is aligned with the x and z axis. The size of the tile and the number of tiles are along each axis are stored in the [[OBD:AKVA|BNV]]. Grid rows corespond to the x axis and grid column corespond to the z axis.
:('''chr_teleport 0 0''' gets you there, and then you can use '''chr_show_bnv=1''' and '''ai2_showgrids=1''')


The example was chosen because it's a relatively small grid (45 bytes of data) and illustrates the format completely.
A tile can have one of the following types (appearance as visible with '''ai2_showgrids=1'''):
*0 : '''clear''' (no cross)
*1 : '''nearwall''' (light green cross)
*2 : '''border1''' (lightest blue cross)
*3 : '''border2''' (lighter blue cross)
*4 : '''semipassable''' (green cross)
*5 : '''border3''' (blue cross)
*6 : '''border4''' (dark blue cross)
*7 : '''stairs''' (dark green cross)
*8 : '''danger''' (orange cross)
*9 : '''impassable''' (red cross)


The pathfinding grid is aligned with the x and z axis. The size of the grid along x and z is specified in the DAT.


The grid data is stored in strips, each strip consisting of tiles of a certain type.
;Storage
:A strip can have any length between 1 and 255 (along x), and a width of 1 (along z).
:A strip runs along x for fixed z, and can wrap around to the next z if it's longer than the grid.


Tile types are (appearance as visible with '''ai2_showgrids=1'''):
The grid is stored compressed in .raw files and it is decompressed on demand (when an AI needs to find its way through a BNV).
*0 : no cross, '''clear'''
The used compression algorithm is a form of [[wikipedia:Run-length_encoding|RLE]]:
*1 : light green cross, '''nearwall'''
:*a sequence of tiles that have the same type form a run
*2 : lightest blue cross, '''border1'''
:*a run can have a length of up to 255 tiles
*3 : lighter blue cross, '''border2'''
:*runs of length 1 are treated as any other length runs
*4 : green cross, '''semipassable'''
:*runs of up to 15 tiles (short runs) are stored in one byte:
*5 : blue cross, '''border3'''
::XY (hexadecimal, with X > 0 ) stands for a run of X tiles of type Y
*6 : dark blue cross, '''border4'''
:*runs of more than 15 tiles (long runs) are stored in 2 bytes:
*7 : dark green cross, '''stairs'''
::0Y XX (hexadecimal, with XX > 0 ) stands for a run of XX tiles of type Y
*8 : orange cross, '''danger'''
::the leading 0 is used to differentiate between short and long runs
*9 : red cross, '''impassable'''
Taken from EXE (pointer array at 0x134878 in the 1527808-byte EXE)


There's another pointer array at 0x1348A0 in the 1527808-byte EXE that goes:
*0 : '''none'''
*1 : '''floor'''
*2 : '''wall'''
*3 : '''sloped'''
*4 : '''danger'''
*5 : '''stair'''
Apparently a separate type, but possibly complementary to the one above.
*0x134878 is addressed from 0xB6745 (0xB675B links to "unknown-weight %d")
*0x1348A0 is addressed from 0xB670D (0xB6723 links to "unknown-event %d")
SFeLi, please help ^^


Strips can be stored in two ways:
;Example


;Short strips (1 to 15 tiles)
The example below is the grid of BNV number 32 from '''level1_Final'''.
:are stored as one byte
:('''chr_teleport 0 0''' gets you there, and then you can use '''chr_show_bnv=1''' and '''ai2_showgrids=1''')
:XY (hexadecimal, with X > 0 )
 
:stands for a strip of X tiles of type Y
The example was chosen because it's a relatively small grid (45 bytes of data) and illustrates the format completely.


;Long strips (1 to 255 tiles)
:are stored as two bytes
:0YXX (hexadecimal, with XX > 0 )
:stands for a strip of XX tiles of type Y
The leading zero tells you if you're looking at a long or short strip.


;Example (BNV 32 from '''level1_Final''')
:(offsets relative)
:(offsets relative) (make them absolute if you like)
{|cellspacing=0
{|cellspacing=0
{{HexRow|0x00|
{{HexRow|0x00|
708

edits