Recipes
Particles explosions and visual effects
A torch needs fire, a hit needs sparks, an explosion needs a burst. Particles are a real component (
ParticleEmitterComponent, pack rendering.v1), richly AI-authorable. Surface marks use DecalComponent; attention outlines use HighlightComponent. Note the FxHost particle-burst call is a bare SDK surface, not a capability-pack host; drive particles through the component.engine v1.0.234since script-semantic-patch-ops.v1, action-catalog.v1.0.232, rendering.v1, mutation.v1Copy for LLM
Use this for
fire, smoke, sparks, dust, magic, and trails; explosion and impact bursts; ground scorch and paint marks; a glowing outline to draw attention
Not for
node-graph shaders or custom material effects (see materials-and-looks and capability-ceiling); screen-space post-processing (see atmosphere-sky-and-lighting); animated skeletal clips (AnimationStateComponent)
Pairs with: Projectiles bullets and ranged weapons, Hazards lava damage zones and water, Combat damage health and respawn scripting, Materials and looks PBR surfaces color metalness and textures
The recipe
Author component values with project_add_component, and drive them at runtime with ctx.entity.patchComponent in a script.
- Continuous emitter (fire, smoke, a trail):
project_add_componentaParticleEmitterComponentwithemissionModecontinuous(the default). TuneemissionRate,lifetimeSeconds,particleSize(with optionalstartSize/endSize),startColorandendColorfor the ramp,gravity, andshape.type(point,sphere,box,cone,disc,edge). PickblendModeadditivefor fire and sparks,alphafor smoke. - One-shot burst (explosion, impact): set
emissionModeburstandburstCount(particles per puff, up to 512). The emitter emits the whole burst once at birth, the particles live onelifetimeSeconds, then it idles (no loop, no re-emit). To re-fire the same emitter for a repeated hit, patchenabledfalse then true. This is native now, so a burst no longer needs a spawn-then-despawn dance; thePoof (burst)variant is a ready-made preset. - Attach to motion: because particles simulate in the entity's LOCAL space, parent the emitter under the moving object (a rocket trail follows the rocket) with
ctx.entity.setParent. - Surface marks: add a
DecalComponent(blendModeblend/multiply/add, setcolorandopacity) at the impact point for a scorch or paint splat. - Outline for attention: toggle a
HighlightComponent(enabled,color,depthModeoccludedorxray) on an interactable or a target.
Pitfalls
- Choose the emission mode deliberately:
continuousstreams and loops (fire, smoke, trails);burstfiresburstCountparticles once and stops (explosions, impacts). A continuous emitter withemissionRate0 shows nothing; useburstfor a one-shot, not a zero rate. - Particles are LOCAL space and move with the entity; a world-anchored effect needs its own unparented entity at the world position.
maxParticlesandemissionRateare budgeted; the defaultmaxParticlesis 64. Large sustained emitters are costly, so size them to the effect.- Only
enabledhighlights count against the per-tier highlight budget; turn outlines off when not needed. - Particles are a look, not a hitbox; damage or collision still needs a collider and script (see hazards-water-and-damage-zones).
Verify
qa_capture_renderer_viewport(qa.renderer.viewport.capture) to see the effect render, andsimulation_runto confirm a scripted burst enables and clears.project_get_graph_snapshotto confirm theParticleEmitterComponentand anyDecalComponentorHighlightComponentlanded.