SDA logo

The shaft strikes again!

Hey, hey guys. Those of you who have watched the end 100%s or e4m8 Eh will probably know what lightning bug is about. But for others, here's a short description...
Lightning bug was discovered quite some time ago. The first demo to use it is the Cheated e4m3 nh in 2:34. The first non-cheated, proper demo to use that was end_056 EH. What does this trick do, exactly? It allows you to kill monsters through walls et cetera, everything with lightning gun (called 'shaft' by many people). To see what it can do, watch those demos:

  • e4m8 EH by Karol Urbanski
  • end EH by Flavio Quadros
  • end NH by Thomas Stubgaard
    To date, we have never understood the trick exactly. However, in the last time, thanks to research Lag.Com did, we've finally understood what the thing is about.

    Technical stuff.

    Let's start with the rough technicalities. What makes the bug happen? A small inconsistency in the code. Apparently, the designers of Quake wanted to make the beam a lot, lot thicker. It was meant to be consisting of three beams packed tight near themselves, to form a bigger beam. There is another relict in the code that shows that: it is impossible to deal damage with two beams to one monster at any given frame. Probably designers wanted a thicker beam that would consist of three beams, so that it could damage three monsters in a line.
    But, but. What is that inconsistency in the code? "The lightning has three trigger fields, one which starts directly from you, the other two are offset slightly. Those offsets are what make the odd shots work. Now I get it. The lightning itself doesn't go through the wall. It's those two extra trigger fields I mentioned that do. They can appear some distance away from yourself. The code calls normalize on the vector, but it doesn't store the result. Meaning the vector is way too big for the operations that follow. Allowing you to embed it deep into walls." And later he said: "basically, it calculates a vector which is based on your beam angle and length. the 'other' two beams are generated by adding this vector or subtracting it from the 'real' beam." (LagDotCom).
    The natural question, why did the designers add that is answered by me above. It was supposed to make the beam thicker and make it possible to damage three monsters in a line. But, for those that know some things about coding, here's the bug in the code:

    The code in Quake:
    f = p2 - p1;

    The correct code:
    f = normalize(f);

    p1 is you, p2 is the beam end point.

    And now something for humans...

    So, as explained in the paragraphs above, there are three beams: one is visible, the others are not and basically go into the fairyland. To show the power of this trick, I have made a special kind of run. Look at this demo. It's a 100% kill through e4m8 on easy difficulty. It's my second run through it like that, and it's completely cheated, as I used impulse 254, god and impulse 9 all the time. However, what's so good about it? Well, almost every monster is killed without getting aimed at, now this is what I call abusing the bug.
    There are two basic kinds of the way this bug works. The first one is the predictable, rough pattern I use to kill almost every enemy in this demo. The second is the 'anomaly', which is also in that demo, and in the demos I have shown at the beginning. Shambler kill through wall is like that... Let's start with the easier to explain one, shall we?

    The usual stuff

    The usual stuff in here means stuff with which I kill most enemies in lbug.dem. It's so easy to plan for I don't need specific angles, I just calculate on the fly. Finding good angles CAN be a pain sometimes, but it's not so major in this mode of shooting. A few principles:

  • The additional beams are as long as the main beam, so if you are standing close to the wall they are very small.
    This of course lets us manipulate the length at will.
  • The additional beams deal the same ammount of damage, however you can't use two on one enemy at a given frame, the damage from the second and third beam is not counted.
    That lets us aim at 3 monsters at once, but not on only one.
  • Those additional beams can be planned for in this mode.
    You may ask "how?". Well, Lag.Com has made a progs.dat that lets you see the additional beams. To get that progs download this. WE ARE NOT ACCEPTING DEMOS RECORDED WITH THESE PROGS, USE THEM ONLY FOR RESEARCH! Remember to put the progs.dat in a folder different than your qdqstats folder. I have made a few demos to showcase the theory: get the pack of them here.

    What exactly is this theory to that trick? First, find a wall that is either 0 degrees or 180 degrees (or is it 90' and 270' in the editor?...ah well.). Aim at it so that the main beam is orthogonal to the wall. Stand near the monster you want to kill. Now, gently move your mouse left or right. If you do it good, the monster should be hit by nothing. That's it. The more you move the mouse from the orthogonal angle, the more away will the beams end. Watch the demos in pack, there are also 'up and down moving' examples in there.
    This technique can also be used on walls that are not 0' and 180', but it's a lot, lot easier to find a proper angle when aiming at a wall like that. Experiment with the progs.dat, you'll find a few things out I'm sure.
    The biggest range you can use this trick on is about 9600 Quake units, which is 16 times the shaft range. Pretty good, if you ask me. Shamblers have additional beams as well.
    That wasn't hard at, the last thing.


    The anomalies are places where you don't need to aim at the 180' boundary. You can see quite a few in the demos, they mostly follow the same pattern of mouse movement, but it's not exactly easy to predict where will they appear.

    Pictures and charts and diagrams