DrawnMapFormat.wiki
author Wuzzy
Thu, 05 Dec 2019 16:12:25 +0000
changeset 2113 115b171c7e3e
parent 2112 940566498a62
child 2115 43bd12e66491
permissions -rw-r--r--
DrawnMapFormat: More about polylines
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
432
e441f3f51dac Add summary
almikes@aol.com
parents: 226
diff changeset
     1
#summary Short description of the file format of hand-drawn maps
e441f3f51dac Add summary
almikes@aol.com
parents: 226
diff changeset
     2
748
2051f403ddac DrawnMapFormat: Add title
Wuzzy
parents: 666
diff changeset
     3
= Hand-drawn maps =
666
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
     4
== Introduction ==
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
     5
Hand-drawn maps are maps which are created by the player using the in-game map editor.
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
     6
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
     7
== File storage ==
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
     8
Hand-drawn maps are saved with a file name suffix of “.hwmap”. By default, drawn maps are stored in a directory called “DrawnMaps” in the user directory, but the player could choose any location.
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
     9
1621
41a7f751b77b DrawnMapFormat: Warning about outdatec file spec
Wuzzy
parents: 1222
diff changeset
    10
== File format (outdated) ==
41a7f751b77b DrawnMapFormat: Warning about outdatec file spec
Wuzzy
parents: 1222
diff changeset
    11
*NOTE*: This section is outdated.
41a7f751b77b DrawnMapFormat: Warning about outdatec file spec
Wuzzy
parents: 1222
diff changeset
    12
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    13
The raw format is defines as follows:
666
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
    14
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    15
A drawn map is described by a sequence of points, which define polylines to draw and format of each polyline.
226
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    16
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    17
A point is defined as
226
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    18
|| Big-endian int16 || Big-endian int16 || Byte ||
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    19
|| *X* coordinate || *Y* coordinate || *flags* ||
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    20
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    21
where *flags* are:
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    22
|| 8th bit || 7th bit || 6th-1st bits ||
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    23
|| if set, this is a first point of polyline (“start” bit) || if set, polyline is erasing || *width* (thickness) of line ||
226
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    24
1222
111d15f81dbd DrawnMapFormat: Fix typos
Wuzzy
parents: 798
diff changeset
    25
… where *width* defines `(width * 10) + 6` pixels width line to draw.
226
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    26
1222
111d15f81dbd DrawnMapFormat: Fix typos
Wuzzy
parents: 798
diff changeset
    27
Second and further points of polyline have 8th bit of *flags* unset, the content of others are ignored for those.
226
6ca639109e95 Created wiki page through web user interface.
unC0Rr@gmail.com
parents:
diff changeset
    28
2113
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    29
A polyline begins when a point with the 8th bit in flags was set. Subsequent points will extend the line as long the “start” bit of those is not set. A new line starts when another point appears with the “start” bit being set. A single-point polyline defines a circle.
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    30
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    31
=== Compression ===
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    32
115b171c7e3e DrawnMapFormat: More about polylines
Wuzzy
parents: 2112
diff changeset
    33
Above description describes the raw data, but the final file will be changed. The raw data is first base64-encoded and then compressed with [https://doc.qt.io/qt-5/qbytearray.html#qCompress Qt's `qCompress` function].
666
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
    34
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
    35
== Sharing hand-drawn maps ==
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
    36
Hand-drawn maps will be automatically transferred when playing online.
f38a002a0796 Give the article more flesh
Wuzzy
parents: 432
diff changeset
    37
1681
nemo
parents: 1621
diff changeset
    38
But if you wish you can still share your creations in the [https://www.hedgewars.org/node/2849 Hand-Drawn Maps Submission Thread].