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