data dirs renamed
[k8-i-v-a-n.git] / Doc / Data / Graphics.txt
blob8e1aaeb4ddf0f9487fe3116cc31ec004f068d769
1 Iter Vehemens ad Necem graphics documentation
2 ---------------------------------------------
4 The material color system
5 -------------------------
7 Most IVAN graphics use special palette indices to mark areas whose
8 color may vary depending eg. on material, on skin color or on special
9 magical effects. These are called material colors or m-colors. Up to
10 four m-colors may be used in one picture and each may exist in 16
11 different brightness levels. The palette indices attached to each
12 m-color are:
14 m-color 1:      192-207
15 m-color 2:      208-223
16 m-color 3:      224-239
17 m-color 4:      240-255
19 When objects and beings are created, IVAN first determines which
20 actual colors are to appear in place of m-colors. It breaks these
21 colors into RGB components and analyzes the tile pixel by pixel.
22 If it encounters an m-color, the components of the color appearing
23 at that place in game are determined as follows:
25 [component in game]
26 = [requested component]
27 * ([palette index] - [lowest index of that particular m-color])
28 / 8
30 rounded down, or 255, whichever is smaller.
32 Example: a mithril spear is generated. The game knows that the edge
33 is always drawn using m-color 1 and the handle/shaft using m-color
34 2. (see file descriptions below for more info about when a particular
35 m-color should be used) Mithril's and wood's RGB values are found
36 in material.dat and equal 224:224:224 and 140:96:48. While scanning
37 the spear tile, suppose index 202 is encountered. It belongs to
38 m-color 1 gradient. The color appearing in the game (under normal
39 light conditions) will be
41 Red = min(224 * (202-192) / 8 = 280, 255) = 255
42 Green = min(224 * (202-192) / 8 = 280, 255) = 255
43 Blue = min(224 * (202-192) / 8 = 280, 255) = 255
45 i.e. pure white. Next suppose index 214 is encountered. The
46 resulting color is
48 Red = min(140 * (214 - 208) / 8 = 105, 255) = 105
49 Green = min(96 * (214 - 208) / 8 = 72, 255) = 72
50 Blue = min(48 * (214 - 208) / 8 = 36, 255) = 36
52 which is slightly darker than the requested color.
54 Note that you don't have to understand this formula to make
55 good-looking graphics. Use the same m-colors as the other tiles
56 in the particular file and you'll do fine.
58 Indices 0-190 are called regular colors or r-colors and they appear
59 in each picture in the same way. Graphics designers may change the
60 RGB values of r-colors as needed, but they should be careful not
61 to ruin existing pictures by doing so.
63 Index 191 is used for the transparent color and its RGB value must
64 be 255:0:255. Areas filled with this index will not be drawn in the
65 game.
67 Graphics files
68 --------------
70 (*) uses m-colors
72 char.pcx (*)            non-humanoid character graphics
73 cursor.pcx              the cursor
74 font.pcx (*)            the default font
75 fow.pcx                 the fog of war tile
76 glterra.pcx (*)         ground terrain graphics
77 humanoid.pcx (*)        humanoid bodypart graphics
78 icon.bmp                the banana and pick-axe icon
79 item.pcx (*)            item graphics
80 menu.pcx                the main menu background
81 olterra.pcx (*)         over terrain graphics
82 symbol.pcx              symbols and explosions
83 wterra.pcx              world map terrain graphics
85 char.pcx
86 --------
88 All graphics of non-humanoid characters (those that don't have
89 severable bodyparts) are contained herein. They must be 16x16,
90 although these exists two 32x32 pictures which are reserved for
91 future. The actual colors are defined in char.dat but may be
92 overridden in the code. The m-colors which may be used are:
94 m-color         char.dat value
95 1               SkinColor
96 2               TorsoMainColor
97 4               TorsoSpecialColor
99 M-color 1 should always be the main color of the picture. Others
100 are used only in certain pictures like carnivorous plants, which
101 have varying flower colors. Indices 195-200, 211-216 and 243-248
102 tend to be the best choices; beyond that the colors are often too
103 dark or bright in the game.
105 The character silhouette used in the game panel is also located
106 here. The format should be pretty obvious, except that it is a
107 mirror image, i.e. that the right leg and the right arm are on the
108 left and vice versa, because they are that way in the silhouette's
109 view (it is thought to look at the user's direction).
111 Btw. that guy on the right side of the pcx file is our head
112 graphics designer being tortured for missing yet another
113 deadline.
115 cursor.pcx
116 ----------
118 The cursor shown over the player or in the lookmode etc. Size
119 must be 16x16. Index 255 is used for the transparent color.
120 It must be 255:0:255.
122 font.pcx
123 --------
125 This file contains the character set used for the text in the game.
126 It should include ascii-characters 32-255. Each or the 14 lines
127 should have 16 characters. All characters should be m-color 1,
128 located in distinct 16x16 pixel blocks but using only an 8x8 area.
129 In the game the pixels are material colorized and little shades are
130 added to them, so that they actually use a 9x9 area in the picture.
132 fow.pcx
133 -------
135 The fog of war tile, which is masked blitted over tiles not seen
136 but vaguely memorized. Size must be 16x16. Index 0 is used for the
137 transparent color. It must be 0:0:0. The reason for the odd color
138 is optimization; if a completely dark square is added to the
139 player's fow area, this picture is blitted in the memory instead
140 of creating a black tile and masked blitting fow.pcx onto it.
142 glterra.pcx
143 -----------
145 Ground terrains, for instance grass and floors are located here.
146 They must be 16x16. M-color 1 depends on the material. Other
147 colors are defined in glterra.dat as follows:
149 m-color         glterra.dat value
150 2               MaterialColorB
151 3               MaterialColorC
152 4               MaterialColorD
154 M-color 1 should always be the main color of the picture.
155 The tiles should be quite bright so that eg. a stone golem on a
156 stone floor can be seen easily. Indices 198-201, 214-217, 230-233
157 and 246-249 seem to be the best. For obvious reasons, the
158 transparent color may not be used.
160 humanoid.pcx
161 ------------
163 All humanoid bodypart pictures are contained herein. They must be
164 16x16. The first two vertical lines are allocated for leg/groin
165 pics, the next two for torsos, the next for arms and the next for
166 heads. The four columns on the right are for "in hands pictures"
167 which aren't currently used, so ignore them. Humanoid pictures
168 are build up from these bodyparts, and if the character loses for
169 example a limb, its graphic is removed from his/her tile and the
170 severed limb item will use it instead.
172 The leg/groin pictures actually contain three different bodyparts:
173 right leg, left leg and groin. Only the six last lines in the
174 16x16 tiles are used, and the pixels allocated for each bodypart
175 are shown in the following map:
177 rrrrrgggggglllll
178 rrrrrrggggllllll        r = right leg
179 rrrrrrrgglllllll        g = groin
180 rrrrrrrrllllllll        l = left leg
181 rrrrrrrrllllllll
182 rrrrrrrrllllllll
184 Note that the right leg is on the left and vice versa, because
185 it is that way in the character's view (he/she always looks at
186 the user's direction).
188 The arm picture contains both left and right arms. The left half
189 of the picture is allocated for the right arm and vice versa,
190 for the reason above.
192 The actual colors are defined in char.dat but may be overridden
193 in the code. The m-colors which may be used are:
195 Leg/groin pictures:
197 m-color         char.dat value
198 1               SkinColor
199 2               LegMainColor (clothes)
200 3               BootColor
201 4               LegSpecialColor
203 Torso pictures:
205 m-color         char.dat value
206 1               SkinColor
207 2               TorsoMainColor (clothes)
208 3               BeltColor
209 4               TorsoSpecialColor
211 Arm pictures:
213 m-color         char.dat value
214 1               SkinColor
215 2               ArmMainColor (clothes)
216 3               - (reserved for future)
217 4               ArmSpecialColor
219 Head pictures:
221 m-color         char.dat value
222 1               SkinColor
223 2               CapColor
224 3               HairColor
225 4               EyeColor
227 Defining the ClothColor value in char.dat sets LegMainColor,
228 TorsoMainColor, ArmMainColor and CapColor all at once.
230 Preferable material color indices are the same as those in char.pcx.
232 icon.bmp
233 --------
235 The window icon. Must be 32x32. Index 255 is used for the
236 transparent color. It must be 255:255:255.
238 item.pcx
239 --------
241 All item graphics are stored here, with the exception of severed
242 bodyparts, which use the tiles in humanoid.pcx. They must be 16x16,
243 although one 32x32 pictures exists which is reserved for future.
244 The colors depend on the material as follows:
246 Weapons:
248 m-color         depends on
249 1               edge material
250 2               handle/shaft material
252 Containers (cans, bottles, etc.):
254 m-color         depends on
255 1               container material
256 2               contained material
258 Other items:
260 m-color         depends on
261 1               material
263 Other m-colors must be overridden in the source code for each
264 item. M-color indices 197-203, 213-219 and 229-235 seem to
265 look best in the game.
267 menu.pcx
268 --------
270 The main menu background. Must currently be 800x600.
272 olterra.pcx
273 -----------
275 Over terrains, for instance walls and decorations are located
276 here. They must be 16x16. M-color 1 depends on the material.
277 Other colors are defined in olterra.dat as follows:
279 m-color         olterra.dat value
280 2               MaterialColorB
281 3               MaterialColorC
282 4               MaterialColorD
284 Fountain is an exception, since its m-color 2 depends on
285 contained material (water, for example). Indices 197-199,
286 213-215, 229-231 and 245-247 seem to be the best for outlook.
288 symbol.pcx
289 ----------
291 Collection of miscellaneous symbols used in the game. Sizes
292 must be 16x16. Index 255 is used for the transparent color.
293 It must be 255:0:255.
295 Explosions are also currently stored here. They should be square-
296 shaped and their sides should be an odd number times 16 in length.
298 wterra.pcx
299 ----------
301 All world map graphics are contained here. Index 255 is used for
302 the transparent color, and it must be 255:0:255.
304 Ground terrains dominate the upper part of the file and they are
305 stored in 48x48 squares so that the middle 16x16 square is the
306 actual tile and the others are so called border tiles which may
307 be drawn over lower terrain to make forest borders etc. look
308 much better.
310 Here's an exact explanation of how this happens. Each pair of
311 (vertically, horizantally or diagonally) adjacent squares on
312 the world map is scanned, and their terrains are compared based
313 on a priority value which been attached to all terrains and is
314 determined solely by outlook factors. If the values are the equal,
315 i.e. the terrains are the same, no borders will be drawn,
316 otherwise a suitable border tile of the terrain with the higher
317 priority is drawn over the other. Note that of all terrains,
318 water has the least priority, so it doesn't need border tiles.
319 Instead, it has 16 wave animation frames which make it look more
320 vivid in the game.
322 Care must be taken that each side of a tile fits correctly
323 to the opposide side and to the attached border tile. Note
324 also that multiple border tiles may be drawn over a tile and
325 even over each other and they still must look good.
327 Beneath the ground terrain tiles are the over terrains. They
328 are much easier to draw, since one 16x16 tile is enough. Also
329 a nice smiley is included, just to make all people making
330 graphics happy.
332 End of document
333 ---------------