Alien Trilogy MAP

From XentaxWiki
Jump to: navigation, 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

The game does not interact with the three-dimensional map and the 3D model is just a decoration. All moving objects are described in the section D000, which is responsible for dynamic objects. 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

 Size                  Comment
--------------------------------------------------
 0x01        -         X coordinate? Like Plyer start position
 0x01        -         Y coordinate? Like Plyer start position
 0x01        -         Pickup type, index
                                   Types:
                                    0 - pistol
                                    1 - shotgun
                                    2 - pulsator
                                    3 - flamethrower
                                    4 - smart gun
                                    5 - not used
                                    6 - seismic charge
                                    7 - battery (for switches using the 
                                                    "battery" type)
                                    8 - night vision goggles
                                    9 - pistol clip
                                   10 - shotgun cartridges
                                   11 - pulsator holder
                                   12 - underbarrel grenade for a grenade launcher
                                   13 - fuel for a flamethrower
                                   14 - clip for smart gun
                                   15 - identification card (which flies 
                                           out of the colonists / guards)
                                   16 - auto map
                                   17 - hyper pack
                                   18 - armor (acid west), apparently protects against acid
                                   19 - simple armor
                                   20 - first aid kit
                                   21 - bandage (+1 health)
                                   22 - safety boots
                                   23 - adrenaline
                                   24 - bandage?
                                   25 - soldier's lamp 
                             The types above can be lifted, the following are not 
                               lifted (apparently used for debugging)
                                   26 - a case from a shotgun
                                   27 - a sleeve from a pistol
                              Values ??above 27 (28 and beyond) 
                              consistently result in flyouts.
 0x01       -        The number that the pickup gives out when lifting
 0x01       -        Some kind of multiplier for the previous value
 0x01       -        An incomprehensible value, like zero everywhere
 0x01       -        Apparently Z coordinate
 0x01       -        Also some kind of quantity for a pickup, it is not clear how it works.

One box format

The format of "boxes" (apparently 16 bytes), one nuance, in the field of boxes, not only boxes are described. Special objects such as barrels or switch models can also be described in this field.

 Size                  Comment
--------------------------------------------------
 0x01      -          X coordinate?
 0x01      -          Y coordinate?
 0x01      -          Type of "box" (Apparently and type and model at the same time)
                      Types:
                       19 - a box that cannot be blown up
                       20 is a regular box that can be blown up
                       21 - empty object (at the moment), 
                         maybe a switch for levels on the ship
                       22 - another small switch, 
                         the difference is at the bottom of the model (lightning is drawn)
                       23 - barrel explodes.
                       24 - switch with animation (small switch)
                       25 - "double box" (two boxes on top of each other that can be blown up)
                       26 - wide switch with zipper
                       27 - wide switch without zipper
                       28 - an empty object that can be shot
                       29 - an empty object that can be shot through, something will spawn on death
                       30 - is a regular box that can be blown up

 0x01      -       What the object will spawn upon death 00 - apparently a pickup, 
                                02 - apparently a monster
 0x02      -       Until I realized what these two bytes do
 0x01      -       Apparently the index of the object that needs to be spawned
 0x01      -       Apparently the index of the second object that needs to be spawned
 0x08      -       Incompletely understandable values, the last two bytes somehow influence
                             the speed at which spawned objects fly out


One door format

 Size                  Comment
--------------------------------------------------
 0x01       -          X coordinate
 0x01       -          Y coordinate
 0x01       -          Incomprehensible byte
 0?01       -          Door open time
 0x01       -          Door tag (for use in collage blocks)
 0x01       -          Incomprehensible byte
 0x01       -          Angle of rotation of the door model relative to the map
 0x01       -          Model index from section D000 \ 1 \ 2 \ 3 ...