Hats.wiki
author Wuzzy
Fri, 17 Nov 2017 05:38:23 +0000
changeset 1130 216ffcca9ede
parent 1129 8d4ef9a49b08
child 1131 bfaa8cfa4138
permissions -rw-r--r--
Hats: Simplify list of templates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     1
#summary Explanation of hats, how Hedgewars draws them and how one can create them
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     2
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
     3
= Hats =
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
     4
== Introduction ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     5
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     7
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
     8
== Types of hats ==
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
     9
There are two types of hats: normal hats and team hats.
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    10
Normal hats look always the same.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    11
Team hats are hats which will be colored accordingly to the team color.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    12
I.e. if a hedgehog plays in a red team, its hat will we red.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    13
1126
756712384ff3 Hats: Edited via web interface
Wuzzy
parents: 1125
diff changeset
    14
Additionally, hats can be either static or animated.
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    15
1126
756712384ff3 Hats: Edited via web interface
Wuzzy
parents: 1125
diff changeset
    16
In the default Hedgewars installation, most hats are normal hats, and many hats are animated.
1129
8d4ef9a49b08 Hats: broken hat preview
Wuzzy
parents: 1128
diff changeset
    17
Examples for team hats in the default Hedgewars installation are `cap_team` and `hair_team`. Please note that in 0.9.23, the preview of some team hats in the team editor is broken ([https://issues.hedgewars.org/show_bug.cgi?id=448 bug 448]).
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    18
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    19
== Data structure ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    20
Hats are specified as PNG files with alpha channel.
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    21
They consist of a set of sub-images of a size 32px×32px each.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    22
Hedgewars counts the sub-images, or animation frames, from top-left to
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    23
bottom-left, then it goes on with the next column, etc.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    24
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    25
=== Static normal hats ===
1126
756712384ff3 Hats: Edited via web interface
Wuzzy
parents: 1125
diff changeset
    26
These are the simplest hats. 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.
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    27
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    28
That's it!
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    29
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    30
=== Static team hats ===
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    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.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    32
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    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.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    34
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    35
=== Animated normal hats ===
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    36
Animated normal hats use an image of a total size of 64px×512px. Only the first
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    37
19 frames are used, the remainder of the image is unused. It is best to keep the unused area transparent.
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    38
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    39
=== Animated team hats ===
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    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.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    41
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    43
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    44
Hedgewars will use the right base image and use the colored right part of the image and simply overlay it.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    45
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    47
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    48
== Alignment of hats ==
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    49
When creating hats, it is important to know where the hat will be actually placed.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    50
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    51
For static hats, this is trivial: Hedgewars will just move the hat up by 5 pixels before drawing it on the hedgehog.
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    52
The hat will automatically slightly bounce up and down with the hedgehog idle animation.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    53
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    54
Now to animated hats:
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    55
In the game, Hedgewars will use the idling frames (see `Data/Graphics/Hedgehog/Idle.png`)
1125
2e4c07468366 Hats: Add static hats
Wuzzy
parents: 903
diff changeset
    56
together with the hat frames. For static hats, the reference point is the first frame of `Idle.png`.
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    57
If a hat is used, Hedgewars will draw the hat over the idling hedgehog for each frame, but
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    58
first it will move the hat’s frame up by 5 pixels.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    59
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    60
The first frame of the hat animation will be drawn over the first frame of the idle animation,
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    61
the second frame of the hat animation will be drawn over the second frame of the idle animation,
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    62
and so on.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    63
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    64
Another tricky part in creating hats is the fact that the idle hedgehog moves slightly up and down.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    65
This means, a good hat must consider this, otherwise the hat does not seem to be actually on the
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    66
hedgehog’s hat, because it does not move with the hedgehog.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    67
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    68
This table shows the relative height of the idle hedgehog compared to the frist frame of `Idle.png`:
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    69
|| *nth frame of `Idle.png`* || *Offset to first frame* ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    70
|| 1 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    71
|| 2 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    72
|| 3 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    73
|| 4 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    74
|| 5 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    75
|| 6 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    76
|| 7 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    77
|| 8 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    78
|| 9 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    79
|| 10 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    80
|| 11 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    81
|| 12 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    82
|| l3 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    83
|| 14 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    84
|| 15 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    85
|| 16 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    86
|| 17 || −1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    87
|| 18 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    88
|| 19 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    89
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    90
This is how to read this table: If you would like to create a simple hat with no fancy animation, like, let’s say, a fedora, you would like the hat to “follow” the hedgehog. You could, for example, draw and align the hat image on the first frame, then copy it on all other frames and apply the offsets to the four “special” frames.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    91
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    92
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    93
== Installation ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    94
To install a hat, you have to save the file into `Data/Graphics/Hats` in your Hedgewars
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    95
user data directory. The file name _must_ end with “`.png`”.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    96
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    97
The Hedgewars frontend will display the same name as the file name you used, minus the file name
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    98
suffix. For example, the file “`Awesome Example Hat.png`” would be displayed as “Awesome Example Hat”.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    99
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   100
Hedgewars will always use the very first frame of a hat image to create the preview in the team editor. This also applies to team hats.
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   101
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   102
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
   103
== Templates ==
1130
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   104
For your convenience, we have created some templates to ease the creation of hats to help you to align the hats pixel-perfectly. You can use them as background layer to help you align your hats.
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   105
1130
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   106
* Static normal hat: [https://www.hedgewars.org/images/Static_Hat_Template.png Static_Hat_Template.png]
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   107
* Static team hat: [https://www.hedgewars.org/images/Static_Team_Hat_Template.png Static_Team_Hat_Template.png]
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   108
* Animated normal hat: [https://www.hedgewars.org/images/Hat_Template.png Hat_Template.png]
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   109
* Animated team hat: [https://www.hedgewars.org/images/Team_Hat_Template.png Team_Hat_Template.png]
1127
87e8bb1e7a29 Hats: Edited via web interface
Wuzzy
parents: 1126
diff changeset
   110
1130
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   111
For GIMP users, we also have XCF files with layers for your convenience:
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   112
* Animated normal hat: [https://www.hedgewars.org/images/Hat_Template.xcf Hat_Template.xcf]
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   113
* Animated team hat: [https://www.hedgewars.org/images/Team_Hat_Template.xcf Team_Hat_Template.xcf]
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   114
1130
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   115
=== Quick explanation ===
216ffcca9ede Hats: Simplify list of templates
Wuzzy
parents: 1129
diff changeset
   116
You can use these images as a background layer. They show 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.
663
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   117
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
   118
== Sharing hats ==
663
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   119
Custom hats (hats which are not part of the official Hedgewars installation) are only visible to other players if they have the hat installed under the same file name.
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   120
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   121
In case the other player does not have the custom hat installed, the player will see no hat instead.
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   122
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
   123
You are encouraged to share your hats in the thread “[https://www.hedgewars.org/node/690 Hats! additions, submissions, information.]”, where submissions are considered for official inclusion into Hedgewars.