On a previous project I was tasked with creating dynamic lightning that could strike the player if too close to a storm cloud. This was an interesting challenge for me as the lightning had to look great and be dynamically rendered on everything from a high end iOS device to a low end Android device. As this was in the Unity Game Engine the language of choice was C#, which is good as C# is my language of choice these days.
While researching procedural generation for this effect I ran across a lot of implementations that stuck to using multiple line segment structs shoved into a list. This really would not do. A single lightening effect could sprawl out to hundreds or thousands of line segments. Then it would need to be converted into a bill-boarded mesh. The game could have up to 4 Lightning clouds on screen at a time with up to 4 more Queued up above. So at most it would have to support 6 dynamically generated lightening strikes at a time. The lightening had between one and three main bolts, with a probability that at any point along the line another branch could form. It was a big branching fun looking lightening and enough Vector math to crush the heart of the poor mobile cpu.