BAS files

BAS files are packages that contain other files, mostly model files including wireframes, textures and animations.

File locations

/<datadir>/setX/objects/ contains usually two files, SET.bas and BEEBOX.bas, the former being the most interesting as it contains all vehicle and building models.

/<datadir>/objects/ contains sky files which usually consist of one or two VBMP texture files.

BAS file contents

The BAS files can contain objects of different types:

Skeleton/wireframe files, sklt extension

VBMP files (textures), ilbm extension. Not to be confused with ILBM files!

“Base” objects and animations, format currently unknown.

BAS file format

What's in side the BAS file? Well, it's a good thing we have an EA85/IFF parser (a lot of sections left out on purpose)

BAS files follow standard EA85/IFF format. The basic structure is well documented but the contents used in UA are not completely understood.

Use the new BAS Compiler available at http://forums.metropolisdawn.com/viewtopic.php?f=23&t=1467 to open/modify/save .BAS and .SKLT files

ATTS Section

The follows a fixed structure and its length *should* always be divisible by 6:

2 bytes: “polyID”
1 byte: “colorVal”
1 byte: “shadeVal”
1 byte: “tracyVal”
1 byte: “padding”

Note: It can be seen in the SET.BAS files that not all ATTS section lengths are divisible by 6, some contain additional data.

A T T S
00000036
0000 00 0b 80 00
0003 00 64 80 00
0004 00 6e 80 00
0005 00 78 80 00
0006 00 00 80 00
0008 00 0a 80 00
0009 00 14 80 00
000a 00 3c 80 00
000b 00 46 80 00

approximate C++ parsing source from https://github.com/Marisa-Chan/UA_source/blob/44bb2284bf15fd55085ccca160d5bc2f6032e345/src/amesh.cpp#L266:

                amesh->**polyCnt**  = **chunk->TAG_SIZE / 6**;
                amesh->atts = new ATTS[amesh->polyCnt];
...
                for (int i = 0; i <amesh->polyCnt; i++)
                {
                    mfile->**readS16B** (amesh->atts[i].**polyID**);
                    mfile->**readU8** (amesh->atts[i].**colorVal**);
                    mfile->**readU8** (amesh->atts[i].**shadeVal**);
                    mfile->**readU8** (amesh->atts[i].**tracyVal**);
                    mfile->**readU8** (amesh->atts[i].**pad**);
}

OLPL Section

The OLPL section has the same structure as the POL2 section in a Skeleton file however the number of entries is not present.

  • The OLPL section should be loaded together with the corresponding ATTS section because the number of OLPL entries matches the number of ATTS entries.
  • The number of ATTS entries is calculated by ATTS_len / 6
O L P L
00000052
0004 01 77 83 77 83 C4 01 C4
0004 01 78 3C 78 3C C4 01 C4
0004 3C 78 83 78 83 C4 3C C4
0004 02 75 02 3E 5A 3E 5A 75
0004 02 3F 02 15 5A 15 5A 3F
0003 14 7F 27 86 27 B6
0003 27 B6 14 BB 14 7F
0003 6F BB 5C B6 6F 7F
0003 5C B6 5C 86 6F 7F

OTL2 Section

FIXME : More info Only related to ground textures

ff7f807fab41

STRC Section

BASE STRC Structure:

62 bytes total

version = 0x0001

struct STRC_base
{
    int16_t version;
    xyz pos;
    xyz vec;
    xyz scale;
    int16_t ax;
    int16_t ay;
    int16_t az;
    int16_t rx;
    int16_t ry;
    int16_t rz;
    int16_t attFlags;
    int16_t _un1;
    int32_t visLimit;
    int32_t ambientLight;
};

ADE STRC Structure:

10 bytes total

version = 0x0001

struct ADE_STRC
{
    int16_t version;
    int8_t _nu1; // Not used
    int8_t flags;
    int16_t point;
    int16_t poly;
    int16_t _nu2; // Not used
};

AREA STRC Structure:

10 bytes total

version = 0x0100

struct AREA_STRC
{
    int16_t version;
    uint16_t flags;
    uint16_t polFlags;
    uint8_t _un1;
    uint8_t clrVal;
    uint8_t trcVal;
    uint8_t shdVal;
};

BANI STRC Structure (unconfirmed)

variable length (6 bytes + zero_terminated_anim_name)

https://github.com/Marisa-Chan/UA_source/blob/44bb2284bf15fd55085ccca160d5bc2f6032e345/src/bmpAnm.cpp#L126

struct BANI_STRC
{
int16_t version
int16_t BANM_ATT_NAME_OFFSET
int16_t BANM_ATT_ANIMTYPE
char *BANM_ATT_NAME
};

FIXME

Dummy Entries:

For each model, there should be 6 entries (VPw, VPf, VPg, VP_, VPx, VPd). The absence of any section for a model should be filled with a dummy entry.

Understanding Naming Convention

     visproto.lst -> filename
      vp_normal   -> VP_NAME
      vp_fire     -> VPfNAME
      vp_megadeth -> VPdNAME
      vp_wait     -> VPwNAME
      vp_dead     -> VPxNAME
      vp_genesis  -> VPgNAME

Editing tools

Hex editors are needed for low-level inspection and editing, examples include HxD, frhed and Bless Hex Editor

SKLT extractor by GoldStar unpacks skeleton files from BAS files.

VBMP extractor by GoldStar unpacks VBMP files from BAS files.

LabVIEW BAS/SKLT viewer by GoldStar can be used to view the contents of BAS files and display skeleton files in 3D environment.

Texture editor pack (download) by GoldStar contains tools needed to extract and replace existing VBMP texture files inside BAS files.

modding/bas_file.txt · Last modified: 2017/07/29 00:45 by goldstar611
Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0