BOD scene syntax

From X-Wiki

Jump to: navigation, search

BOD scene files are plain text files and can be modifed with common text editors (such as Microsoft Notepad).

Contents

Example of BOD scene

Example of BOD scene as exported with DBOX2:

/# Exported with dbox2 from gatling.max at 21.2.2006 8:36:39

VER: 6;

P 0; B ds\weapons\gatling\gatling_body; N ds\weapons\gatling\gatling_body;  // idx 0
{ 0x2002;  518; 7591; -5278;  0.000000; 0.000000; 0.000000; 0.000000;  -1; 1; } // 0

P 1; B ds\weapons\gatling\gatling_collar; N ds\weapons\gatling\gatling_collar;  // idx 1
{ 0xa002;  515; 7591; -3869;  0.000000; 0.000000; 0.000000; 0.000000;  0.0;0.0;0.0;0.0;0.0;  222; 1; } // 0
{ 0x8012;  0.333333; 0.000000; 0.000000; 1.000000;  0.0;0.0;0.0;0.0;0.0;  222; 2; } // 1
{ 0x8012;  0.333333; 0.000000; -0.000000; 1.000000;  0.0;0.0;0.0;0.0;0.0;  222; 3; } // 2
{ 0x8012;  0.333333; -0.000000; -0.000000; 1.000000;  0.0;0.0;0.0;0.0;0.0;  -1; -1; } // 3

Syntax and structure

BOD Scene is using standard BOD syntax.

Basic layout of BOD scene:

<version>

<path>
<frame 1>
<frame 2>
...
...

<path 2>
<frame 1>
<frame 2>
...
...

Scene file must start with version information (provided with the VER tag).

Then follows path definition (starting with P and ending before first curly bracket). Inside the curly brackets are animation frames. Every path must have at least one animation frame.

Path definition

Example:

 P 2; B ds\weapons\gatling\gatling_barrel; F 1; C 1; N ds\weapons\gatling\gatling_barrel; b l // idx 2

NOTE: This path definition is for demonstration purpose only - you will never see it with all the fields in real files.

P - means Path ID. It is used for referencing the path later with F field.

B - body file name. Name of file where the body data are stored. If it is a string then it is relative to objects directory. If it is a number then it is relative to objects\v (or objects\cut) directory.

F - parent (father) Path ID (see P). Such path is treated as relative to its parent (position/rotation values are relative to the parent position).

C - cockpit ID. Cockpits (turrets) are made of the actual viewport and guns. All these parts needs to have the same cockpit ID.

N - name. Name of the node in 3DS Max. Can be omitted.

b l - flags. See List of path flags.

List of path flags

  • c - camera. Body file is ignored and camera object is created instead. Used for cockpit (turret) viewport definitions.
  • l - omnidirectional light. Used mainly in X2 movie scenes.
  • d - directional light. Used mainly in X2 movie scenes.
  • b - body. Probably ignored by X3 engine.
  • j (u) - scene. Body file does not specify body file but scene file.

Animation frame

The most tricky part of scene file, the frame syntax was a mystery for a long time.

Example of animation frames:

  { 0xa002;  515; 7591; -3869;  0.000000; 0.000000; 0.000000; 0.000000;  0.0;0.0;0.0;0.0;0.0;  222; 1; } // 0
  { 0x8012;  0.333333; 0.000000; 0.000000; 1.000000;  0.0;0.0;0.0;0.0;0.0;  222; 2; } // 1

The key to animation frame is the first number. This number holds various flags which define what data are present in the frame.

Fields

(position is always present unless FLAG_SAMEPOS is present)

  • FIELD_ROT (0x2) - rotation is present
  • FIELD_4 (0x4) - unknown (never used)
  • FIELD_TARGETPOS (0x8) - target position is present
  • FIELD_SAMESCALE (0x100) - not used
  • FIELD_COLOR (0x200) - color information
  • FIELD_FOV (0x800) - field of view is present
  • FIELD_POSTCBINFO (0x4000) - position TCB info
  • FIELD_ROTTCBINFO (0x8000) - rotation TCB info
  • FIELD_POSBEZINFO (0x10000) - position bezier info
  • FIELD_TPOSTCBINFO (0x20000) - target position TCB info

Flags

  • FLAG_LINEAR (0x1) - linear position controller
  • FLAG_BEZIER (0x80) - bezier position controller
  • FLAG_SAMEPOS (0x10) - same position as in previous frame
  • FLAG_SAMEROT (0x20) - same rotation as in previous frame
  • FLAG_SAMETARGET (0x40) - same target
  • FLAG_SAMECOLOR (0x400) - same color
  • FLAG_SAMEFOV (0x1000) - same field of view
  • FLAG_ABSROT (0x2000) - rotation is absolute (euler xyz controller)
  • FLAG_FAKEROTTCBINFO (0x40000) - unknown

Order of fields in frame

  1. position
  2. TCB pos info
  3. rotation
  4. TCB rot info
  5. target pos
  6. TCB target pos info
  7. FOV
  8. color

Structure of fields

Position

3 values (integers)

  • -x -z -y

Rotation

4 values

  • angle - float (0 - 1.0)
  • x, y, z - integers

Target position

4 or 3 or 1 value(s) (depends on FLAG_SAME_TARGET and FLAG_SAME_ROT)

  • -x -z -y - integers
  • roll angle - float - if FLAG_SAME_TARGET then coords are omitted but roll is present, if FLAG_SAME_ROT then roll is omitted

FOV

1 value

  • angle - float

Color

3 values

  • r g b - float (1.0 = 255, 0.0 = 0)

TCB info

5 values (floats)

  • tension
  • continuity
  • bias
  • ease from
  • ease to

See also

Personal tools
sections