The Lightning Simulator, Explained

After reading this you will understand how a branching bolt grows from a simple growth rule, how one slider trades a straight channel for a bushy crawl, and how to read the fractal shape it leaves behind.

What the simulator actually does

The Lightning Simulator grows an electric discharge one site at a time. A channel starts at the top of the canvas and creeps downward. At each step it looks at every empty cell that touches the channel, assigns each a growth probability, then picks one winner and adds it to the bolt. Repeat a few thousand times and a branching tree appears. When any branch reaches the bottom edge, the screen flashes, the path back to the root lights up as the return stroke, and the whole figure fades while a fresh leader begins.

The hook is that this branching is not painted by hand. It falls out of a single rule that biases growth toward the ground and adds randomness. Turn the randomness down and you get one determined channel. Turn it up and the bolt spreads sideways into dozens of dead-end tendrils. Nothing in the code draws a "lightning shape". The shape is what the rule produces.

The physics behind the toy

Real lightning is a dielectric breakdown. Air is normally an insulator, but a strong enough electric field rips electrons free and turns a thin channel into a conductor. The channel grows fastest where the field ahead of it is strongest, which is usually toward the oppositely charged ground. A stepped leader advances in jumps of about 50 m at roughly 10^5 m/s, far slower than the return stroke that follows.

The simulator borrows the dielectric breakdown model of Niemeyer, Pietronero and Wiesmann (1984). In that model you solve for an electric potential on a grid, then grow the channel at each frontier site with a probability proportional to the local field raised to a power \eta. The full model recomputes the potential every step, which is expensive. This tool uses a cheaper stand-in: a fixed downward bias plays the role of the field, and noise plays the role of everything the tool does not solve exactly. The trade between bias and noise is the branchiness control.

The growth rule and the branchiness exponent

Let the frontier be the set of empty cells adjacent to the current channel. Each candidate site i gets a score built from how far down it sits (a bias toward the ground) and a random draw. The probability of choosing site i is its score divided by the total over all candidates.

p_i = \frac{(\phi_i)^{\eta}}{\sum_{j} (\phi_j)^{\eta}}

Here \phi_i is the field-like score at candidate site i, made larger for sites lower on the canvas and jittered by noise. The exponent \eta is the branchiness knob. When \eta is large, small differences in \phi get amplified, so one site almost always wins and the bolt drives straight down. When \eta is near zero, every candidate has nearly equal probability, so the channel wanders and splits. The sum in the denominator just normalises the scores so the probabilities add to 1.

The published model reports that \eta = 1 gives a discharge with fractal dimension about 1.7. Higher \eta pushes toward a one-dimensional line (dimension near 1); lower \eta fills the plane more densely (dimension toward 2).

A worked growth step

Choosing the next site with the demo defaults

Run the tool with its default settings and freeze it after the leader has taken a few steps. Suppose the frontier has four candidate cells. Assign each a field-like score \phi from its depth plus noise, and use a moderate branchiness of \eta = 3.

  1. Raw scores: A = 1.0, B = 1.2, C = 0.8, D = 1.1. Site B sits lowest.
  2. Raise each to the power 3: A = 1.000, B = 1.728, C = 0.512, D = 1.331.
  3. Sum them: 1.000 + 1.728 + 0.512 + 1.331 = 4.571.
  4. Divide to get probabilities: A = 0.2188, B = 0.3781, C = 0.1120, D = 0.2912.
  5. Draw a uniform random number in [0, 1). If it lands in [0, 0.2188) pick A, in [0.2188, 0.5969) pick B, and so on.

Site B, the lowest, wins 37.81% of the time even though its raw score beats site A by only 20%. That amplification is the whole effect of \eta. Now redo step 2 with \eta = 1: the probabilities become A = 0.238, B = 0.286, C = 0.190, D = 0.262. The gap between best and worst shrinks from a factor of 3.4 to a factor of 1.5, so the channel wanders more and branches survive longer.

How branchiness reshapes the winning odds

The chart below takes the same four candidates and shows how the probability of the leading site B changes as \eta runs from 0 to 6. At \eta = 0 every site is equally likely at 0.25. As \eta grows, B pulls away and the also-rans starve.

Site B's win probability climbs from 0.25 at eta = 0 toward 0.46 at eta = 6. The marker sits at the worked example's eta = 3.

With four candidate sites scored 1.0, 1.2, 0.8 and 1.1, raising each to the power eta and normalising gives the pick probabilities. At eta = 0 all four are 0.25. At eta = 1 they are 0.238, 0.286, 0.190, 0.262. At eta = 3 they are 0.219, 0.378, 0.112, 0.291. Larger eta concentrates probability on the highest-scoring site.

Reading the bolt it draws

Three features carry information. The first is the overall reach: a straight bolt at high branchiness touches the ground in far fewer steps than a bushy one. If the canvas is 400 cells tall, a channel at high \eta can reach the bottom in roughly 400 to 600 steps, while a low-\eta discharge might take several thousand as it crawls sideways.

The second is the branch count. Count the dead-end tips. A determined channel leaves a handful; a bushy crawl leaves dozens. The third is the return stroke, the single brilliant path traced from the ground contact back to the root. That path is unique because the growth tree has no loops: every site has exactly one parent, so there is exactly one route back to the start.

Qualitative effect of branchiness on the drawn bolt
Branchiness (eta)Channel styleApprox. dead-end tipsFractal dimension
0.5bushy, plane-filling40 to 80≈ 1.9
1.0classic branching bolt15 to 30≈ 1.7
3.0few side branches4 to 10≈ 1.3
6.0near-straight channel0 to 3≈ 1.05

Common mistakes when reading the result

The most frequent error is treating the picture as a physics prediction. It is not. The tool uses a fixed downward bias instead of solving the true field, so it cannot tell you where real lightning will strike. It reproduces the branching statistics of the breakdown model, not the meteorology.

Do not read the return stroke as "the strongest path". It is simply the path from the ground contact back to the seed. Because the tree has no loops, that path is the only route, chosen by geometry rather than by any current calculation. Two runs with identical settings will trace different return strokes because the random draws differ.

A second mistake is expecting a symmetric or centred bolt. Growth is random, so the strike point drifts. Over 20 strikes the ground contact will scatter across the whole bottom edge; there is no restoring force pulling it to the middle. A third is confusing speed with physics. The growth speed control changes how many sites are added per frame for your eyes, not the leader velocity. Real leaders move at about 10^5 m/s and the return stroke at roughly a third of light speed, a ratio near 1000 that the animation does not attempt to honour.

Related simulations to explore next

If the branching structure interests you, the growth rule here is a close cousin of other pattern-forming systems on this site. For a field you can shape by hand, drag magnets around in Magnetic Field Lines and watch the field the breakdown model would grow along. For randomness driving structure in a fluid, stir dye in the Fluid Flow Simulator. For sensitive dependence on starting conditions, the theme behind why two identical runs diverge, swing the Double Pendulum. And for standing-wave patterns that emerge from a simple rule rather than being drawn, watch nodal lines form on the Chladni Plate Patterns.

Frequently asked questions

Why does the bolt sometimes stall before reaching the ground?

It does not stall in this tool; every step adds one site, so the channel always advances until a branch touches the bottom. What can happen at low branchiness is a very slow descent: the leader spends thousands of steps crawling sideways because side sites and downward sites have nearly equal probability. Raise the branchiness and it reaches the ground faster.

What does branchiness equal in the real model?

It plays the role of the exponent \eta in the dielectric breakdown model, where each site grows with probability proportional to the local field raised to the power \eta. The value \eta = 1 matches the classic fractal bolt of dimension about 1.7.

Why is there exactly one return stroke and not several?

Because the channel is a tree. Each site is added with exactly one parent, so following parents from the ground contact gives a single unbroken path back to the seed. Side branches never reconnect, so there is never more than one route.

Does higher flash intensity mean more energy?

No. Flash intensity and glow persistence are display settings for the additive glow render. They change brightness on screen and have no effect on how the channel grows or how many steps it takes.

Can I use this to predict where lightning strikes?

No. The tool uses a fixed downward bias in place of a solved electric field, so the strike point is random and reflects the growth statistics, not the charge distribution of any real storm.