19,596
edits
(24 fix 26) |
m (contrary to Windows' claims, these are not "DAT" files) |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
;Overview | |||
The | 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. | ||
:(''' | |||
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) | |||
;Storage | |||
The grid | 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). | ||
: | The used compression algorithm is a form of [[wikipedia:Run-length_encoding|RLE]]: | ||
: | :*a sequence of tiles that have the same type form a run | ||
:*a run can have a length of up to 255 tiles | |||
:*runs of length 1 are treated as any other length runs | |||
:*runs of up to 15 tiles (short runs) are stored in one byte: | |||
::XY (hexadecimal, with X > 0 ) stands for a run of X tiles of type Y | |||
:*runs of more than 15 tiles (long runs) are stored in 2 bytes: | |||
::0Y XX (hexadecimal, with XX > 0 ) stands for a run of XX tiles of type Y | |||
::the leading 0 is used to differentiate between short and long runs | |||
;Example | |||
The example below is the grid of BNV number 32 from '''level1_Final'''. | |||
:('''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. | |||
:(offsets relative) | |||
:(offsets relative | |||
{|cellspacing=0 | {|cellspacing=0 | ||
{{HexRow|0x00| | {{HexRow|0x00| | ||
Line 48: | Line 48: | ||
{{HexRow|0x10| | {{HexRow|0x10| | ||
|11|30|11|14|09|11|48|79|14|11|30|11|14|79|48|39| | |11|30|11|14|09|11|48|79|14|11|30|11|14|79|48|39| | ||
|C0|88|C0|00|FF| | |C0|88|C0|00|FF|FF|FF|FF|00|C0|00|C0|00|FF|FF|FF| | ||
|C0|FF|C0|FF|00| | |C0|FF|C0|FF|00|00|A5|00|FF|C0|FF|C0|FF|00|A5|00| | ||
|C0|FF|C0|00|00| | |C0|FF|C0|00|00|00|00|00|00|C0|FF|C0|00|00|00|00| | ||
}} | }} | ||
{{HexRow|0x20| | {{HexRow|0x20| | ||
Line 62: | Line 62: | ||
;Here's the grid this corresponds to | ;Here's the grid this corresponds to | ||
:(the grid's size is 26x35 as specified in the | :(the grid's size is 26x35 as specified in the instance file) | ||
{|border=1 cellspacing=0 STYLE="empty-cells:show;" | {|border=1 cellspacing=0 STYLE="empty-cells:show;" | ||
!||01||02||03||04||05||06||07||08||09||10||11||12||13||14||15||16||17||18||19||20||21||22||23||24||25||26||27||28||29||30||31||32||33||34||35 | !||01||02||03||04||05||06||07||08||09||10||11||12||13||14||15||16||17||18||19||20||21||22||23||24||25||26||27||28||29||30||31||32||33||34||35 | ||
Line 180: | Line 180: | ||
|bgcolor="#00FF00;" colspan=2| 4 | |bgcolor="#00FF00;" colspan=2| 4 | ||
|} | |} | ||
{{OBD}} |