DEV Community

PatilRB
PatilRB

Posted on

The particle features I stopped hand-rolling

Every web game I have worked on grew its own little particle system. It always starts the same way: a pool of sprites, a velocity, a lifetime, a fade. Two hundred lines and you have sparks.

Then the requests arrive. Can the smoke curl? Can the trail taper? Can the explosion spawn embers that themselves fall and fade? Each one is reasonable, and each one is another week bolted onto code nobody wants to own.

Here is the list of things I used to write by hand that an authored VFX pipeline just has, which is roughly why I stopped.

Values that change over a lifetime

Size, colour, alpha, rotation, velocity — all driven by curves and gradients rather than lerps hard-coded at the call site. Multi-point curves with per-point bezier tangents, colour and alpha gradients that can blend or step. The moment an artist can edit these without a rebuild, the iteration loop stops going through you.

Emission shape

Not just "spawn at a point". Shapes, with the direction of emission following from the shape. This is the one I always half-implemented, because a cone is easy and a ring is easy and then someone wants a mesh.

Forces and noise

Gravity is trivial. Turbulence is not, and turbulence is the difference between smoke that reads as smoke and smoke that reads as a sprite moving upward.

Trails, flipbooks and sub-emitters

Sub-emitters are the honest breaking point for a hand-rolled system. Once a particle can spawn its own emitter with its own lifetime and its own modules, you are no longer maintaining a particle effect. You are maintaining a particle engine, and that was never the job.

A material graph

A node-based shader editor with live per-node previews is not something I was ever going to write for one game. I would have shipped three hand-written shaders and told the artist those were the options.

What actually changed

The pitch I did not expect to care about is that the effects stay in my repo as plain JSON, in my own project folder, exported into a self-contained bundle the game loads. So this is not the usual trade where you adopt a tool and hand over your content in exchange. The diffs are still readable, the files are still mine, and the engine-side integration is a renderer, a create call and one update per frame.

What I gave up is the two hundred lines. I do not miss them.

The full module list — emission shapes, curves, gradients, forces, noise, trails, flipbooks, sub-emitters, the shader graph, and which of them each backend supports — is in the NixieFX feature reference. The editor itself is free and runs in the browser at nixiefx.com/editor.

Top comments (0)