Warzone 2100 Resurrection

PIE format

From WarzoneWiki

Jump to: navigation, search

Contents

PIE 2

Description

The PIE format is a custom model format created by Pumpkin.

This (incomplete) specification of PIE2 describes the parts used in Warzone 2100 2.0.

Specification (incomplete)

PIE / TYPE

You always start the file with

 PIE 2
 TYPE 200

This indicates the version number (2) and type (200) of the file. Right now, you do not want to change these. The type is not used, but should be 200 for backwards compatibility.

TEXTURE

 TEXTURE 0 page-7-barbarians-arizona.png 256 256

This sets the texture page for the model. The first parameter (the zero) is ignored. The second gives you the filename of the texture page, which must end with ".png". The third and fourth parameters give the size of the texture, which are also ignored, since we can just read that info from the texture page itself. Nevertheless, fill them out with the correct values for backward compatibility. You can leave this line out entirely, if you do not wish to use a texture. Why someone would want to do that, is another question entirely. Note also that the exact texture page file may be modified by WRF files during level loading, so that the texture matches the tileset.

LEVELS

 LEVELS 1

This gives the number of meshes that are contained in this model. Each mesh can be animated separately in ANI files.

LEVEL

 LEVEL 1

This starts the model description for mesh 1. Repeat the below as necessary while incrementing the value above as needed.

POINTS

 POINTS n

This starts a list of vertex coordinates (points) that is n lines long. On each following lines, indented by a tab, should follow three space separated values giving the x, y, and z coordinates, respectively. The Y axis denotes the "up" direction.

POLYGONS

 POLYGONS n

This starts a list of polygon faces. As above, each line should be indented with a tab. Each line contains the following information (flags) (points) (texture animation) (texture coordinates). Let's go through them.

Flags The flags are in hexadecimal notation.

  • +200 means the polygon is textured. You will want to set this.
  • +2000 means that the polygon is not to be culled on its back side.
  • +4000 means the polygon has a team colour or is animated. If this is set, you must fill out the animation data block. Otherwise this block is empty.
  • There are other flags (TODO: list them here) but they are obsolete and unused.

Points

  • First add the number of points for this polygon. For all new models, this should be a triangle, so 3.
  • Then follows a list of indexes to the points list above.

Texture animation

  • If the +4000 flag is set, provide the following sequence of information.
  • First add the number of texture animation or team colour images provided. For team colour, it is always 8.
  • Second add the playback rate. Measurement unit not known - use '1' unless you want to experiment.
  • Third add the x and y size of each texture animation or team colour image.

Texture coordinates

  • Give texture coordinates for each point. There are two texture coordinates for each point, hence this list should be twice as long as the number of points. The coordinate is given in a 0...255 range, for legacy reasons.

CONNECTORS

 CONNECTORS n

This starts a list of connectors for the model. These are used to place other components against this one. For each line following this, you should indent by a tab, then give the x, y, and z coordinates of a connector. The meaning of each connector is special and hard-coded. Some models do not need connectors.

The exact purpose of each connector is hard-coded for each model type. TODO: List these purposes here.


PIE 5

Description

This describes the version which will be used in Warzone 2100 2.1 and is still subject to heavy changes.

PIE version 5 supports floating point texture and vertex coordinates. Maximum number of vertices is 768 and maximum polygons supported is 512. There should be exactly 3 vertices per polygon (polygons can share vertices).

PIE 5 texture coords are supposed to be read from the bottom left of the texture (designed to be completely OpenGL compatible), whereas PIE 2 texture coords calculated from the top left of the texture.

Filenames are not allowed to contain any special characters.

It is generally incompatible to PIE 2.

Specification (draft)

PIE

 PIE 5

The first line specifies the version number (5) and MUST read like that. Tools MUST interprete it, since PIE formats may be incompatible.

TYPE

 TYPE 200

This indicates the type (200) of the file. Currently serves no purpose, but may in future versions of this specification.

TEXTURE

 TEXTURE page-7-barbarians-arizona.png

This sets the texture page for the model. The second gives you the filename of the texture page, which must end with ".png". The PIE file MUST contain exactly one TEXTURE line. The filename MUST only contain [a-zA-Z0-9._\-]. The file name SHOULD start with "page-NN-" for correct handling of dynamic texture replacement.

LEVELS

 LEVELS 1

This gives the number of meshes that are contained in this model. Each mesh can be animated separately in ANI files.

LEVEL

 LEVEL 1

This starts the model description for mesh 1. Repeat the below as necessary while incrementing the value above as needed.

POINTS

 POINTS n

This starts a list of vertex coordinates (points) that is n lines long. n MUST be less than or equal to 768. This is followed by the list of points.

Point

 	-4.0 4.0 8.0

Each point MUST be on a seperate line and MUST be indented with a tab. It MUST contain exactly 3 floating-point values in the order x y z. Y denotes "up".

POLYGONS

 POLYGONS n

This starts a list of polygon faces. n MUST be less than or equal to 512.

Polygon

 	200 3 3 2 1 0.82 0.78 0.186 0.78 0.199 0.82

Each polygon MUST be on a seperate line and MUST be indented with a tab.

It is made out of following sections:

 Flags Points [Texture Animation] Texture_coordinates

Flags

  • +200 means the polygon is textured. Each entry in POLYGONS MUST have this flag.
  • +4000 means the polygon has a team colour or is animated. You MAY set this flag, but if you do, you MUST fill out the animation data block. Otherwise this block is empty.
  • Other flags shall be ignored.

Points

  • First number is the number of points for this polygon. Each entry in POLYGONS MUST have exactly 3 points.
  • Then follows a list of indexes to the points list.

Texture animation (OPTIONAL)

  • If the +4000 flag is set, provide the following sequence of information.
  • First add the number of texture animation or team colour images provided. For team colour, it is always 8.
  • Second add the playback rate. Measurement unit is seconds. Use of the value '1' is recommended.
  • Third add the x and y size of each texture animation or team colour image.

Texture coordinates

  • Give texture coordinates for each point. There MUST be two texture coordinates for each point, hence this list should be twice as long as the number of points. Texture coordinates MUST be floating point numbers in the range 0.0 to 1.0.

CONNECTORS

 CONNECTORS n

This starts a list of connectors for the model. These are used to place other components against this one. For each line following this, you should indent by a tab, then give the x, y, and z coordinates of a connector. The meaning of each connector is special and hard-coded. Some models do not need connectors.

The exact purpose of each connector is hard-coded for each model type. TODO: List these purposes here.

See also

WZM format