<!-- skill-dir-note -->
Path note:
<skill-dir>in commands below is the absolute path of this skill's folder. When the agent loads this skill the harness exposes the skill's base directory; substitute it before running. Sibling skills are reached via<skill-dir>\..\dayz-X\.
DayZ particle effects
Follow skills/_shared/dayz-conventions.md. This skill is reference only; it runs no scripts, so there is no preflight gate.
What to read
| Task | Read |
|---|---|
| Write or edit a .ptc (emitters, curves, every property) | references/ptc-format-reference.md |
| Write or edit an .emat, pick a vanilla material or sprite GUID | references/emat-format-reference.md |
| Play, stop or tune particles from script | references/script-api-reference.md |
| Wire particles into a device (toggle, one-shot, cleanup) | references/integration-patterns.md |
| Pick a vanilla particle for a device, tune one at runtime, or bring older device code up to date | references/device-particle-choices.md |
| Find a vanilla particle to reuse | references/vanilla-particle-catalog.md |
| Build a layered effect (explosion, impact, fireball), pick vanilla materials, use Mast curves | references/layered-effects.md |
| Check the layout of a .ptc, the vanilla emitter shapes, or convert an old CfgCloudlets particle | references/ptc-layout-and-cloudlets.md |
| Register a mod's own effects, play them, or switch single emitters from script | references/effects-from-script.md |
| Size a contaminated area in cfgeffectarea.json: emitter budget, the 1,000 cap, the vertical band, safe positions | references/effect-area-particles.md |
| Move a mod to DayZ 1.30: the headless client check, CreateParticleServer, SurfaceInfo particle IDs, ParticleParamsOverrideData, vehicle effects | references/dayz-1-30-particles.md |
| What 1.30 changed for effect areas, the sandstorm, oil pits and dust kickup, and which ParticleList constants it added | references/dayz-1-30-world-particles.md |
| See a full PlayOnObject example for a custom wreck, checked against the vanilla wrecks | references/playonobject-client-guard.md |
File layers
| Layer | Format | Purpose |
|---|---|---|
| .ptc | Plain text | Effect: one EffectDef with one or more EmitorDef blocks |
| .emat | Plain text | Material: texture ref, shader (Particle or ParticleSprite), blend mode |
| .edds | DDS renamed | Billboard sprite texture |
| .meta | Plain text | Written by Workbench; not needed at mod runtime for particles (whether the .meta of a .layout variant is needed is not yet tested) |
Because .ptc and .emat are plain text, they can be written by hand or generated by a script.
The smallest useful .ptc: one EffectDef with one emitter. Each EmitorDef is its own stream of particles, and a complex effect stacks several (the vanilla small campfire has six: glow, flames, burst, short flames, sparks, smoke).
EffectDef {
Emitors {
EmitorDef <name> {
ShapeType Point
MaxNum 10
BirthRate 5
Material "{GUID}path/to/material.emat"
SizeMultiplier 0.5
Velocity 2
LifeTime 1.5
Color {
0 1 0.8 0.3 1 0.7 0.5 0.25
}
Alpha {
0 0 0.2 1 1 0
}
Repeat 1
}
}
}
Property groups, all listed in references/ptc-format-reference.md:
- Shape and emission:
ShapeType,ShapeSize,ConeAngle,MaxNum,BirthRate,BirthRateRND,Offset. - Look:
Material,SizeMultiplier,SizeRND,BillboardingType,CenterY,StretchMultiplier. - Motion:
Velocity,VelocityRND,AirResistance,GravityMultiply,Wind,Spring,Restitution,VelAngle,VelAffect. - Lifetime:
LifeTime,LifeTimeRND,EffectTime,Repeat(0 plays once and deletes itself, 1 loops until stopped). - Sprite animation and rotation:
AnimOnce,AnimFPS,LifetimeByAnim,RandomFrame,RandomRotDir,RotMultiplier,RandomAngle. - Curves over a particle's life:
Color,Alpha,Size,RotationSpeed. Curves over the effect time:ColorMast,AlphaMast,SizeMast,BRateMast,VelocityMast,AirResistanceMast.
A particle .emat uses one of two shaders, Particle (fire, sparks, water, most effects) or ParticleSprite (steam, flares, flames, glow billboards). Both shaders take BlendMode, Sort, TileU and TileV. Both are in references/emat-format-reference.md. Weather .emat files with other shaders, such as the sandstorm's SnowEffect, are postprocess materials and must not be named by a .ptc.
GUID references
Resources reference each other as {HEXGUID}relative/path.ext.
- Mod
.ptcto vanilla.emat, or mod.ematto vanilla.edds: copy the vanilla GUID plus path, exactly as vanilla files do. - Mod
.ptcto mod.emat: path only; mod-owned resources resolve by PBO path.
Path-only references resolve: vanilla itself ships one. P:\graphics\particles\contaminated_area_gas_around_tiny.ptc:13 has Material "Graphics/Particles/materials/enviroment/water_splash_01_em.emat" with no GUID, and that effect is registered at P:\scripts\3_game\particles\particlelist.c:316 and played by the contaminated area (P:\scripts\4_world\classes\contaminatedarea\effectarea.c:80). Every texture reference in the vanilla particle materials under P:\graphics\particles\materials carries a GUID (other vanilla .emat files do not always: P:\DZ\worlds\sakhal\data\sakhal_sea.emat:4 names its DeepMap by path alone), so for vanilla resources copy GUID plus path to match vanilla, and the path alone is a working fallback.
More evidence that the path, not the GUID, is what resolves: vanilla names the material smoke_anim_02.emat with two different GUIDs, {00BEA27443975BEB} in the bonfire (P:\graphics\particles\fire_bonfire.ptc:217) and {0BEA27443975BE0B} in the failing hatchback engine (P:\graphics\particles\hatchback_engine_failing.ptc:11), and both effects draw their smoke.
Script API in one screen
Particle(legacy):Particle.PlayOnObject(id, parent, localPos, localOri, forceWorldRot),Particle.PlayInWorld(id, worldPos). Non-looping particles delete themselves.ParticleSourceextendsParticle: native-backed, auto-destroy flags (ON_END,ON_STOP,ALL,NONE),DisableAutoDestroy(),ResetParticle().ParticleManager.GetInstance(): global pool of 10000ParticleSourceobjects, created only when not on a headless or dedicated server, so it returns null there (P:\scripts\3_game\particles\particlemanager\particlemanager.c:25and:63to:65). Null-check it.SEffectManager.PlayOnObject(effect, parent, pos, ori)for particle plus sound; clean up only withSEffectManager.DestroyEffect(effect).- Control:
StopParticle(flags)fades out by default (StopParticleFlags.IMMEDIATEremoves at once,PAUSEfreezes),SetParameter(emitter, EmitorParam.X, value)with-1for all emitters,ScaleParticleParamFromOriginal(EmitorParam.SIZE, 0.5). - More instance calls:
PlayParticle(optionalNewId),IsParticlePlaying(),RestartParticle()(reset and play),SetWiggle(randomAngle, randomInterval)andStopWiggle(). All signatures are inreferences/script-api-reference.md. - A pool of your own:
ParticleManager.GetInstance()is the global pool, not the only one allowed. The constructor is public (P:\scripts\3_game\particles\particlemanager\particlemanager.c:88) and the vanilla particle tests build their own pool withnew ParticleManager(new ParticleManagerSettings(3000))(P:\scripts\3_game\particles\tests\pmtcreationandcleanup.c:50). - Server spawned effects:
SEffectManager.CreateParticleServer(pos, EffecterParameters)(P:\scripts\3_game\effectmanager.c:586) creates an effecter entity on the server that shows a particle on every nearby client. Vanilla uses it for tree cutting, fishing, fish traps and, since 1.30, ceiling dust.PlayOnObjectandPlayInWorldstay client only. - Runtime retune on an effect class (1.30): override
ParticleParamsOverride(ParticleParamsOverrideData)on anEffectParticlesubclass (P:\scripts\3_game\effects\effectparticle.c:619), as vanilla vehicle dust and wheel contact do. Seereferences/dayz-1-30-particles.md.
Registering custom particles
MyMod/
data/particles/mymod_water_spray.ptc
data/particles/materials/mymod_blue_water.emat (optional)
scripts/3_Game/MyMod_ParticleList.c
modded class ParticleList
{
static const int MYMOD_WATER_SPRAY = RegisterParticle("MyMod/data/particles/", "mymod_water_spray");
};
Packing: /dayz-build-pbo already packs .ptc, .emat and .edds (its include filter is skills/dayz-build-pbo/include.lst), so no change is needed. Only with a custom AddonBuilder setup, add whichever of *.ptc;*.emat;*.edds are missing to your existing include filter; do not replace the filter, or other file types such as .p3d models are dropped from the PBO.
Pitfalls
- Particles are client-only. Guard with a runtime
GetGame().IsHeadlessOrDedicatedServer()check, as every pattern inreferences/integration-patterns.mddoes (Pattern A shows it first). It is the same gate vanilla's particle pool uses (P:\scripts\3_game\particles\particlemanager\particlemanager.c:65);IsDedicatedServer()alone lets the code run on a headless client. The general client-only rule inskills/_shared/conventions/scripts.mdnames!GetGame().IsDedicatedServer(); for particles this skill narrows it toIsHeadlessOrDedicatedServer(), which includes that check. VanillaPowerGeneratorBasegates its smoke onIsClient() || !IsMultiplayer()instead (P:\scripts\4_world\entities\itembase\powergenerator.c:196); Pattern D, which follows that class, still usesIsHeadlessOrDedicatedServer()so one gate covers every pattern. Do not use#ifndef SERVER: testing runsDayZDiag_x64.exefor both ends, and a compile-time define does not separate them. - Looping particles (
Repeat 1) never end on their own. Stop them and null the reference; clean up inEEDelete, power-off and the destructor. Stop()fades out gradually; useStopParticleFlags.IMMEDIATEfor instant removal.ObjectDelete(particle)is valid only for aParticleSourcewithDisableAutoDestroy().- Give
.ptcfiles a mod prefix (mymod_) so filenames don't collide across mods. AIR_RESISTANCEcontrols how fast smoke rises; useforceWorldRot = truefor smoke and steam that should always rise straight up.EffectTimeis the master-curve cycle;Repeatloops the whole effect. A one-shot (Repeat 0) plays once forEffectTime.- Clean up an
Effectstarted throughSEffectManageronly withSEffectManager.DestroyEffect(), never withdelete. - Particles stop being drawn at a distance: about 200 m, an engine limit with no workaround. The figure is an observation in game, not yet checked on
P:\. - A dedicated server check alone is a 1.29 habit. Up to 1.29 vanilla wrecks tested
!g_Game.IsDedicatedServer()(1.29, not yet checked onP:\); since 1.30 most vanilla particle code tests!g_Game.IsHeadlessOrDedicatedServer()(P:\scripts\4_world\entities\building\wrecks\wreck_mi8.c:6), but the Chinook and Mi-24 wrecks still use the dedicated server check alone (P:\scripts\4_world\entities\building\wrecks\wreck_chinook.c:6andP:\scripts\4_world\entities\building\wrecks\wreck_mi24_tk.c:5). When updating an older mod, search for the old check around particle code. - A valid
cfgeffectarea.jsonand a server that boots do not prove a contaminated area shows gas at its edge. Each area is capped at 1,000 emitters; work out the budget first (references/effect-area-particles.md).
Effect areas
Before choosing the radius of a contaminated area in cfgeffectarea.json, read references/effect-area-particles.md: work out the emitter budget with its formula and keep it under 1,000 with margin, measure the full height range of the ground inside the radius (underground spaces included), and compare every entry of the global SafePositions list against every area.
DayZ 1.30
Full detail, with the vanilla lines: references/dayz-1-30-particles.md and references/dayz-1-30-world-particles.md. In short:
- The client check for particles is
!g_Game.IsHeadlessOrDedicatedServer()(most wrecks,FireplaceBase,ParticleManager). - Ceiling dust is spawned from the server with
SEffectManager.CreateParticleServerand aParticleEffecterParameters("CeilingDustEffecter", ...). - Vehicle effects are retuned through
ParticleParamsOverrideData.m_FloatModifiers, owned byVehicleVFXComponent. - Surface particle IDs come from
SurfaceInfo(GetStepParticleId,GetWheelParticleId,GetVehicleDustParticleId,GetCeilingDustParticleId); theSurface.GetStepsParticleIDandSurface.GetWheelParticleIDwrappers are obsolete. - Effect areas tick from
OnCEIterate, notOnCEUpdate, andSpawnParticlessnaps toSurfaceRoadY. - New
ParticleListconstants: tandoor fire, desert sand and mud brick impacts,CEILING_WOOD, building destruction, dust,OIL_FIRE1andOIL_FIRE2. The weather sandstorm is aSnowEffectpostprocess.ematplus the particle pathGraphics/Particles/sandstorm/sandstorm.
The table of what breaks in a 1.29 mod and the migration checklist are at the end of that file. The 1.30 signatures are in references/script-api-reference.md ("DayZ 1.30: SurfaceInfo, vehicle effects, server spawn").
On Linux
Everything above is written for Windows and stays valid there. .ptc and .emat are text files written without Workbench, so nothing in this skill needs Windows. Workbench can be started under Proton with dayz-proton.sh gui Workbench (the script is scripts/tools/dayz-linux/dayz-proton.sh); whether it runs there and whether its particle editor works is not yet checked. The Proton setup and its limits are in skills/_shared/linux-proton.md.
Building, testing and publishing the mod
This skill ends at the effect files and the script that plays them. For the rest (config.cpp and CfgMods, requiredAddons, packing, a boot on a local server) use /dayz-build-pbo and /dayz-launch-test, and skills/dayz-launch-test/references/mod-loop.md for the whole loop.