Particle

Particles are lightweight objects which are not synchronized in a network game. This means that on the one hand you can create huge amounts of particles without slowing down the game too much but on the other hand there are only limited options for control of particle behaviour. If the particles are not sufficient for a given effect you have in mind, you can always use true objects instead.
If a particle is defined in a ocd group, any object definition located in the same group is ignored.
Particles are not stored in savegames and are designed for temporary visual effects only.

Particle Components (ocd)

Particle.txt
Particle properties.
Graphics.png
Particle graphics.
The particle definition can also contain the known components of object definitions for describing the particle (e.g. Title.png, DescDE/US.txt, etc.)

Particle.txt

This component contains the properties of the particle - as DefCore.txt does for object definitions.
Section [Particle]
Value Data type Description
Name String (max. 30 chars) Name of the particle definition. This name is also used to refer to this particle type in scripts.
Face 4 integers Target rectangle for the graphics within Graphics.png. See particle graphics.

Graphics

The coordinates for the source rectangle within Graphics.png of a particle specify the first phase of the particle graphics the other phases should follow to the right and can be continued in the next row. The animation length is then automatically determined from the image size.

Properties

Each particle has different attributes like position, lifetime, size and more. These are set by script when creating the particle.
The following properties can be contained in a proplist passed to CreateParticle. For an example, see CreateParticle
You can assign either constants to the properties (f.e. R = 200) or use certain value provider functions (f.e. R = PV_Linear(200, 0)). Available value provider functions are: PV_Linear PV_Direction PV_Random PV_Step PV_Speed PV_KeyFrames PV_Wind PV_Gravity PV_Sin PV_Cos
Particle definition proplist
Name Values Description
R 0 to 255 Red part of the color modulation.
G 0 to 255 Green part of the color modulation.
B 0 to 255 Blue part of the color modulation.
Alpha 0 to 255 Alpha part of the color modulation.
Size pixels Size of the particle in pixels.
Stretch factor The vertical stretch of the particle. 1000 equals no stretch.
Phase Index of phase The displayed phase of the particle from the Graphics.png. The index starts at 0 and will be wrapped.
Rotation 0 to 360 Rotation of the particle.
ForceX Integer Force in x-direction that is constantly applied to the particle's speed. Can f.e. simulate wind.
ForceY Integer Force in y-direction that is constantly applied to the particle's speed. Ca f.e. simulate gravity.
DampingX 0 to 1000 Damping of the particle's speed in x-direction. 1000 means no damping, 0 means instant stop.
DampingY 0 to 1000 Damping of the particle's speed in y-direction. 1000 means no damping, 0 means instant stop.
BlitMode 0 or GFX_BLIT_Additive The particle's blit mode. Currently only additive blitting is supported.
CollisionVertex 0 to 1000 The offset of the particle's hit point relative to its width. When set, the particle will collide with the landscape. 0 means the particle will collide with its center.
CollisionDensity Integer The material density above which the particle will collide. This can be used to let the particle collide with liquids. By default, particles collide with solid material if the collision is enabled. Also see material definitions.
OnCollision PC_Die, PC_Bounce, PC_Stop Defines what happens when the particle collides with the landscape.
Attach bit mask Defines the attachment of the particles to the calling object. Can be a combination of ATTACH_Front, ATTACH_Back, and ATTACH_MoveRelative. For example ATTACH_Front | ATTACH_MoveRelative. Non-attached particles are drawn on plane 900 (i.e. before most objects).
Zapper, 2013-10