https://openkore.com/index.php?title=Field_file_format&feed=atom&action=historyField file format - Revision history2024-03-28T09:52:04ZRevision history for this page on the wikiMediaWiki 1.34.1https://openkore.com/index.php?title=Field_file_format&diff=6576&oldid=prev4epT: 4epT moved page field file format to Field file format over a redirect without leaving a redirect2021-04-27T07:12:21Z<p>4epT moved page <a href="/index.php?title=field_file_format&action=edit&redlink=1" class="new" title="field file format (page does not exist)">field file format</a> to <a href="/wiki/Field_file_format" title="Field file format">Field file format</a> over a redirect without leaving a redirect</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">Revision as of 07:12, 27 April 2021</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>4epThttps://openkore.com/index.php?title=Field_file_format&diff=5895&oldid=prevConversion script: Conversion script moved page Field file format to field file format: Converting page titles to lowercase2021-04-26T22:35:22Z<p>Conversion script moved page <a href="/wiki/Field_file_format" title="Field file format">Field file format</a> to <a href="/index.php?title=field_file_format&action=edit&redlink=1" class="new" title="field file format (page does not exist)">field file format</a>: Converting page titles to lowercase</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<tr class="diff-title" lang="en">
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="1" style="background-color: #fff; color: #222; text-align: center;">Revision as of 22:35, 26 April 2021</td>
</tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>Conversion scripthttps://openkore.com/index.php?title=Field_file_format&diff=3678&oldid=prevItsrachelfish: /* Creating FLD files */2016-03-03T12:53:30Z<p><span dir="auto"><span class="autocomment">Creating FLD files</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 12:53, 3 March 2016</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l10" >Line 10:</td>
<td colspan="2" class="diff-lineno">Line 10:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Creating FLD files ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Creating FLD files ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del class="diffchange diffchange-inline">The fieldpack module in [[SVN]] has </del>a <del class="diffchange diffchange-inline">script </del>called <del class="diffchange diffchange-inline">gat2fld</del>.pl in <del class="diffchange diffchange-inline">the </del>tools <del class="diffchange diffchange-inline">folder</del>. You can use that script to convert GAT files to FLD files. Copy GAT and RSW files to the same folder as <del class="diffchange diffchange-inline">gat2fld</del>.pl, and run the script. The easy guide can be found [[FLD Creation Guide|here]].</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">There is </ins>a <ins class="diffchange diffchange-inline">tool </ins>called <ins class="diffchange diffchange-inline">'''gat_to_fld</ins>.pl<ins class="diffchange diffchange-inline">''' located </ins>in <ins class="diffchange diffchange-inline">[https://github.com/OpenKore/openkore/tree/master/fields/tools fields/</ins>tools<ins class="diffchange diffchange-inline">/]</ins>. You can use that script to convert GAT files to FLD files. Copy GAT and RSW files to the same folder as <ins class="diffchange diffchange-inline">'''gat_to_fld</ins>.pl<ins class="diffchange diffchange-inline">'''</ins>, and run the script. The easy guide can be found [[FLD Creation Guide|here]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== The FLD file format ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== The FLD file format ==</div></td></tr>
</table>Itsrachelfishhttps://openkore.com/index.php?title=Field_file_format&diff=2654&oldid=prev4epT: Created page with '== What are FLD files? == In order for OpenKore to walk around on a map, it must know how the map looks like. Otherwise it can't calculate a path. An FLD file contains informatio…'2012-02-28T20:58:47Z<p>Created page with '== What are FLD files? == In order for OpenKore to walk around on a map, it must know how the map looks like. Otherwise it can't calculate a path. An FLD file contains informatio…'</p>
<p><b>New page</b></p><div>== What are FLD files? ==<br />
In order for OpenKore to walk around on a map, it must know how the map looks like. Otherwise it can't calculate a path. An FLD file contains information about how a map looks like. <br />
<br />
== Relation with .GAT/.RSW/.GND/.DIST ==<br />
If you open your Ragnarok Online client's GRF file (the RO client's resource archive file), you will not find FLD files, but only GAT/RSW/GND files. GAT (Ground Altitude File) and RSW (Resource World File) files also contain information about how the maps look like, but they contain too much information. OpenKore is only interested in the information about which parts of a map are walkable, but GAT files also contain information such as the height of a specific block in a map. So GAT and RSW files are converted to FLD files to save space.<br />
<br />
I'm not sure what GND and RSW files really are. But it seems that offset 166-169 (32-bit x86 floating point) in the RSW file represents the water level of the map.<br />
<br />
DIST files contain information about the distance to the closest non-walkable block. They're used by OpenKore's pathfinding algorithm for wall avoidance. DIST files are automatically generated by OpenKore at runtime, from FLD files.<br />
<br />
== Creating FLD files ==<br />
The fieldpack module in [[SVN]] has a script called gat2fld.pl in the tools folder. You can use that script to convert GAT files to FLD files. Copy GAT and RSW files to the same folder as gat2fld.pl, and run the script. The easy guide can be found [[FLD Creation Guide|here]].<br />
<br />
== The FLD file format ==<br />
The FLD file format is described by the follow C structure, assuming that the stucture is packed:<br />
<br />
struct FLDFile {<br />
uint16 width; // The width of the field.<br />
uint16 height; // The height of the field.<br />
unsigned char data[width * height]; // The raw field data.<br />
};<br />
All integers are in little-endian.<br />
<br />
Each byte in the raw field data describes a block on the map. The following byte values (in decimal) have a known meaning: <br />
:* 0 = walkable block<br />
:* 1 = non-walkable block<br />
:* 2 = non-walkable water (not snipable)<br />
:* 3 = walkable water<br />
:* 4 = non-walkable water (snipable)<br />
:* 5 = cliff (snipable)<br />
:* 6 = cliff (not snipable)<br />
:* 7 = unknown<br />
The raw 1D array represents the 2D map, just like many raster image formats do. Therefore, to get information about a position (x, y) on the map, you query FLDFile.data[y * FLDFile.width + x]<br />
<br />
== The GAT file format ==<br />
struct GATFile { // Offset<br />
unsigned char magic[6]; // 0<br />
uint32 width; // 6<br />
uint32 height; // 10<br />
struct GATBlock blocks[]; // 14<br />
};<br />
All integers are in little-endian. <br />
; magic<br />
: The value is "GRAT\x01\x02" <br />
; width<br />
: The width of the map. <br />
; height<br />
: The height of the map. <br />
; blocks<br />
: An array of GATBlock structures. This extends until EOF. Each structure represents a block in the map.<br />
// Total size: 20 bytes<br />
struct GATBlock { // Offset<br />
float upperLeftHeight; // 0<br />
float upperRightHeight; // 4<br />
float lowerLeftHeight; // 8<br />
float lowerRightHeight; // 12<br />
unsigned char type; // 16<br />
unsigned char unknown[3]; // 17<br />
};<br />
'float' is a 32-bit x86 floating point number.<br />
;(upper|lower)(left|right)height<br />
: These fields specify the height of the upper left, upper right, lower left and lower right corner of the block. <br />
;type<br />
: Information about this block's type.<br />
<br />
::* 0 = walkable block<br />
::* 1 = non-walkable block<br />
::* 2 = non-walkable water (not snipable)<br />
::* 3 = walkable water<br />
::* 4 = non-walkable water (snipable)<br />
::* 5 = cliff (snipable)<br />
::* 6 = cliff (not snipable)<br />
::* Everything else = unknown<br />
<br />
It is also important to keep the water level* in mind. When the current block is below water level, the type field must be interpreted differently, as follows:<br />
<br />
:* 0 = walkable water<br />
:* 1 = non-walkable water (not snipable)<br />
:* 3 = walkable water<br />
:* 5 = non-walkable water (snipable)<br />
:* 6 = non-walkable water (not snipable)<br />
:* Everything else = unknown<br />
See the RSW note in 2nd paragraph of this page.<br />
<br />
To check whether a block is below water level, use the following pseudo code: <br />
float averageDepth = (gat_block.upperLeftHeight + gat_block.upperRightHeight<br />
+ gat_block.lowerLeftHeight + gat_block.lowerRightHeight) / 4;<br />
float waterLevel = readWaterLevelFromRSWFile();<br />
<br />
// The '>' is NOT a typo!<br />
if (averageDepth > waterLevel)<br />
// Block is below water level<br />
else<br />
// Block is above water level<br />
<br />
== Credits ==<br />
:* Alkie (Odin project) - information about that GAT files use floating-point numbers.<br />
:* Skipperbot - parts of this page is derived from Skipperbot's source code.<br />
:* amacc_boy<br />
:* [[http://rolaboratory.ximosoft.com/file-format/gat|ximosoft's GAT file specification]] Note that his specification is slightly different from ours. Apart from whether the first 4 (height) fields in GATBlock are correct, I believe that our specification more correct, based on various test results when I wrote the OpenKore map viewer and GAT conversion tool.<br />
:* [[http://rolaboratory.ximosoft.com/file-format/rsw|ximosoft's RSW file specification]]<br />
<br />
Source: http://web.archive.org/web/20080529162301/http://www.openkore.com/wiki/index.php/Field_file_format</div>4epT