Skip to content

Tutorials · Particle Effects · Chapter 1

One emitter

20 minutes Uses: ParticleEmitter

By the end

  • A Particles node, chimney_a, smoking from the first chimney: Rate 12, Lifetime 3.5, Speed 18, Direction 0.2, -1, Spread 0.35, Capacity 48
  • How many particles are alive at once, and what a full pool does
  • The Particles panel: Preview, Restart, Burst and the live count
On this page

Open the starter

Particle Effects does not start from an empty folder. It starts from a project with the town built and nothing moving in it, so that everything you add from here is something that moves.

  1. Download particle-effects.zip, the starter (the overview says what is in it), and unzip it somewhere outside your other projects. You get one folder, particle-effects.
  2. Open Rengy. In the launcher, choose Open project… and pick the particle-effects folder.
  3. The editor opens the project’s startup scene, scenes/town.ron. On the toolbar, click Look through, so that the Viewport shows the town as the game’s camera sees it.
  4. Press F5 and look. Press F5 again to stop.
The editor on the starter, looking through the game camera: the Hierarchy lists Town and eighteen nodes under it, from camera to roof_e, with no emitter among them; the Viewport shows the town at night with nothing moving in it, a dark sky with clouds and mountains, a row of houses, the forge’s dark mouth at the left, the fountain, the well, two street lamps and a street paved in green and gold; the Inspector says nothing is selected

The Hierarchy holds Town, and eighteen nodes under it. camera frames the town. sky, clouds, mountains, far_buildings, forest and town are the painted layers, from the back to the houses. street is a tile layer, the paving along the bottom, with Collision on. lamp_1 and lamp_2 are the two street lamps, and forge, fountain and well are pictures of the forge’s mouth, the fountain and the well. roof_a to roof_e are five Colliders laid along the roofs, which chapter 11’s rain lands on.

The scenes folder holds six more scenes beside town.ron, small stages for chapter 16 to finish. The camera shows 640 by 360 world units, drawn at twice their size in a 1280 by 720 window. Every position on these pages is in those world units, with 0, 0 at the top left and y growing downward.

A Particles node

An emitter is a component, a Particle Emitter, and it goes on a node of its own. A Particles node is a node that has one. It makes particles: small pictures, each born, drawn, moved a little every frame and dropped when its life is over. A chimney’s smoke is about forty of them alive at once, and still one node.

  1. Select Town, press + Add node, and choose Particles. Rename it chimney_a.
  2. Set its Position to 181 and 201, the top of the first chimney.
  3. Press F5. A short fan of white dots rises from the chimney and thins out. Those are the emitter’s defaults. Press F5 again to stop.
The first chimney with a new Particles node on it: a short fan of white dots close together just above the chimney, spreading apart and shrinking as it rises about a hundred units, and ending in a few faint dots well below the top of the picture
A new Particles node at its defaults, four seconds in.

The Inspector lists every row of the emitter, dozens of them. Type particleemitter into its search box and it shows only the rows of the Particle Emitter, the first of them Emitting. The next three sections set six of them, and the chapters after this one set the rest.

chimney_a selected, its Inspector narrowed with the search box, particleemitter, to the Particle Emitter: Emitting ticked, Rate 12.00, Lifetime 3.50, Speed 18.00, Direction x 0.2 and y -1.0, Spread 0.35 with a slider, Gravity -40.00, Start Color and End Color swatches, Start Size 8.00, End Size 2.00, One Shot unticked, Burst 24, Capacity 48, Prewarm 0.00 s, Trail 0, Sort Layer Custom 10, Blend Alpha, Unshaded and Light Only unticked, then the Sprite group with Texture none, Texture Sheet and Stretch, and an Over Lifetime group cut off at the bottom; in the Viewport the node’s move arrows stand at the first chimney’s top, with two small blue squares above it and three thin violet lines fanning up from the node to them, the emitter’s aim and spread
The emitter’s rows as this chapter leaves them.
Emitting
Whether new particles are born. Untick it and the particles alive finish their lives and no more come, so an emitter can be switched off without losing its settings. Leave it ticked here: chapter 13 switches one on and off from a script.

How many, how long, how fast

Three numbers make the stream: how many particles are born each second, how long each one lives, and how fast it leaves the node.

  1. Set Rate to 12, Lifetime to 3.5 and Speed to 18.
Rate
How many particles are born each second. A smoke needs few: 6 to 20 suits a chimney here, and 12 is what you set. A continuous emitter’s only: a one-shot fires its Burst instead, which chapter 9 covers.
Lifetime
How many seconds each particle lives. It sets how far a particle gets before it goes: 2 to 4 suits smoke, and 3.5 is what you set. Rate times Lifetime is how many are alive at once.
Speed
How fast each particle leaves the emitter, in world units a second. The town is 640 units wide, so 18 is a slow start; 10 to 30 suits a chimney. It is only the start: Gravity and Drag go on changing a particle’s speed all its life.
The first chimney four seconds in: a column of white dots rising from the chimney, close together at the bottom, spreading a little apart and shrinking as they climb, and running off the top of the picture
Four seconds in: the column rises from the chimney and leaves the top of the window.
The first chimney with Rate 4: the same column rising and leaving the top of the picture, with far fewer white dots in it, each well apart from the next
For comparison, Rate 4: the same column, sparse.
The first chimney with Lifetime 1.5: a short stub of white dots rising from the chimney and ending well below the middle of the picture, the sky above it empty
For comparison, Lifetime 1.5: each dot is gone before it has climbed far.

Which way

  1. Set Direction to 0.2 and -1, and Spread to 0.35.

With the node selected, two small blue squares float above it in the Viewport, and you can drag both. The farther one, at the end of the aim, is Direction: swing it to turn the stream. The nearer one is Spread: pull it to open or close the fan.

Direction
Which way particles are fired, as two numbers, x and y. Only the way counts, not the length: 0, -2 is the same as 0, -1. The y axis runs down the screen, so -1 is up and 1 is down. 0.2, -1 leans about eleven degrees to the right, as a breeze would bend smoke; keep x between -0.3 and 0.3 for a chimney.
Spread
How wide the fan is that particles are fired across, in radians, centred on Direction. 0 is a single line, 0.35 about twenty degrees, and 6.28 a whole circle; the field stops at 7. 0.2 to 0.5 suits smoke, and 0.35 is what you set.
The first chimney with Spread 0: every white dot on one thin line, leaning a little to the right as it rises from the chimney to the top of the picture
For comparison, Spread 0: every dot on one line, leaning as Direction leans.
The first chimney with Spread 1.5: the white dots scattered in a wide, loose fan either side of the chimney as they rise, shrinking towards the top
For comparison, Spread 1.5: a wide fan.

How many at once

An emitter keeps its particles in a pool, made when the room opens, and Capacity is its size. A chimney that makes 12 a second, each living 3.5 seconds, has about 42 alive at once, so its pool needs room for 42, and a few more.

  1. Set Capacity to 48.
  2. At the bottom of the window, click the Particles tab. With chimney_a selected it names the emitter and counts its particles.
  3. Press F5, wait four seconds, and read the count. Press F5 again to stop.
The Particles panel with chimney_a selected: the buttons Preview, Restart and Burst, the speeds 0.1x, 0.25x and 1x with 1x lit, and under them 43 / 48 live beside a grey bar most of the way full, then Continuous, 12/s, and Edit the numbers in the Inspector
Four seconds into Play: 43 of 48 alive.
Capacity
The most particles this emitter can have alive at once. Size it to Rate times Lifetime, with a little room: 48 here, for the 42 the chimney keeps alive. A pool is made at this size when the room opens, so a bigger one costs memory even while it is empty, but only the particles alive are drawn.
The same panel with Capacity 16: 16 / 16 live beside a bar filled to the end in amber, and the amber warning Pool full; new particles are dropped
For comparison, Capacity 16: the pool full, and the panel says so.
The first chimney at Capacity 16: a short puff of white dots just above the chimney, then empty sky, and two lone dots near the top of the picture
For comparison, Capacity 16: a gap in the column where particles were not born.

The Particles panel

The panel you just read the count from does more than count. It works on whichever emitter is selected, and its buttons let you watch and poke one without pressing F5.

Preview
Steps the selected emitter’s particles in the Viewport while Play is off, so you see a change without playing the game. It reads Pause while it runs, and pressing it again stops it.
Restart
Empties the emitter’s pool and starts it again, as the room opening does. It also lets a one-shot fire again.
Burst
Fires the emitter’s Burst count at once, whatever its mode, so a stream like the chimney’s gets a puff on top of it.
0.1x, 0.25x, 1x
The preview’s speed. 0.1x slows an effect that is too quick to read to a tenth of its speed.

The chimney smoke

FieldValue
Position181, 201
Rate12
Lifetime3.5
Speed18
Direction0.2, -1
Spread0.35
Capacity48

Every other field is as a new Particles node has it. Chapters 2, 3, 8 and 9 add to it.

Check it works