1 | //===== Athena Doc ======================================== |
---|
2 | //= eAthena Map Cache Builder and Format Documentation |
---|
3 | //===== By ================================================ |
---|
4 | //= DracoRPG |
---|
5 | //===== Version =========================================== |
---|
6 | //= 1.0 |
---|
7 | //========================================================= |
---|
8 | //= 0.1 - Short howto for the initial builder version |
---|
9 | //= 1.0 - Complete manual covering the improved version |
---|
10 | //===== Description ======================================= |
---|
11 | //= A complete manual for eAthena's map cache generator |
---|
12 | //= as well as a reference on the map cache format used |
---|
13 | //========================================================= |
---|
14 | |
---|
15 | Preface: |
---|
16 | ------------------------------------------------------------------------------- |
---|
17 | |
---|
18 | Since SVN revision ~10000, the map-server does not know how to read RO client files anymore. It reads maps from a |
---|
19 | "map cache" file that contains all and only the useful data about the maps. A map cache containing every official |
---|
20 | kRO Sakray map currently supported by eAthena is provided as a default. |
---|
21 | If you have custom maps or want to minimize the size of your map cache because your server does not load all of them |
---|
22 | (multi-map-server or light test server), you can use the map cache builder to generate a new one fitting your needs. |
---|
23 | |
---|
24 | Map cache builder manual: |
---|
25 | ------------------------------------------------------------------------------- |
---|
26 | |
---|
27 | The source code for the map cache builder is located in src/tool/. It can be built using "make tools" if you use the Makefile |
---|
28 | or using the "mapcache" project under Visual Studio. Named "mapcache", the executable will be in your eAthena main folder. |
---|
29 | The map cache builder needs 3 file paths : one is a list of GRFs and/or data directory containing the maps, the second |
---|
30 | is the list of maps to add to the map cache, and the last one is the path of the map cache to generate. Default values for |
---|
31 | those paths are "tools/mapcache/grf_files.txt", "db/map_index.txt" and "db/map_cache.dat". |
---|
32 | The list of GRF and/or data directory must follow the format and indication of the default file: as many "grf:" entries as |
---|
33 | you wish and optionally one only "data_dir:" entry with trailing backslash included. // comments are supported as usual. |
---|
34 | In fact, any file with one map name per line can be used as a map list, that's why the map index list is used as a default: |
---|
35 | we are sure it contains every map supported by the server. Anything after the map name is ignored, // comments are supported |
---|
36 | and if the first word on the line is "map:" then the second word is used as the map name instead: that allows using |
---|
37 | maps_athena.conf as your map list, which is handy if you want to generate a minimal map cache for each of your multiple |
---|
38 | map-servers. |
---|
39 | The map cache file path can point to an already existing file, as the builder adds a map only if it's not already cached. |
---|
40 | This way, you can add custom maps to the base map cache without even needing kRO Sakray maps. If you wish to rebuild the |
---|
41 | entire map cache, though, you can either provide a path to a non-existing file, or force the rebuild mode. |
---|
42 | |
---|
43 | Here are the command-line arguments you can provide to the map cache builder to customize its behavior: |
---|
44 | -grf path/to/grf/list |
---|
45 | Allows to specify the file containing the list of GRFs and/or data directory |
---|
46 | -list path/to/map/list |
---|
47 | Allows to specify the file containing the list of maps to add to the map cache |
---|
48 | -cache path/to/map/cache |
---|
49 | Allows to specify the path to the generated map cache |
---|
50 | -rebuild |
---|
51 | Allows to force the rebuild mode (map cache will be overwritten even if it already exists) |
---|
52 | |
---|
53 | |
---|
54 | Map cache format reference: |
---|
55 | ------------------------------------------------------------------------------- |
---|
56 | |
---|
57 | The file is written as little-endian, even on big-endian systems, for cross-compatibility reasons. Appropriate conversions |
---|
58 | are done when generating it, so don't worry about it. |
---|
59 | The first 6 bytes are a main header: |
---|
60 | <unsigned long> file size |
---|
61 | <unsigned short> number of maps |
---|
62 | Then maps are stored one right after another: |
---|
63 | <12-characters-long string> map name |
---|
64 | <short> X size |
---|
65 | <short> Y size |
---|
66 | <long> compressed cell data length |
---|
67 | <variable> compressed cell data |
---|