I was just wondering do energy guns have a realistic advantage over ballistic weaponry? Would it be worth going through the major hurdles that one would have to go over to make an energy weapon work (such as the fact that the sheer amount of energy would effectively turn your gun into a potential grenade)?
Direct energy weapons and projectile weapons are different enough that the question might as well be wether tracks have any advantage over wheels.
Independently of the advantages and disadvantages, the first question is of course one of the available energy storage technology. The energy density for chemical projectile weapons is near a pretty insurmountable peak already, as there's a theoretical limit on the effectiveness of explosive material. You can use more propellant for a bullet to make it faster, but that just makes it heavier, not have a higher energy density. If you have a capacitor on the other hand that can get you an energy density that is higher than that of chemical explosives, the energy weapon wins by default. You could accelerate a bullet magnetically, but the efficiency of that would be lower than that of a direct energy emitter, so you'd only use it where a kinetic projectile is required. The total energy efficiency of a direct energy weapon is much much higher than that of any kinetic weapon.
That being said, there are numerous advantages of enery weapons that make them interesting.
The fact that all practical ones have a projectile speed of c (there is not and there will never be a plasma gun) is extremely important. It doesn't matter for a sidearm, but when you're shooting at a supersonic plane it matters quite a lot. Sure, a computer can easily calculate the position of the plane and the required lead angle to hit it, but that doesn't matter if it changes vector before the bullet (or missile) hits. The same problem occurs for energy weapons too, though only at interplanetary distances.
The second really noticable characteristic for the aiming issue is the fact that many frequencies of direct energy weapons allow you to have simply superior aiming optics. It'd be a tricky bit of engineering, but there is no principal problem that forbids using the focusing optics of the beam for aiming. And that means whatever shows up in the crosshair gets hit period. No misalignment of targeting system and projecting system possible. The most obvious use where these features make energy weapons singificantly better than kinetic weapons is for point defense against incoming projectiles. Given good sensors and sufficiently fast computers you might be able to put an anti-missile system on a vehicle as small as a car (since taking out an incoming small missile doesn't require a lot of energy in the beam).
Range is another factor where energy weapons simply outshine kinetic weapons. As long as you pick a frequency that doesn't get absorbed by whatever you fire through (possible in air, damn near impossible in water) you will get effective ranges that are orders of magnitude above those of kinetic projectiles.
The next group of differences has to do with the fact that the energy delivered to the target arrives in a different form. Basically, armor against a direct energy weapon, while possible to create, has to be very different from armor against a kinetic weapon. And there is not a good way to get both. An electromagnetic direct energy weapon with sufficiently high energy density (all the interesting ones) does not heat or melt the target. Whatever gets hit will be instantly ionized, how much of it depends on the total energy the weapon delivers. The result is a pretty hefty explosion. An energy weapon that can drill a 2mm hole straight through a tank might sound like it doesn't do a lot of damage, but the explosion resulting from the vaporized metal will most likely disable it. There's not a lot of explosives you need to take out a tank if the explosion happens inside one.
Other possible types, such as an electron beam will not transfer the energy rapidly to the surface of the target, but will penetrate matter to quite a depth, heating up all the material on the way.
Disadvantages of direct energy weapons basically all come from the necessary machinery to create the beam in the first place. The fact that a chemical gun needs to be no more than a pipe and ammunition makes them much easier to build and maintain, whereas an energy weapon needs a lot of machinery to work, from the beam generator to the cooling system.