Dayz particles

From DayZ-n-Chill/Agentic-Z · View interactive version

Dayz particles is an AI agent skill from the GitHub repository DayZ-n-Chill/Agentic-Z. Reference for creating and playing custom DayZ particle effects without Workbench: .ptc and .emat files, .edds sprites, the Particle, ParticleManager and SEffectManager script API, the vanilla particle catalog, contaminated area particle budgets (cfgeffectarea.json) and the DayZ 1.30 changes (dust,

How to use this skill

Skill file

<!-- 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:

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.

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

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

  1. Particles are client-only. Guard with a runtime GetGame().IsHeadlessOrDedicatedServer() check, as every pattern in references/integration-patterns.md does (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 in skills/_shared/conventions/scripts.md names !GetGame().IsDedicatedServer(); for particles this skill narrows it to IsHeadlessOrDedicatedServer(), which includes that check. Vanilla PowerGeneratorBase gates its smoke on IsClient() || !IsMultiplayer() instead (P:\scripts\4_world\entities\itembase\powergenerator.c:196); Pattern D, which follows that class, still uses IsHeadlessOrDedicatedServer() so one gate covers every pattern. Do not use #ifndef SERVER: testing runs DayZDiag_x64.exe for both ends, and a compile-time define does not separate them.
  2. Looping particles (Repeat 1) never end on their own. Stop them and null the reference; clean up in EEDelete, power-off and the destructor.
  3. Stop() fades out gradually; use StopParticleFlags.IMMEDIATE for instant removal.
  4. ObjectDelete(particle) is valid only for a ParticleSource with DisableAutoDestroy().
  5. Give .ptc files a mod prefix (mymod_) so filenames don't collide across mods.
  6. AIR_RESISTANCE controls how fast smoke rises; use forceWorldRot = true for smoke and steam that should always rise straight up.
  7. EffectTime is the master-curve cycle; Repeat loops the whole effect. A one-shot (Repeat 0) plays once for EffectTime.
  8. Clean up an Effect started through SEffectManager only with SEffectManager.DestroyEffect(), never with delete.
  9. 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:\.
  10. 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 on P:\); 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:6 and P:\scripts\4_world\entities\building\wrecks\wreck_mi24_tk.c:5). When updating an older mod, search for the old check around particle code.
  11. A valid cfgeffectarea.json and 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 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.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.