PHY: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Starting to flesh out the file format as I go)
mNo edit summary
Line 3: Line 3:
== File Format ==
== File Format ==


The first bytes of the file form the PHY header
In brief, a PHY file is formed by:
 
* A main header, which specifies the number of solids
* A series of VPHY/collision data sections, one per solid
* A series of textual data sections, one per solid
 
=== Main header ===
 
The first bytes of the file form the main header:


<source lang="cpp">struct phyheader_t
<source lang="cpp">struct phyheader_t
{
{
int size;          // Size of header after this point (generally 16 for a total size of 20)
int size;          // Size of this header section (generally 16)
int id;            // Often zero, unknown purpose.
int id;            // Often zero, unknown purpose.
int solidCount;    // Number of solids in file
int solidCount;    // Number of solids in file
long         checkSum; // checksum of source .mdl file
long         checkSum; // checksum of source .mdl file (4-bytes)
}</source>
}</source>
=== Collision data sections ===
There will be a series of these sections, back-to-back, numbering the same as the header's [code]solidCount[/code].


{{todo|Document headers for each solid}}
{{todo|Document headers for each solid}}


{{todo|Document "old format" if VPHY is not seen}}
{{todo|Document "old format" if VPHY is not seen}}
=== Text sections ===


{{todo|Document key-value data for each solid}}
{{todo|Document key-value data for each solid}}


== See also ==
== See also ==

Revision as of 18:10, 6 August 2010

PHY is the extension for Source's proprietary collision model data format. It stores data for the rigid or jointed (ragdoll) collision model used by the MDL. In addition, it stores prop_data information about a model such as which gib-models to use if destroyed.

File Format

In brief, a PHY file is formed by:

  • A main header, which specifies the number of solids
  • A series of VPHY/collision data sections, one per solid
  • A series of textual data sections, one per solid

Main header

The first bytes of the file form the main header:

struct phyheader_t
{
	int		size;           // Size of this header section (generally 16)
	int		id;             // Often zero, unknown purpose.
	int		solidCount;     // Number of solids in file
	long	        checkSum;	// checksum of source .mdl file (4-bytes)
}

Collision data sections

There will be a series of these sections, back-to-back, numbering the same as the header's [code]solidCount[/code].

Todo: Document headers for each solid
Todo: Document "old format" if VPHY is not seen

Text sections

Todo: Document key-value data for each solid



See also