PresetMaps.wiki
author almikes@aol.com
Wed, 03 Dec 2014 05:43:29 +0000
changeset 415 70961d4eef05
parent 372 3ba6ae9321df
child 436 0afdd1b1042c
permissions -rw-r--r--
Fixed misleading descriptions of GetState and SetState (use of bitmasks were not mentioned). Added commented examples.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
279
1d9a5422d1b9 Edited wiki page PresetMaps through web user interface.
sheepyluva@gmail.com
parents: 264
diff changeset
     1
#summary This page describes the technically relevant aspects of preset maps in Hedgewars
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     2
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     3
<wiki:toc max_depth="3" />
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     4
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     5
----
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     6
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     7
= Introduction =
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     8
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
     9
One of the map types Hedgewars supports are maps that were previously drawn by an artist.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    10
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    11
The looks of such maps are distinctly defined and are not subject to randomized values.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    12
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    13
Additionally these maps allow [LuaGuide Lua-script] to be associated with them in order to enable adding specific gameplay changes and map behavior.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    14
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    15
----
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    16
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    17
= Location =
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    18
All maps are automatically loaded from the [HedgewarsDataDir Hedgewars data directory].
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    19
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    20
In this directory there has to be a folder for every map, named after the desired map name.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    21
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    22
*Examples:*
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    23
  * _Data/Maps/!MyVeryOwnMap_
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    24
  * _Data/Maps/Ropes_
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    25
  * _Data/Maps/Sheep_
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    26
  * etc.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    27
329
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    28
== Mission Maps ==
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    29
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    30
Missions may use preset maps that aren't located in the *Data/Maps* directory.
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    31
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    32
A mission may contain in the same directory with mission's lua script a .hwp file.
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    33
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    34
This file is a zip file with an altered extension from *.zip* to *.hwp* and it contains the directory *Maps/some_name*.
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    35
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    36
In the *some_name* directory the files map.cfg, map.png and mask.png are located. See the Basic Files section for more on these files.
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    37
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    38
The name of the *.hwp* file should be the same with the mission script.
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    39
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    40
In the mission script's onGameInit(), map should be set to *some_name*. See [LuaAPI] for more about onGameInit().
21830c0b19f3 Edited wiki page PresetMaps and added section for .hwp mission maps.
pntanasis@gmail.com
parents: 323
diff changeset
    41
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    42
----
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    43
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    44
= Files =
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    45
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    46
Within the folder of every map the following files are expected to be there:
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    47
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    48
== Basic files ==
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    49
=== map.cfg ===
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    50
Configuration file.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    51
323
b1f26e44ce70 Add 0.9.19 static map changes.
kyberneticist@gmail.com
parents: 279
diff changeset
    52
  * First line is the name of the [Theme] used by the map (for background and clouds, flakes, water, etc).  As of 0.9.19+, this theme may be overridden when setting up the game.
105
5aafdbd7206f Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 97
diff changeset
    53
  * Second line is max. number of hedgehogs supported. If the second line is not provided, it is assumed to be 18
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    54
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    55
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    56
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    57
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    58
=== map.png ===
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    59
Image of visible land area.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    60
  * Usually _width/length ratio_ of 2:1
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    61
  * Typical size: 2048 x 1024
339
1664d3e63c05 Geek out a bit on map dimension constraints.
kyberneticist@gmail.com
parents: 336
diff changeset
    62
  * Max size: no limit, 0.9.18+.  4096 x 2048 or less in 0.9.17 and earlier.  There are a few practical limits to map size that should be examined for people trying to make very large maps.
371
3f01f1fd7bb3 Edited wiki page PresetMaps through web user interface.
kyberneticist@gmail.com
parents: 370
diff changeset
    63
    * SDL 1.2 - SDL 1.2 can only load maps that are <=16,384px wide, and <=65,536px high. SDL 1.2 rect is only capable of handling a map that is <=32768 high, while behaviour in Hedgewars 0.9.20 or lower forces <=16,384 if using a mask.png without a map.png.
344
477866a345aa More being nerdy about map sizes.
kyberneticist@gmail.com
parents: 343
diff changeset
    64
    * SDL 2.0 - SDL 2.0 failed to load a 999,936x512 map. A 499,968x512 map succeeded. Those would use ~244MiB/~122MiB of your graphics card with Blurry Land enabled, and ~977MiB/~488MiB without it.
341
763c9378cb7f No. Wait # is numbers. It actually uses indentation..
kyberneticist@gmail.com
parents: 340
diff changeset
    65
    * GIMP.  GIMP 2.8 can only create PNGs that are 262,144px wide or high - is an arbitrary hardcoded sanity check.  GIMP 2.10 allows 524,288 wide or high.
343
eaa95eb40e0f Edited wiki page PresetMaps through web user interface.
kyberneticist@gmail.com
parents: 342
diff changeset
    66
    * libpng - libpng can only load maps that are < 1 million px wide or high, with default configuration.
341
763c9378cb7f No. Wait # is numbers. It actually uses indentation..
kyberneticist@gmail.com
parents: 340
diff changeset
    67
    * Graphics card. This is the big one. Your graphics card probably has anywhere from 256MiB to 2GiB of vRAM.  If blurry land is enabled and the map has a typical amount of empty space, you can make a map w/ ~2x the pixels as a card has vRAM. But. Most people don't like using Blurry Land, so best to limit to ~½ the pixels as a card has vRAM. Targetting support for people on 256MiB of vRAM, that means a 2:1 rectangular map should not be larger than 16,384x8192 which coincidentally fits in the SDL 1.2 width limit.
763c9378cb7f No. Wait # is numbers. It actually uses indentation..
kyberneticist@gmail.com
parents: 340
diff changeset
    68
    * There is also a completely arbitrary check in game for widths/height < ~billion pixels which avoids possible integer issues, and a limit on size in pixels of 6 billion or so, which was just a basic sanity limit.  However given the limitations above, these are not likely to be reached.
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    69
  * If there is no _mask.png_, this image will also be used for deciding what pixels are subject to collision: _alpha value_ not equal to 0 (so below max transparency) will be considered land
345
3027ad3155d5 Edited wiki page PresetMaps through web user interface.
kyberneticist@gmail.com
parents: 344
diff changeset
    70
  * As of 0.9.19+, map.png is optional if a mask.png is provided.  If there is no map.png, the theme will be used to decorate the map.  No objects will be added to white areas.  Use black if you want objects.
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    71
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    72
=== preview.png ===
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    73
Preview image of the map
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    74
  * size: 256 x 128_
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    75
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    76
== Optional files (for advanced features and adjustments) ==
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    77
=== mask.png ===
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    78
Image defining the collision areas of the map.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    79
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    80
  * Pixels with _alpha value_ = 0 will not be subject to collision
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    81
  * White pixels will be terrain
151
33266ae95c27 Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 106
diff changeset
    82
  * Red pixels will be indestructible terrain (regardless of game mode settings)
153
23efe87db6b6 Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 152
diff changeset
    83
  * Black pixels will be terrain with background texture applied (Note: Adding any black pixels removes erasure protection from areas where the map.png is solid but the mask.png is transparent) - 0.9.17+
23efe87db6b6 Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 152
diff changeset
    84
  * Blue pixels will be ice - 0.9.17+
372
3ba6ae9321df Edited wiki page PresetMaps through web user interface.
kyberneticist@gmail.com
parents: 371
diff changeset
    85
  * Green pixels block portals - 0.9.18+  In 0.9.20+ they are implemented as "bouncy" - this is used for the Rubber weapon.  This mask can be used normally for maps or theme objects.  If bouncing is implemented and the green pixels should only block portals, place a dotted line of single red/black/white pixels a few pixels above the green, spaced a few pixels apart.  This will keep most objects from interacting with the green, but prevent portal spawning.
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    86
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    87
*Examples:*
264
215c1770969b Updated mask values
kyberneticist@gmail.com
parents: 242
diff changeset
    88
  * [http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Maps/portal/mask.png Mask]  of [http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Maps/portal/map.png Portal Map]
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    89
(Transparent areas may not be recognizeable as such in your browser/image preview program, so open e.g. in [http://www.gimp.org/ Gimp])
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    90
97
0803dadcc229 Edited wiki page PresetMaps through web user interface.
sheepyluva
parents: 96
diff changeset
    91
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    92
=== map.lua ===
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    93
A Lua-script to be used together with the map.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    94
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    95
See the LuaGuide for more information on Hedgewars' scripting support.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    97
== Image format ==
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
    98
  * PNG, 8-bit/color RGBA (so 32 bit)
105
5aafdbd7206f Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 97
diff changeset
    99
  * Gamma correction and colour profiles should not be applied, in order to ensure the map is loaded identically on OSX as it is on other operating systems by SDL.  To ensure this happens, please run:
5aafdbd7206f Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 97
diff changeset
   100
pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB old/map.png new/map.png
106
ee13fb16ebb5 Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 105
diff changeset
   101
105
5aafdbd7206f Edited wiki page PresetMaps through web user interface.
kyberneticist
parents: 97
diff changeset
   102
or be sure your image editing software has these options disabled.
96
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   103
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   104
----
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   105
= Editing software recommendations =
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   106
== Images ==
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   107
A vector based drawing software is recommended for creating the maps.
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   108
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   109
(Reasons for that: Edges are usually automatically smoothed on export; Easier to meet [http://www.hedgewars.org/node/704 Hedgewars Graphics rules, style constraints, guidelines]; Images are easier to change, adjust and maintain style)
59ea111dd004 Created wiki page through web user interface.
sheepyluva
parents:
diff changeset
   110
97
0803dadcc229 Edited wiki page PresetMaps through web user interface.
sheepyluva
parents: 96
diff changeset
   111
If you don't have one, check out the free open-source [http://inkscape.org Inkscape]: There are various [http://lmgtfy.com/?q=inkscape+tutorial Inkscape tutorials] online, so you should be able to get started easily.