map_cache.txt 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //===== rAthena Documentation ================================
  2. //= rAthena Map Cache Builder and Format Documentation
  3. //===== By: ==================================================
  4. //= DracoRPG
  5. //===== Last Updated: ========================================
  6. //= 20070724
  7. //===== Description: =========================================
  8. //= A complete manual for rAthena's map cache generator as
  9. //= well as a reference on the map cache format used.
  10. //============================================================
  11. Preface:
  12. -------------------------------------------------------------------------------
  13. Since SVN revision ~10000, the map-server no longer knows how to read GRFs directly. It reads maps from a
  14. "map cache" file that contains all and only the useful data about the maps. A map cache containing every official
  15. kRO Sakray map currently supported by rAthena is provided as a default.
  16. If you have custom maps or want to minimize the size of your map cache because your server does not load all of them
  17. (multi-map-server or light test server), you can use the map cache builder to generate a new one fitting your needs.
  18. Map cache builder manual:
  19. -------------------------------------------------------------------------------
  20. 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
  21. or using the "mapcache" project under Visual Studio. Named "mapcache", the executable will be in your rAthena main folder.
  22. The map cache builder needs 3 file paths : one is a list of GRFs and/or data directory containing the maps, the second
  23. 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
  24. those paths are "tools/mapcache/grf_files.txt", "db/map_index.txt" and "db/(pre-)re/map_cache.dat".
  25. As of r16867, the mapcache can be located in db/pre-re/ and db/re/. This is due to renewal and pre-renewal modes having
  26. slightly different maps. When building your cache, you should ensure you're pointing the tool to the correct location.
  27. The list of GRFs and/or data directory must follow the format and indication of the default file: as many "grf:" entries as
  28. you wish and optionally only one "data_dir:" entry with trailing backslash included. // comments are supported as usual.
  29. 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:
  30. we are sure it contains every map supported by the server. Anything after the map name is ignored, // comments are supported
  31. and if the first word on the line is "map:" then the second word is used as the map name instead: that allows using
  32. maps_athena.conf as your map list, which is handy if you want to generate a minimal map cache for each of your multiple
  33. map-servers.
  34. 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.
  35. This way, you can add custom maps to the base map cache without even needing kRO Sakray maps. If you wish to rebuild the
  36. entire map cache, though, you can either provide a path to a non-existing file, or force the rebuild mode.
  37. Here are the command-line arguments you can provide to the map cache builder to customize its behavior:
  38. -grf path/to/grf/list
  39. Allows to specify the file containing the list of GRFs and/or data directory
  40. -list path/to/map/list
  41. Allows to specify the file containing the list of maps to add to the map cache
  42. -cache path/to/map/cache
  43. Allows to specify the path to the generated map cache
  44. -rebuild
  45. Allows to force the rebuild mode (map cache will be overwritten even if it already exists)
  46. Map cache format reference:
  47. -------------------------------------------------------------------------------
  48. The file is written as little-endian, even on big-endian systems, for cross-compatibility reasons. Appropriate conversions
  49. are done when generating it, so don't worry about it.
  50. The first 6 bytes are a main header:
  51. <unsigned int> file size
  52. <unsigned short> number of maps
  53. Then maps are stored one right after another:
  54. <12-characters-long string> map name
  55. <short> X size
  56. <short> Y size
  57. <long> compressed cell data length
  58. <variable> compressed cell data