Hats.wiki
author Wuzzy
Mon, 04 Apr 2016 13:23:57 +0100
changeset 842 bf0f267dfc06
parent 798 30c5f1ebd552
child 902 a2e754d243cf
permissions -rw-r--r--
GearTypes: Revert link
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 ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
     9
There are two types of hats: non-team hats and team hats.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    10
Non-team hats have a fixed coloring which does not depend on the team color.
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
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    14
In the default Hedgewars installation, most hats are non-team hats.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    15
Examples for team hats in the default Hedgewars installation are cap_team
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    16
and hair_team. Please note that those hats currently have no proper
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    17
preview images.
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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    21
They consist of a set sub-images of a size 32px×32px each.
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
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    25
_All_ hats are animated. Even those hats which appear to be “static” (for example: `constructor`)
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    26
are animated, too, they use the animation to align the hat to the idle hedgehog.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    27
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    28
=== Non-team hats ===
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    29
Non-team hats use an image of a total size of 64px×512px. Only the first
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    30
19 frames are used, the remainder of the image is currently unused.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    31
It is best to keep this area blank.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    32
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    33
=== Team hats ===
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    35
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    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.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    37
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    38
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
    39
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    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.
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
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    43
== Alignment ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    44
When creating new hats, it is important to now where the hat will be actually placed.
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
In the game, Hedgewars will use the idling frames (see `Data/Graphics/Hedgehog/Idle.png`)
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    47
together with the hat frames.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    48
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
    49
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
    50
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    51
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
    52
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
    53
and so on.
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    54
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    55
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
    56
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
    57
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
    58
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    59
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
    60
|| *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
    61
|| 1 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    62
|| 2 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    63
|| 3 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    64
|| 4 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    65
|| 5 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    66
|| 6 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    67
|| 7 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    68
|| 8 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    69
|| 9 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    70
|| 10 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    71
|| 11 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    72
|| 12 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    73
|| l3 || +1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    74
|| 14 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    75
|| 15 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    76
|| 16 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    77
|| 17 || −1 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    78
|| 18 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    79
|| 19 || 0 px ||
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    80
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    81
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
    82
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    83
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    84
== Installation ==
520
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    85
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
    86
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
    87
b006de5eeed1 Started a technical guide about hats. May need extension.
almikes@aol.com
parents:
diff changeset
    88
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
    89
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
    90
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
    91
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
    92
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
    93
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    94
== Templates ==
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
    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.
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
    96
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
    97
=== Non-team hats ===
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
    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.
523
0527898a6e2d Rewrote templates section.
almikes@aol.com
parents: 522
diff changeset
    99
You can use this image to exactly align the hat properly.
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   100
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
   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.
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   102
522
2b6da59e5489 Add SVG template.
almikes@aol.com
parents: 521
diff changeset
   103
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
   104
=== Team hats ===
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
   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.
521
5c3e756ee5e3 Add templates.
almikes@aol.com
parents: 520
diff changeset
   106
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
   107
The XCF source of this file is here: [https://www.hedgewars.org/images/Team_Hat_Template.xcf Team_Hat_Template.xcf].
663
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   108
797
ffa20ab0669b Hats: link to hat list
Wuzzy
parents: 750
diff changeset
   109
== Default hats ==
ffa20ab0669b Hats: link to hat list
Wuzzy
parents: 750
diff changeset
   110
An overview of the hats which are included with Hedgewars by default can be viewed in the browser here: [https://hedgewars.googlecode.com/hg/misc/hats_js_anim.xhtml]
ffa20ab0669b Hats: link to hat list
Wuzzy
parents: 750
diff changeset
   111
750
bb84e70c01b7 Hats: Add title, fix header levels
Wuzzy
parents: 663
diff changeset
   112
== Sharing hats ==
663
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   113
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
   114
c20d902a6d1e Sharing section
Wuzzy
parents: 565
diff changeset
   115
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
   116
798
30c5f1ebd552 global replace of http with https for hedgewars.org wiki links
nemo
parents: 797
diff changeset
   117
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.