home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / deutex1b.zip / MANUAL / TRINITY.TXT < prev   
Text File  |  1994-09-19  |  16KB  |  364 lines

  1.                    Trinity.Wad: How I Made It.
  2.              For lost drunken men who no longer know
  3.               where they are, but DO care. (Cell #2)
  4.                           Steve McCrea
  5.                <<FIRST DRAFT 8th September 1994>>
  6.  
  7.  
  8.  
  9.  
  10.  
  11. ----------------------------------------------------------------------------
  12.  
  13.     This information is published with DeuTex 
  14.         with permission from Steve McCrea
  15.  
  16.  
  17. Examples are taken from doomtex, which was used for TRINITY.WAD.
  18. to convert doomtex format to DeuTex format, simply add a '*' then a space
  19. before each patch name (not before wall names). Here is an example:
  20.  
  21. --------
  22. doomtex:
  23. -------- 
  24. DOORCRST 128 128
  25.                 door11_1 4 0
  26.                 door11_1 124 0
  27.                 door11_1 -116 0
  28.                 pcrest4 46 37
  29. -------
  30. DeuTex:
  31. -------
  32. DOORCRST 128 128
  33. *               door11_1 4 0
  34. *               door11_1 124 0
  35. *               door11_1 -116 0
  36. *               pcrest4 46 37
  37.  
  38. case is not significant for DeuTex, but it was for doomtex.
  39.  
  40. ----------------------------------------------------------------------------
  41.  
  42.  
  43.  
  44.  
  45. I am writing this article in response to numerous inquiries about the
  46. techniques used in the creation of Trinity, and in particular a
  47. direct request from Ian Mapleson. It is in no way intended as a
  48. textbook approach, and I accept no responsibility for any time wasted
  49. as a result of following the procedures documented here. I may stray
  50. from the subject matter from time to time, as I said to the producer
  51. last week... Although titled "How I Made It", this may not be
  52. strictly true. I leave it as an exercise to the reader to determine
  53. which bits have been glossed over for clarity.
  54.  
  55. LEVEL DESIGN
  56.  
  57. As with all design, it is important to have the right tools and be
  58. familiar with them. I restricted myself unnecessarily at this early
  59. stage by only downloading DEU. I think this was a big mistake.  The
  60. other editors out there may well have some great features I missed
  61. out on totally. I know, for instance, that at least one of the others
  62. supports auto stair contruction. But since I didn't get the others, I
  63. don't know what else is available to speed design.  My recommendation
  64. for those starting out in WAD design is to get them all, find out
  65. which does what best and then mix and match. You may find yourself
  66. using one for most of the layout and then just switching quickly to
  67. another to do some trick or other. Hopefully you won't get too
  68. confused!
  69.  
  70. Before I started on Trinity, I had designed a few mini-levels in DEU.
  71. The first was just one room, then I did a couple of Wolfenstein
  72. levels, and so on. This got all the big mistakes out of the way,
  73. such as overlaying lines and vertices, splitting sectors wrongly,
  74. and losing work because DEU crashed. Then I laid out the courts in
  75. Trinity from memory, and ran about in Doom checking that the scale
  76. felt right.  Initially there was an area surrounding the college but
  77. I dropped it because it was going to be boring, and the map was huge
  78. anyway.  I left most walls the standard texture, and only added
  79. things like wood for gates. Having satisfied the sense of scale, I
  80. put in most of the rooms and passages, and added rough doors.
  81.  
  82. SCANNING PHOTOGRAPHS
  83.  
  84. About this time, I realised that it would be doing the college an
  85. injustice to use the standard Doom textures. I decided to scan some
  86. photographs of the college and put them in, so I borrowed Peter
  87. Morgan's (thanks Pete) camera on a sunny day and wandered over to
  88. Trinity. I tried to make the photographs I took clear from
  89. obstruction, shadow free and square to the viewer, i.e., with as
  90. little distortion as possible. I then scanned standard sized 6"x4"
  91. prints at on average 150dpi with Bill Milne's (thanks Bill) colour
  92. scanner. I used Adobe PhotoShop on Bill's Mac to straighten the
  93. images and crop off what I was sure I didn't need, but I DIDN'T
  94. change the resolution or convert from 24 bit colour and I DIDN'T
  95. crop right up to the edges of what I wanted.
  96.  
  97. This was AFTER the test run on the Wren library, the southern upper
  98. wall of the southwest courtyard (NOTE: Apologies to those who know
  99. Trinity: yes, I have rotated the college 90 degrees!), when I scaled
  100. the image to 64x256 and saved it as an 8 bit GIF. If you look
  101. carefully at the texture in the level, you will see that it is now
  102. 128 wide, scaled from 64!  Yech. I wasn't going to make that mistake
  103. again, although I couldn't be bothered to rescan the Wren library.
  104.  
  105. When I was pretty sure what size I wanted for graphics, I COPIED
  106. the images, cropped, scaled, tinted, smoothed, converted to GIF, and
  107. so on.  Some graphics didn't tile very well, and I either touched
  108. them up to tile properly (e.g., stone) or mirrored one half (e.g.,
  109. the windows on the outside of the dining hall).
  110.  
  111. There are three hand drawn graphics in Trinity: the sky, plaster, and
  112. the burgundy wood panelling. Again I started with a 24 bit palette,
  113. and used the pencil and airbrush tools before blending, motion
  114. blurring, tinting etc. to produce the final image. Several edit
  115. cycles were required to get something that I was (sort of) happy with
  116. in Doom.
  117.  
  118. TALL WALLS
  119.  
  120. The standard Doom texture is a maximum of 128 pixels high, and on
  121. walls higher than this the texture repeats vertically. Clearly I
  122. didn't want this in Trinity, so I use a couple of tricks to avoid it.
  123. On walls with void space behind (no sector behind) a sector is added
  124. with floor and ceiling heights chosen to divide the wall into
  125. sections less than 128 high. (Notice that I say _less_ than 128 high.
  126. Initially you might think, as I did, that 128 high would be perfect.
  127. However, if there is a substantial colour change from top to bottom
  128. of a texture then, as in Trinity, glitches appear on the walls at the
  129. dividing lines due to round off in the vertical texture mapping.)
  130.     _____________
  131.    /   added     \
  132.   /    sector     \
  133. ---------------------
  134.       tall wall
  135.                     ----------------- top of wall
  136.           |           upper texture
  137.           |         ----------------- ceiling of added sector
  138.           +---->      normal texture
  139.                     ----------------- floor of added sector
  140.                       lower texture
  141.                     ----------------- bottom of wall
  142. Textures are applied as shown. The line between the sectors is marked
  143. as 2S/Im/So in DEU, i.e., two sided, impassable, and blocks sound.
  144. The blocks sound bit is to reduce the size of the REJECT data. See
  145. the unofficial specs for details. The impassable bit is to prevent
  146. you or monsters going into the sector (I had this problem with skulls
  147. initially. It was disturbing to find skulls appearing from nowhere!).
  148. The normal texture must be a single patch or the Medusa effect (looks
  149. like snakes and you turn to stone) will occur.
  150.  
  151. In Doom, each texture is constructed from one or more graphics
  152. patches. The texture definition contains no image data, just the size
  153. of the texture, and a list of patches and their position in the
  154. texture. The _patch_ definition contains the image data.
  155.  
  156. For walls which already had sectors behind them (e.g., above a doorway)
  157. non-repeating tall textures are acheived by "stepping" the wall. A
  158. separate sector is required for each step. In side view,
  159.  
  160.             ------- ceiling
  161.            |
  162.            |<-- top texture
  163.            |
  164.           -
  165.          |
  166.          |<-- middle texture
  167.          |
  168. ---------
  169.  
  170.       doorway
  171. ------------------- floor
  172. This is not as neat as the other method because the ceiling texture
  173. of the sector between the top and middle textures will always be
  174. visible, and must be chosen to minimise breaking up the look of the
  175. wall. It is also harder to add because the sector should clearly
  176. be very thin (in Trinity they are 2 units thick) and this is very
  177. fiddly work away from the autogrid.
  178.  
  179. GRAPHICS ADDITION
  180.  
  181. Initially I just replaced patches in single patch textures. I hacked
  182. around with dmgraph to make it convert a GIF directly to a patch.
  183. Then I used a program I had previously written for sound lumps to
  184. make a PWAD of patches with names the same as the names of patches in
  185. single patch textures. These then replaced the same-named patches
  186. when the PWAD is included using -file.
  187.  
  188. However a better solution was necessary as (a) I was running out of
  189. single patch textures, and (b) I needed some user defined multipatch
  190. textures. So I wrote a program to convert the texture definition
  191. entries in the main Doom WAD to an ASCII format, and another which
  192. recreated the binary definition entries from the ASCII format. The
  193. big advantage of this method was that it allowed the creation of NEW
  194. textures with sensible names like "stone" and "plaster". A typical
  195. definition of a new texture "doorcrst", a 128x128 texture with
  196. three old patches and one new:
  197.  
  198. DOORCRST 128 128
  199.                 door11_1 4 0
  200.                 door11_1 124 0
  201.                 door11_1 -116 0
  202.                 pcrest4 46 37
  203.  
  204. For textures to repeat properly when the length is greater than the
  205. width of the texture, the width should be a power of two. For some
  206. reason, the "aastinky" texture in Doom is 24 units wide. The last
  207. eight columns of the graphic will never be seen (but they're not
  208. very exciting anyway).
  209.  
  210. The first released version of Trinity had redefined switch textures,
  211. so that when the switch was encountered later in the standard levels,
  212. it looked really bad. In the second version I fixed this by setting
  213. the switches into walls so that only the switch part of the texture
  214. was visible. This is _highly_ recommended for levels which may be
  215. grouped into PWAD episodes.
  216.  
  217.          old switch texture
  218.                | 
  219.                v
  220.            x--------x <-- thin sector with 'metal' textures
  221.   -----x---x--------x---x-----
  222.          ^            ^    wall
  223.          |            |
  224.          +------------+------ new switch surround
  225.  
  226. Actually it's just occurred to me that there is a neater, if more
  227. memory hungry, way to do this seamlessly. Widen the switch texture
  228. and put the new switch on the right of the old one, then when using
  229. your new switch offset the texture by the appropriate amount. As
  230. long as no other levels use a repeated switch on a wall, then this
  231. is perfect. For example, say you wanted a new switch pair, you could
  232. tack them on the right of the SW1BRN1 and SW2BRN1 switch pair. The
  233. original definition of SW1BRN1 is
  234. SW1BRN1 64 128
  235.                 wall02_2 0 56
  236.                 wall02_2 0 0
  237.                 sw3s0 16 75
  238. which you redefine to be
  239. SW1BRN1 256 128
  240.                 wall02_2 192 56
  241.                 wall02_2 192 0
  242.                 wall02_2 64 56
  243.                 wall02_2 64 0
  244.                 wall02_2 0 56
  245.                 wall02_2 0 0
  246.                 sw3s0 16 75
  247.                 pplast 96 0
  248.                 pplast 160 0
  249.                 sw3s0 144 75
  250. The old switch is still at offset 0. The new switch is at offset 128.
  251. Note the repetition of the wall patch. This allows for roundoff error
  252. in the texture mapping engine, which expects similar texture to be
  253. just to the left and just to the right of the texture being drawn.
  254. Don't forget to define the other switch position SW2BRN1 similarly!
  255. This technique allows for a large number of different switch designs
  256. to be used in a PWAD. Not that I'm condoning the use of a large
  257. number of switches in PWADs - in fact, some of the best PWADs are
  258. totally ruined by switches everywhere. (No Return01s, I mean names,
  259. mentioned. Speaking of which, which I'm not of course, did you know
  260. that there are two graphics added to Return to Phobos? Switches!
  261. Both of them! Good grief, Michael! _Beautiful_ WAD, but...)
  262.  
  263. Note: remember to make the textures a power of two wide if you want to
  264. allow for roundoff.
  265.  
  266. The programs I mention in this section are available as a zip
  267. dmtex10c.zip at infant2. Alternatively you could try deutex by Olivier
  268. Montanuy which is easier to use, and will be supported and updated.
  269.  
  270. THE "ANIMATION"
  271.  
  272. If you haven't seen Trinity.WAD, I recommend you look at it before
  273. reading this section as it contains a massive spoiler. However if you
  274. haven't seen Trinity you probably aren't reading this document (?!?),
  275. so...
  276.  
  277. Several people have asked how the cyberdemon movie is done. I have
  278. even heard it described as "voodoo magic"! Nothing could be further
  279. from the truth. It is actually very simple. To quote Matt Fell in
  280. the unofficial Doom specs 1.3,
  281.  
  282.        "It is possible to change the walls and floors that are
  283. animated, like the green blocks with a sewer-like grate that's
  284. spewing green slime (SLADRIPx). The game engine sets up as many as 8
  285. animation cycles for walls based on the entries in the TEXTURE
  286. resources, and up to 5 based on what's between F_START and F_END. The
  287. entries in FirstTexture and LastTexture, below, and all the entries
  288. between them (in the order that they occur in a TEXTURE list), are
  289. linked. If one of them is called by a sidedef, that sidedef will
  290. change texture to the next in the cycle about 5 times a second,
  291. going back to First after Last. Note that the entries between First
  292. and Last need not be the same in number as in the original, nor do
  293. they have to follow the same naming pattern, though that would
  294. probably be wise. E.g. one could set up ROCKRED1, ROCKREDA, ROCKREDB,
  295. ROCKREDC, ROCKREDD, ROCKREDE, ROCKRED3 for a 7-frame animated wall!"
  296.  
  297. Hence the movie in Trinity is defined in the ASCII texture file as a
  298. series of textures SLADRIP1, MOVIE01, MOVIE02, ..., MOVIE98,
  299. SLADRIP3. The important thing is the order in which the textures
  300. are listed. The Doom EXE contains the names of the FirstTextures
  301. and LastTextures so it isn't possible to have additional animation
  302. cycles in a PWAD.
  303.  
  304. And because the sprites and the Doom logo have the same format
  305. as patches, they are just listed as if they were patches. For
  306. example, a frame of the movie is defined
  307.  
  308. MOVIE08 256 128
  309.                 pblak 0 0
  310.                 pblak 64 0
  311.                 pblak 128 0
  312.                 pblak 192 0
  313.                 t 67 40
  314.                 r 86 40
  315.                 i 106 40
  316.                 n 124 40
  317.                 i 144 40
  318.                 t 162 40
  319.                 y 181 40
  320.                 m_doom 67 50
  321.                 cybre7 -20 20
  322.                 playf3f7 198 64
  323.  
  324. where "pblak" is a totally black patch, and t, r, i, n, and y are
  325. the characters. Initially, the movie used the character set in the
  326. game but this caused crashes (for a reason I won't go into now) so
  327. after consulting iD, I included the character set again in the PWAD
  328. with new names.
  329.  
  330. The technique described in the Graphics Addition section for adding
  331. new switches can also be applied to new animated textures. Just
  332. make the new animation length a multiple of the old length, and
  333. put the old animation at the left of the textures. Don't forget to
  334. satisfy the roundoff errors! You could squeeze twenty or more thin
  335. animations into a large texture!
  336.  
  337. THE SKY
  338.  
  339. You may not have noticed, but the sky in the latest version of Trinity
  340. doesn't repeat anywhere around the horizon. (Thanks to Olivier
  341. Montanuy, author of DeuTex, for teaching me this trick.) This is done
  342. by defining a sky texture (SKY1, SKY2, or SKY3 depending on the
  343. episode) which is 1024x128 in size, and pasting patches into it so
  344. that 0=East, 256=North, 512=West, and 768=South. Note that this means
  345. that the textures are left/right mirrored! I can't think of any way
  346. to make the sky texture animated. However you could fake twin skies
  347. by only allowing the player to see half the sky during one part of a
  348. level, and then later only allowing him to see the other half! A
  349. crap example would be bright blue skies -> red skies+mushroom cloud.
  350. It's probably a good idea to disorient the player in between with,
  351. for example, a teleport, so he doesn't catch on to the trick too
  352. quickly.
  353.  
  354. CONCLUSION
  355.  
  356. In this document I have outlined some techniques which can be used to
  357. seemingly extend the Doom engine. The use of these inevitably slows
  358. down Doom and so should be used sparingly, unless you _really_ need
  359. (well, really _want_, anyway) the effect.
  360.  
  361. If you're about to start your first big WAD, collect together as many
  362. tools as you can, and read all the documentation you can find,
  363. particularly the Unofficial specs. Good luck!
  364.