home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / FAQSYS18.ZIP / FAQS.DAT / DESCSPEC.TXT < prev    next >
Text File  |  1996-08-18  |  13KB  |  327 lines

  1. Descent Level and Mission Format 0.20 <-- Note the version number!
  2. ------- ----- --- ------- ------ ----
  3.  
  4. Legal Notice
  5. ----- ------
  6.  
  7. All material in this document, and the attached source code, is copyright
  8. Parallax Software, 1995.  It is released solely for the purpose of enabling
  9. legitimate owners of the registered version of Descent to create levels and
  10. missions to be used with Descent.  The release of this information should
  11. in no way be construed as implying that copyrights, patents, trademarks or
  12. trade secrets of Descent, owned by Parallax or Interplay, are weakened or
  13. invalidated.
  14.  
  15.  
  16. Description
  17. -----------
  18.  
  19. This document describes the level and mission format for the registered
  20. version of Descent.  It is hoped that this information will help people
  21. create their own levels and missions for use with Descent.  This document
  22. is not complete without the attached source code.
  23.  
  24. The source code is available at:
  25.  
  26.   wuarchive.wustl.edu   pub/MSDOS_UPLOADS/descent/lvlinfo.zip
  27.  
  28.  
  29. Notes About Version 0.20
  30. ----- ----- ------- ----
  31.  
  32. This document, as you might guess from the version number, is not
  33. considered complete.  It is released under the assumption that it's
  34. marginally better than nothing.
  35.  
  36. It will still be difficult for anyone to create an editor to create
  37. Descent levels.  It will be very difficult to create levels that contain
  38. all the features of a complete Descent level, such as keyed doors, locked
  39. doors, a control center which triggers doors, robots containing objects,
  40. materialization centers, etc.  However, it will be a lot easier with this
  41. document than without it.
  42.  
  43. This document, and the attached source code, should be enough to enable
  44. people to create anarchy levels and missions without unbearable difficulty.
  45. There is much information about objects which is not explained.  This will
  46. be released in a future update.  If you're real curious now, a good way to
  47. figure out this information is to disassemble an existing "rdl" file.
  48.  
  49. Improved versions of this document will be posted here on an irregular
  50. basis.  I hope a significantly better version will be posted within a
  51. couple weeks.
  52.  
  53. If you find errors in this document, and you will probably find many if
  54. you try to use it, please post them in alt.games.descent.  Put some
  55. identifying information in the Subject, such as "Level Info Error: Hog
  56. File Format Bogus" or whatever.
  57.  
  58. Please read the section "About the Included Source Code".  This document
  59. should not be considered anywhere near complete without constant reference
  60. to the source code, particularly the header files.
  61.  
  62. Good luck!  All of us at Parallax are looking forward to seeing new levels!
  63.  
  64. -- Mike Kulas, March 17, 1995
  65.    Revised June 21, 1995
  66.  
  67.  
  68. Plea for Peace
  69. ---- --- -----
  70.  
  71. Please do not contact Parallax or Interplay with questions regarding
  72. information in this document.  We do not have the resources to answer
  73. questions pertaining to level design.  We have several people who read
  74. alt.games.descent and comp.sys.ibm.pc.games.action every day.  If you
  75. have questions, please post in these newsgroups and we will answer them
  76. as best we can.
  77.  
  78.  
  79. About the Included Source Code
  80. ----- --- -------- ------ ----
  81.  
  82. The source code included with this document is provided as a document
  83. of the level format.  Although it started as actual source code from
  84. Descent, it is no longer compilable, and much has been removed from
  85. the provided functions, including some comments.  However, the portions
  86. which pertain to loading level data are most likely accurate and
  87. complete.  In cases in which this document contradicts the source code,
  88.  
  89. the source code should be considered complete.
  90.  
  91. The header files contain data structure definitions.  Some of them
  92. describe the internal representation of a level, which is very different
  93. from the format stored in an "rdl" file.  They are provided as a reference
  94. to help understand the source code which reads an "rdl" file.
  95.  
  96. Related source code and this document available at:
  97.   wuarchive.wustl.edu   pub/MSDOS_UPLOADS/descent/lvlinfo.zip
  98.  
  99.  
  100. Overview of Level-Related Files
  101. -------- -- ------------- -----
  102.  
  103. A Descent level is wholly contained in one file.  These files have the
  104. extension "rdl" for Registered Descent Level.
  105.  
  106. The "rdl" files which are part of Regsitered Descent are all included in
  107. the file "descent.hog".  There are, by default, no "rdl" files present
  108. in the Descent directory.  However, if there _were_ an "rdl" file, and
  109. it were specified in the "msn" file, it would get loaded, taking precedence
  110. over the version of the level in the "hog" file.  So, if you wanted to
  111. create a new level 1, you would name it "level01.rdl" and place it in the
  112. Descent directory.  It would get loaded in favor of the level01.rdl in the
  113. hog file.
  114.  
  115.  
  116. Format of RDL File
  117. ------ -- --- ----
  118.  
  119. [Before proceeding with writing an editor, I would strongly encourage
  120.  anyone to write a level ("rdl" file) disassembler.  That should
  121.  demonstrate whether the information in this document is correct, in
  122.  addition to providing necessary expertise.  Before disassembling level
  123.  files, you will need to disassemble the "hog" file.  That will be the
  124.  easiest part.  See the section "Format of the Hog File".]
  125.  
  126. The function load_level(), which is included in the partial source code,
  127. reads a level file from disk.
  128.  
  129. load_level calls load_mine_data_compiled and load_game_data.
  130. load_mine_data_compiled loads mine (level structure) data.  load_game_data
  131. loads other things which are part of a mine, such as objects (robots,
  132. powerups, etc.), initial player position information, etc.
  133.  
  134. Beginning at location 0 in the RDL file:
  135. int    sig            // signature bytes == 'PLVL' (in order 'L' 'V' 'L' 'P')
  136. int    version            // set this to 1
  137. int    minedata_offset        // offset in file of start of mine data
  138. int    gamedata_offset        // offset in file of start of game data
  139. int    unused            // unused
  140.  
  141. From location minedata_offset:
  142. byte    version            always = 0
  143. short    Num_vertices        number of vertices in this mine
  144. short    Num_segments        number of segments in this mine
  145.  
  146. Num_vertices vertex structs.
  147.  
  148.   A vertex struct is defined as three fixed point numbers.  A fix
  149.   is 32 bits.  The low 16 bits is fractional, the high 16 bits is
  150.   the integer.
  151.  
  152. Num_segments segment structs.
  153.  
  154.   A segment is a variable size structure.  To understand the format, it
  155.   is necessary to read the source code included with this document.
  156.   The function load_mine_data_compiled_new reads a variable sized segment
  157.   from the "rdl" file and stores it in the internal segment struct.
  158.   The internal segment struct is described in another section below.
  159.  
  160.  
  161. From location gamedata_offset:
  162. short    signature        // bytes 05h, 67h
  163. short    version            // 0019h (we're at version 25 for release...)
  164. int    game_fileinfo_size    // 0077h
  165. char    mine_filename[15];    // for example, "Lunar Outpost"
  166. int     level;
  167. int     player_offset;
  168. int     player_sizeof;
  169. int     object_offset;
  170. int     object_howmany;       
  171. int     object_sizeof;  
  172. int     walls_offset;
  173. int     walls_howmany;
  174. int     walls_sizeof;
  175. int     doors_offset;
  176. int     doors_howmany;
  177. int     doors_sizeof;
  178. int     triggers_offset;
  179. int     triggers_howmany;
  180. int     triggers_sizeof;
  181. int     links_offset;
  182.  
  183. int     links_howmany;
  184. int     links_sizeof;
  185. int     control_offset;
  186. int     control_howmany;
  187. int     control_sizeof;
  188. int     matcen_offset;
  189. int     matcen_howmany;
  190. int     matcen_sizeof;
  191.  
  192. short    Num_pofs        number of Polygon Object Files
  193. char    Pof_names[Num_pofs][13]    name of each pof file
  194.     
  195. From object_offset (read above):
  196. object    Objects[object_howmany]    static object info for each object.  See object struct.
  197.  
  198. From walls_offset (read above):
  199. wall    Walls[walls_howmany]    static wall info.  See wall struct.
  200.  
  201. From doors_offset (read above):
  202. active_door ActiveDoors[doors_howmany]    See active_door struct.
  203.  
  204. From triggers_offset (read above):
  205. trigger    Triggers[triggers_howmany]
  206.  
  207. From control_offset (read above):
  208. control_center_trigger    Control_center_triggers[control_howmany]
  209.  
  210. From matcen_offset (read above):
  211. matcen_info    RobotCenters[matcen_howmany]
  212.  
  213.  
  214. Internal Segment Struct
  215. -------- ------- ------
  216.  
  217. typedef long fix;
  218.  
  219. typedef struct vms_vector {
  220.    fix x, y, z;
  221. } vms_vector;
  222.  
  223. typedef struct uvl {
  224.    fix u,v,l;
  225. } uvl;
  226.  
  227. typedef struct side {
  228.    byte   type;                // tri_edge: 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation
  229.    ubyte  pad;                 // keep us longword alligned
  230.    short  wall_num;            // Index into Walls array, which wall (probably door) is on this side
  231.    short  tmap_num;            // Index into array of textures specified in bitmaps.bin
  232.    short  tmap_num2;           // Index, as above, texture which gets overlaid on tmap_num
  233.    uvl    uvls[4];             // uvl coordinates at each point
  234.    vms_vector   normals[2];    // 2 normals, if quadrilateral, both the same.
  235. } side;
  236.  
  237. typedef struct segment {
  238.    side    sides[6];          // 6 sides
  239.    short   children[6];       // indices of 6 children segments, front, left, top, right, bottom, back
  240.    short   verts[8];          // vertex ids of 4 front and 4 back vertices
  241.    short   objects;           // index of objects in this segment
  242.    ubyte   special;           // special property of a segment (such as damaging, trigger, etc.)
  243.    byte    matcen_num;        // which center segment is associated with, high bit set
  244.    short   value;             // matcens: bitmask of producable robots, fuelcenters: energy given? --MK, 3/15/95
  245.    fix     static_light;      // average static light in segment
  246.    short   pad;               // make structure longword aligned [Too bad we didn't put this before static_light...MK, 3/15/95]
  247. } segment;
  248.  
  249. The 8 vertex indices in the verts array define the 6 sides of the segment.
  250. The following shows which vertices form which side.  Vertices are oriented
  251. counter-clockwise looking at the side from the outside of the segment.
  252.  
  253. left    7,6,2,3
  254. top    0,4,7,3
  255. right    0,1,5,4
  256. bottom    2,6,5,1
  257. back    4,5,6,7
  258. front    3,2,1,0
  259.  
  260. So, for example, if the verts array = 10, 11, 12, 13, 14, 15, 16, 17
  261. then the right side is made up of the vertices 10, 11, 15, 14.  These
  262. vertices (10, 11, 15, 14) are indices into the global Vertices array.
  263.  
  264. Format of Mission Files
  265. ------ -- ------- -----
  266.  
  267. Levels are organized into missions which are specified in a "msn" file.
  268. (The default mission, "Descent: First Strike" is built into the executable
  269. and does not have a corresponding mission file.)  The file "chaos.msn"
  270. defines the five level anarchy mission which is part of the registered
  271. version.  Here is the complete text of the file "chaos.msn":
  272.  
  273. name = Total Chaos    ;any name you want
  274. type = anarchy        ;can be "normal" or "anarchy".  Omitted means normal
  275. num_levels = 5        ;number of normal levels
  276. chaos1.rdl            ;level filename 1
  277. chaos2.rdl            ;level filename 2
  278.  
  279. chaos3.rdl            ;level filename 3
  280. chaos4.rdl            ;level filename 4
  281. chaos5.rdl            ;level filename 5
  282.  
  283. It should be pretty self-explanatory.  All the "rdl" files are present in
  284. the file "chaos.hog".
  285.  
  286. Here's a more interesting mission.  Note that it contains a secret level
  287. named "levels1.rdl" which is attached to level 10.
  288.  
  289. name = Destination Saturn    ;any name you want
  290. type = normal                ;can be "normal" or "anarchy".  Omitted = normal
  291. num_levels = 15              ;number of normal levels
  292. level01.rdl                  ;level filename 1
  293. level02.rdl                  ;level filename 2
  294. level03.rdl                  ;level filename 3
  295. level04.rdl                  ;level filename 4
  296. level05.rdl                  ;level filename 5
  297. level06.rdl                  ;level filename 6
  298. level07.rdl                  ;level filename 7
  299. level08.rdl                  ;level filename 8
  300. level09.rdl                  ;level filename 9
  301. level10.rdl                  ;level filename 10
  302. level11.rdl                  ;level filename 11
  303. level12.rdl                  ;level filename 12
  304. level13.rdl                  ;level filename 13
  305. level14.rdl                  ;level filename 14
  306. saturn15.rdl                 ;level filename 15
  307. num_secrets = 1              ;number of secret levels
  308. levels1.rdl,10               ;get to first secret level from level 10
  309.  
  310.  
  311. Format of the Hog File
  312. ------ -- --- --- ----
  313.  
  314. A hog file has the following format:
  315.  
  316.   <header>   The constant bytes: 44h, 48h, 46h
  317.  
  318. Following the header are zero or more files in the following format:
  319.  
  320.   <name>     13 bytes, terminated by 0, padded, if necessary, to 13 bytes
  321.   <size>     4 byte size
  322.   <data>     <size> bytes of data comprising the file
  323.  
  324.   <name>     next file in the hog file
  325.   etc.
  326.  
  327.