Making games
Particle effects
A Particle Effect is a component that throws out lots of small glowing or soft dots: fire, smoke, sparks, an explosion, rain. Effects play in the editor as well as in the game, so you see them while you place them.
Adding one
- Create > Effect > fire (or any preset), or right-click the ground > Effect. Rain and snow are placed high up so they fall onto the spot.
- Add Component > Particle Effect puts one on an existing object: a torch on a wall, smoke on a chimney, sparks on a car.
Presets
| Preset | |
|---|---|
| fire | rising flames that glow and bloom |
| smoke | slow grey puffs that grow and fade |
| sparks | fast streaks that fall with gravity |
| explosion | one big burst, then done |
| rain, snow | weather over a 36 × 36 m area |
| dust | motes drifting in the air (sunbeams, old rooms) |
| magic | sparkles that float up and change colour |
| fountain | a water jet that arcs and falls |
| confetti | a burst of colourful pieces |
| steam | white vapour from a vent or a kettle |
Choosing a preset in the Inspector replaces the settings; everything below can then be tuned.
Settings
| Group | Settings |
|---|---|
| Emission | emitting, rate (per second), burst (at the start), loop or duration, maximum particles |
| Shape and motion | shape (point, sphere, box, cone), size, direction, spread, speed (+ random), gravity, drag, spin, world space |
| Look | lifetime (+ random), size at start and end, colour and transparency at start and end, brightness, blending, stretch, texture |
| Realism | a middle colour and size (start → middle → end, e.g. white-hot → orange → dark smoke), turbulence (swirling flames and curling smoke), soft edges (no hard line where particles meet the ground), lit by the scene (smoke takes the colour of the sun and nearby lights), flicker light (a light on the same object flickers like firelight) |
Built-in textures: builtin:flame (tall flame tongues), builtin:smoke (soft billowing puffs), builtin:spark
and builtin:dot. The presets pick the right one; choose another in Built-in texture, or use your own image.
- Brightness above 1 makes particles glow, and bloom picks them up.
- Blending: Add light for fire, sparks and magic (they brighten what's behind them); Blend for smoke, dust and rain (they cover what's behind them, sorted far to near).
- Stretch draws particles as streaks along their motion (sparks, rain).
- World space on: particles stay where they were born when the object moves, so a moving torch leaves a trail. Off: the whole effect moves with the object.
- Texture: any image; without one, particles are soft round dots.
The Restart and Burst buttons under the settings replay the effect while you tune it.
In scripts
-- an explosion where something was hit; it removes itself after 3 seconds
scene.spawn{ name = "Boom", position = hit.point, particles = "explosion", lifetime = 3 }
-- a custom effect: a preset plus changes
scene.spawn{ position = vec3(0, 1, 0), particles = { preset = "sparks", rate = 120, start_color = {0.4, 0.8, 1, 1} } }
local torch = scene.find("Torch")
torch.emitting = false -- stop (the particles alive finish)
torch:emit(40) -- 40 particles right now, even when emitting is off
torch:set_particles("smoke") -- switch to another preset
print(torch.particles) -- how many are alive
The same settings, with underscores (start_size, end_color, world_space…), work in scene files and in
MCP's set_components {"particles": {...}}.
Performance
Particles are simulated on the CPU and drawn in one batch per effect. A few thousand at once is fine. Rain uses up to 2,500, so keep heavy weather to one effect that follows the player.