Hats.wiki
changeset 1125 2e4c07468366
parent 903 b799ef7af3c8
child 1126 756712384ff3
equal deleted inserted replaced
1124:b37c99c55365 1125:2e4c07468366
     4 == Introduction ==
     4 == Introduction ==
     5 
     5 
     6 In Hedgewars, every hedgehog can optionally wear its own hat as decoration. They can be selected on a per-hog basis in the team editor.
     6 In Hedgewars, every hedgehog can optionally wear its own hat as decoration. They can be selected on a per-hog basis in the team editor.
     7 
     7 
     8 == Types of hats ==
     8 == Types of hats ==
     9 There are two types of hats: non-team hats and team hats.
     9 There are two types of hats: normal hats and team hats.
    10 Non-team hats have a fixed coloring which does not depend on the team color.
    10 Normal hats look always the same.
    11 Team hats are hats which will be colored accordingly to the team color.
    11 Team hats are hats which will be colored accordingly to the team color.
    12 I.e. if a hedgehog plays in a red team, its hat will we red.
    12 I.e. if a hedgehog plays in a red team, its hat will we red.
    13 
    13 
    14 In the default Hedgewars installation, most hats are non-team hats.
    14 Additionally, all hats can be animated.
    15 Examples for team hats in the default Hedgewars installation are cap_team
    15 
    16 and hair_team. Please note that those hats currently have no proper
    16 In the default Hedgewars installation, most hats are normal hats, and many hats have animations.
    17 preview images.
    17 Examples for team hats in the default Hedgewars installation are `cap_team` and `hair_team`. Please note that those hats currently have no proper preview images.
    18 
    18 
    19 == Data structure ==
    19 == Data structure ==
    20 Hats are specified as PNG files with alpha channel.
    20 Hats are specified as PNG files with alpha channel.
    21 They consist of a set sub-images of a size 32px×32px each.
    21 They consist of a set of sub-images of a size 32px×32px each.
    22 Hedgewars counts the sub-images, or animation frames, from top-left to
    22 Hedgewars counts the sub-images, or animation frames, from top-left to
    23 bottom-left, then it goes on with the next column, etc.
    23 bottom-left, then it goes on with the next column, etc.
    24 
    24 
    25 _All_ hats are animated. Even those hats which appear to be “static” (for example: `constructor`)
    25 === Static normal hats ===
    26 are animated, too, they use the animation to align the hat to the idle hedgehog.
    26 The simplest hat is a static normal hat. It's not animated. It's just a single 32×32 image containing the hat. This image will be put on the hedgehog's head with a vertical offset of 5 pixels.
    27 
    27 
    28 === Non-team hats ===
    28 That's it!
    29 Non-team hats use an image of a total size of 64px×512px. Only the first
       
    30 19 frames are used, the remainder of the image is currently unused.
       
    31 It is best to keep this area blank.
       
    32 
    29 
    33 === Team hats ===
    30 === Static team hats ===
    34 Team hats use an image of a total size of 128px×512px. This image is similar to that of non-team hats, the same pattern is repeated 64 pixels to the right.
    31 This is a 64px×32px image with 2 frames. The left half is the base coloring of the helmet, the right half should _only_ use grayscale colors. The left part may be completely blank. The same offset of 5 pixels applies here.
       
    32 
       
    33 To create the final image, Hedgewars will use the right base image and use the colored right part of the image and simply overlay it on the left image.
       
    34 
       
    35 === Animated normal hats ===
       
    36 Animated normal hats use an image of a total size of 64px×512px. Only the first
       
    37 19 frames are used, the remainder of the image is unused. It is best to keep the unused area transparent.
       
    38 
       
    39 === Animated team hats ===
       
    40 Animated team hats use an image of a total size of 128px×512px. This image is similar to that of animated normal hats, the same pattern is repeated 64 pixels to the right.
    35 
    41 
    36 The team hat image consists of two “halves”: The left half is the base coloring of the helmet, the right half should _only_ use grayscale colors. The left part may be completely blank. So you have basically two sets of helmet animations. Again, both animations have exactly 19 frames, the remainder is unused.
    42 The team hat image consists of two “halves”: The left half is the base coloring of the helmet, the right half should _only_ use grayscale colors. The left part may be completely blank. So you have basically two sets of helmet animations. Again, both animations have exactly 19 frames, the remainder is unused.
    37 
    43 
    38 Hedgewars will use the right base image and use the colored right part of the image and simply overlay it.
    44 Hedgewars will use the right base image and use the colored right part of the image and simply overlay it.
    39 
    45 
    40 Transparent pixels on the right part will not be overlayed. This way, you can decide which parts of the helmet become colored and which won’t.
    46 Transparent pixels on the right part will not be overlayed. This way, you can decide which parts of the helmet become colored and which won’t.
    41 
    47 
       
    48 == Alignment of hats ==
       
    49 When creating hats, it is important to know where the hat will be actually placed.
    42 
    50 
    43 == Alignment ==
    51 For static hats, this is trivial: Hedgewars will just move the hat up by 5 pixels before drawing it on the hedgehog.
    44 When creating new hats, it is important to know where the hat will be actually placed.
    52 The hat will automatically slightly bounce up and down with the hedgehog idle animation.
    45 
    53 
       
    54 Now to animated hats:
    46 In the game, Hedgewars will use the idling frames (see `Data/Graphics/Hedgehog/Idle.png`)
    55 In the game, Hedgewars will use the idling frames (see `Data/Graphics/Hedgehog/Idle.png`)
    47 together with the hat frames.
    56 together with the hat frames. For static hats, the reference point is the first frame of `Idle.png`.
    48 If a hat is used, Hedgewars will draw the hat over the idling hedgehog for each frame, but
    57 If a hat is used, Hedgewars will draw the hat over the idling hedgehog for each frame, but
    49 first it will move the hat’s frame up by 5 pixels.
    58 first it will move the hat’s frame up by 5 pixels.
    50 
    59 
    51 The first frame of the hat animation will be drawn over the first frame of the idle animation,
    60 The first frame of the hat animation will be drawn over the first frame of the idle animation,
    52 the second frame of the hat animation will be drawn over the second frame of the idle animation,
    61 the second frame of the hat animation will be drawn over the second frame of the idle animation,
    92 
   101 
    93 
   102 
    94 == Templates ==
   103 == Templates ==
    95 For your convenience, we have created some templates to ease the creation of hats. You can use them as background layer to help you align your hats.
   104 For your convenience, we have created some templates to ease the creation of hats. You can use them as background layer to help you align your hats.
    96 
   105 
    97 === Non-team hats ===
   106 === Animated normal hats ===
    98 A basic PNG template is [https://www.hedgewars.org/images/Hat_Template.png Hat_Template.png]. You can use this image as a background layer. This image shows a colored checkerboard pattern, each field represents an animation frame. The green and red fields are those where the idle hedgehog has an offset of +1px or −1 px (see above). The black fields are the unused frames. In the front, the idle hedgehog can be seen but shifted 5 pixels lower and the 5 lowest pixels cut off.
   107 A basic PNG template is [https://www.hedgewars.org/images/Hat_Template.png Hat_Template.png]. You can use this image as a background layer. This image shows a colored checkerboard pattern, each field represents an animation frame. The green and red fields are those where the idle hedgehog has an offset of +1px or −1 px (see above). The black fields are the unused frames. In the front, the idle hedgehog can be seen but shifted 5 pixels lower and the 5 lowest pixels cut off.
    99 You can use this image to exactly align the hat properly.
   108 You can use this image to exactly align the hat properly.
   100 
   109 
   101 This image is also available as XCF for GIMP users: [https://www.hedgewars.org/images/Hat_Template.xcf Hat_Template.xcf]. It got an additional layer and you can easily toggle a couple of layers on and off.
   110 This image is also available as XCF for GIMP users: [https://www.hedgewars.org/images/Hat_Template.xcf Hat_Template.xcf]. It got an additional layer and you can easily toggle a couple of layers on and off.
   102 
   111 
   103 
   112 === Animated neam hats ===
   104 === Team hats ===
       
   105 You can use [https://www.hedgewars.org/images/Team_Hat_Template.png Team_Hat_Template.png]. This is similar to the previous PNG. The hedgehogs on the right half are in gray to remind you that you only should use grayscale colors on this side.
   113 You can use [https://www.hedgewars.org/images/Team_Hat_Template.png Team_Hat_Template.png]. This is similar to the previous PNG. The hedgehogs on the right half are in gray to remind you that you only should use grayscale colors on this side.
   106 
   114 
   107 The XCF source of this file is here: [https://www.hedgewars.org/images/Team_Hat_Template.xcf Team_Hat_Template.xcf].
   115 The XCF source of this file is here: [https://www.hedgewars.org/images/Team_Hat_Template.xcf Team_Hat_Template.xcf].
   108 
   116 
   109 == Sharing hats ==
   117 == Sharing hats ==