User:Jackoalan/Particle Script

Retro games feature a uniform, fixed-function Particle Script system for describing various geometrical effects and weapon systems. The PAK archives contain binary resources using FourCCs to build a key-value dictionary. These codes correspond to application-specific parameters controlling the system in question.

The scripts use a dataflow paradigm built around value-generating element classes of the following types:


 * Int
 * Real (float)
 * Vector (3-component float)
 * Mod Vector (3-component float)
 * Velocity vector in/out
 * Position vector in/out
 * Color (4-component float, internally converted to RGBA8)
 * UV (TXTR reference and UV coordinate source)
 * Emitter
 * Initial position vector (3-component float)
 * Initial velocity vector (3-component float)

The system features several subclasses that output generated values through  as a function of the current frame index. These implementations may recursively accept input from other elements, permitting effect designs of scalable complexity.

File Layout
All effect script file formats are read linearly to populate a descriptor tree of element nodes:


 * Script Magic FourCC (see table below)
 * Parameters
 * Key FourCC
 * Value Parameter(s) (one of:)
 * : null value (equivalent to not specifying the key at all)
 * Element FourCC (see below)
 * Child Elements (count/types according to parent)

Elements
Many of the animated qualities in particle scripts are achieved with dynamic elements. These elements provide I/O interfaces and internally process numeric data that passes through. They may also gather data from other sources within the particle system's state.

Keyframe Emitter Template
and  elements are able to statically encode a list of key values for all element types (except UV and Emitter elements). T represents the type being encoded.