Alien Trilogy MAP

From XentaxWiki
Revision as of 17:29, 24 May 2021 by imported>LexSafonov
Jump to navigation Jump to search

MAP

  • Format Type : File container/MAP File
  • Extensions: .MAP
  • Platforms: PC/PS1/Sega Saturn
  • Endian Order : Little Endian/Big Endian

MAP Format specifics

This article will be quite extensive, since the format of the map is large enough. The format is in many ways similar to BND, it also has "sections" with "names" in its set, with its own peculiarities. The file with the map is also accompanied by a file with a texture and a texture mesh (for 3D geometry). The following sections are found in this file:
MAP0 - a section with a description of the map itself (geometry, logic, collision)
D000 (0,1,2 ....) - Dynamic objects on the map, such as doors \ elevators \ other objects

Despite the fact that the file has few sections, however, the section with information about the map itself has many "blocks" that are not marked with anything and information about them is only in the header of the section itself. This article will describe all the blocks that have been found empirically, as well as their structure and formulas by which they are calculated.

MAP Format Description

Current format description at the moment. Description of each block below.

// Alien Trilogy
// MAP File format
 Size             Comment
--------------------------------------------------
 0x04        46 4F 52 4D     FORM
 0x04        -               file data size in bytes, BIG-ENDIAN
 0x04        -               the number of maps in the file with text.(zero, text) 

- then there is information about the geometry of the map and its content, namely:
 Size             Comment
--------------------------------------------------
 0x04        -               Map name, text
 0x04        -               Map data size, BIG-ENDIAN
 0x02        -               Number of vertices? LITTLE-ENDIAN
                             Formula - multiply the value of these two bytes by 8
                                    (6 bytes for 3 points + 2 bytes zeros)

 0x02        -               Number of quads (rectangles) .LITTLE-ENDIAN
                             Formula - the value of these 2 bytes multiply by 20 
                                    (16 bytes dot indices and 4 bytes info)

 0x02        -               The length of the "rectangle" of the mini-map 
                             (physics engine)(Little-Endian)
 0x02        -               The width of the "rectangle" of the mini-map 
                             (physics engine)(Little-Endian)
                             Formula for these bytes = multiply length by width and 
                              multiply the resulting value by 16
                                    (16 bytes describe one cell.)

 0x02         -              The starting position of the player along the X-axis
 0x02         -              Player's starting position along the Y axis
                             A small correction about the X and Y positions. 
                             When walking, the "X / Y numbers" of the square 
                             are written in the positions
                             collisions, not fixed coordinates like vertices.

 0x02         -              Unknown bytes.

 0x02         -              Field describing monsters that simply spawn.
                             Formula = number of elements multiplied by 20
                                         (20 bytes per monster)

 0x02         -             Pickup description field 
                            Formula = number of elements multiplied by 8
                                        (8 bytes per pickup)

 0x02         -             Description field for "boxes" and 
                            similar objects (switches, barrels)
                            Formula = number of elements multiplied by 16  
                                        (16 bytes per box)
 0x02         -             Number of all doors on the map.
                            Formula = value multiplied by 8 
                                      (8 bytes one element)

 0x02         -             Unknown bytes.

 0x02         -             Player's Start Angle

 0x06         -             Unknown bytes

 0x04         -             Unknown value, somehow affects
                            on monsters at the level. If there are monsters on the level
                            and set zeros, then rendering is disabled for monsters
                            sprites, but they themselves do not disappear                                                   

One vertex format

 Size                 Comment
--------------------------------------------------
 0x02     -           X coordinate (signed, LITTLE-ENDIAN, short)
 0x02     -           Y coordinate
 0x02     -           Z coordinate
 0x02     -           unknown value, it seems to be always 0

One quad format

 Size                  Comment
--------------------------------------------------
 0x04      -           First point. LITTLE-ENDIAN
 0x04      -           Second point
 0x04      -           Third point
 0x04      -           Is the fourth point. maybe -1 (0xFFFFFFFF), 
                       then this is a triangle and you 
                       need to duplicate the third point.

 0x02      -           Index of the quad texture
 0x02      -           Is a certain parameter. Apparently something on the display.

Format of one square of collision

From the experience with the heights of the blocks, at first glance, it turned out that a floor-ceiling system was used, as in a doom / duke. The logic of the engine becomes clear. Apparently the game is actually technically divided into a "grid of blocks" and takes the position of the block (length-line) as coordinates of objects. The rest is "considered" already further. Such a system also has its drawbacks, namely, doors and switches can be opened with the "back", because the engine in fact looks at the push of a button in the block itself.

 Size                  Comment
--------------------------------------------------
 0x04      -             Block Number? 

 0x02      -             Unknown bytes.
 0x02      -             Unknown bytes.

 0x01      -             It seems the height of the block 
                         ceiling rendering (black fog)
 0x01      -             It seems the height of the block 
                         floor rendering (black fog) (not exactly)

 0x01      -             Block ceiling height 
 0x01      -             Block floor height

 0x02      -             Unknown bytes.
 0x01      -             The color of the lighting in the block? 
                         I found the following values:
                            255 - colors red
                            64 - blinking red
                            128 - blue
                            160 - yellow
                            192 - gray?
                            224 - orange roofing felts, 
                                  red roofing felts.
                            from 1 to 10 - bright light in the block
                            11 to 17 - is it dark in the block?
                            18 - bright red blinks
                            20 - full light in the block
                            22 - orange blinks
                            24 - blinks dark orange
                            30 - blinks from dark to white

 0x01       -               Actions?(Open door, use switches and other...)
                            value:
                            1 - starting door
                            3 - a door that opens with a switch
                            9 - end of level

One monster format

 Size                  Comment
--------------------------------------------------
 0x01       -           Type of attack? (Maybe the type of monster)
 0x01       -           X coordinate? Like Plyer start position. 
 0x01       -           Y coordinate? Like Plyer start position.
 0x01       -           Z coordinate? (Apparently FF means to spawn on the floor)
 0x02       -           Number of health points (apparently in a fixed number)
 0x01       -           What object will spawn upon death (index)
 0x01       -           Incomprehensible byte, if it is greater than zero, 
                              then the monster will not spawn
 0?04       -           Incomprehensible bytes, the effect of the change is not clear.
 0x02       -           Incomprehensible bytes, changes are not noticeable 
                            (the angle of rotation when spawning is possible)
 0x02       -           The speed of movement of the object (monster).
 0?04       -           Incomprehensible bytes, the effect is not clear when changed. 
                          The same monster can have different meanings

One pickup format