GPUParticles2D vs CPUParticles2D in Godot 4 — which and when
You open the Add Node dialog, type "particles", and Godot 4 offers you two nodes that look identical in the viewport: GPUParticles2D and CPUParticles2D . Both emit sprites, both have amount , lifetime , one_shot and explosiveness . The names tell you where the simulation runs, but not what that means for your game. Here's the practical difference, and the rule I use to pick. GPUParticles2D: the…
Godot 4 offers two particle nodes that look identical: GPUParticles2D and CPUParticles2D. Both emit sprites and share attributes like amount, lifetime, one_shot, and explosiveness. The key difference lies in where the simulation runs.
GPUParticles2D simulates particles on the graphics card using a ParticleProcessMaterial. This material defines velocity, gravity, scale curves, and color ramps. GPUParticles2D offers advanced features like turbulence, collision with LightOccluder2D shapes, sub-emitters, trails, and custom shaders. It scales well for thousands of particles, as the CPU doesn't handle them.
However, it requires a visibility_rect for culling, which can lead to unexpected vanishing of particles flying outside the rectangle. Additionally, shaders compile during the first use, causing stutter on initial explosions.
CPUParticles2D, on the other hand, runs the simulation on the CPU using a script loop. All settings are direct properties of the node (direction, spread, initial and max velocities, gravity, amount, lifetime, one_shot, and explosiveness). This node provides consistent behavior across all renderers, including Compatibility, Forward+, and web exports. There's no shader compilation or visibility_rect to manage. However, the trade-off is a smaller feature set and increased CPU cost that grows with particle count.
The decision between GPUParticles2D and CPUParticles2D depends on the effect's complexity and longevity. For big, long-lived, or intricate effects, such as rain, snow, or turbulence, use GPUParticles2D. For small, short bursts like sparks, pickups, or footsteps, CPUParticles2D is more suitable. If targeting the web, test GPUParticles2D early due to compatibility quirks. Many 2D action games employ both: a few big GPU systems for ambiance and numerous tiny CPU bursts for feedback.
The Saltmire Spark tool, an MIT-licensed autoload, can simplify the process by generating a tuned 2D burst in one line (Spark.burst(pos, hit)) and automatically managing cleanup. It's a convenient alternative to using GPUParticles2D or CPUParticles2D directly.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.