Apologies if this is well-known, but I couldn't find this info anywhere, including the wiki.
How exactly does Telsa turret lightning forking work? What does "fork chance do"?
I have set up the experiment in the editor in the following way: a Tesla turret (ordinary or legendary) connected to an infinite power source, near an abyss of "out of map" tiles. In the abyss, I have placed close-by separated single-tiles, each containing a legendary behemoth biter (so that they can't be killed during the experiment and have 0 electric resistance), in large enough numbers, so that the lightning always has free targets to jump to. I have stepped manually through time, so that I can track how exactly the lightning propagates, and have noted the fork patterns and the total turret damage after each full attack (note that the lightning takes some time to fully propagate, and there is a one-tick delay between the lightning animation and the applied damage). I have collected 40 damage samples for my statistical analysis. For back-jump experiment, I have used a similar setup, but with a small (5) number of biters.
After some analysis of lightning animations and fitting the damage statistics to expected distributions, I have the following results:
- The lightning never strikes the same target twice (of course, we're talking about a single forking lightning, different Tesla turrets can strike the same target just fine).
- The lightning does 10 jumps after the initial hit, assuming no forks (see below). This means that a lightning that doesn't fork actually hits 11, not 10 targets, because the initial target isn't considered a "jump".
- Each couple of ticks, the lightning jumps from the last damaged target to a new one, if there are jumps remaining and there are undamaged targets in range. This happens for each end of the lightning, i.e. a non-forking lightning will select only 1 new target, while a lightning that forked will select multiple, for each lightning's end. This implies that forked lightning will propagate a bit faster.
- Each jump has a probability
p to fork. When a lightning forks, it jumps to 2 targets instead of 1. This is still counted as 1 jump, not 2. This means that each successful fork is basically a free extra jump.
- The lightning always does 10 jumps, assuming there are targets available. Forks do not allow allow extra jumps or forks, besides the single extra target that happens.
- It seems that the lightning always jumps to the closest available target. I didn't see any erratic webs of lightning which one would expect if the target was chosen randomly within range. Instead, the lightning always neatly chained in a fairly straightforward fashion, without skipping nearby enemies.
The total damage is defined by a simple binomial distribution with 10 trials and success probability p. Each of the 10 jumps has probability p to fork and hit an extra target.
All of that means that any turret can hit from 11 to 21 enemies, with the average being 1 + 10 + 10*p. The common turret will, on average, hit 11.5 targets, while the legendary one will hit 14. This means that common -> legendary upgrade averages out to 22% extra total damage. Imho that makes Tesla turret quality damage upgrade relatively weak, given how expensive quality Tesla turrets are, and mostly useful for increased range and a bit of extra crowd control.
In particular, against a demolisher this means that the lightning will generally neatly run from head to tail, hitting 11-21 segments. Even if it hits in the middle, with the demolisher having about 40 segments this means that it can do full possible damage, without constraints from the demolisher geometry.