So you think your video game has a railgun (or maybe a coilgun) from Doom, Quake, Mass Effect or what have you, that will defeat any armor and is incomprehensibly cool. Alas, it’s made of pixels.
Well, Virgil Rigsby from San Augustine Texas patented in 1934 what he called an “electric gun” – an apt description.

Mr. Rigsby next to a mockup of his “electric gun” (via davidszondy.com).
How badass looking is that? The pith helmet he’s wearing makes it even better.

Mounted on the deck of a ship or on the back of a truck (if it had a nuclear reactor supplying power), this would have been formidable weapon.
Bolts. I love bolts.
The premise behind this is that it’s essentially a coilgun with relatively fast reload time (even in those days, EM guns took a while to “recharge”) and rather than relying on complex triggering circuitry which would have been impractical in a time before the silicon chip, he went with a triggering wheel.
Coilguns frequently are confused with Railguns, however the principles of operation are very different. Although they both work on electromagnetism and require a vast amount of power, in a railgun, there are no coils per-se. The projectile/armature and the two rails on either side create one giant electromagnet. Whereas in a coilgun, each coil is an electromagnet momentarily energized sequentially as the projectile gets near each one.
This requires coilguns to be more complex, with multiple stages of acceleration that require intricate triggering mechanisms and careful timing. Therefore, coilguns are more awesome.

This schematic shows how each coil is arranged to be energized in sequence as the arm in the triggering wheel rotates. Note how each coil becomes smaller in width.
As the projectile gets near the next coil in sequence, it is energized. As the projectile enters the coil, it is de-energized and the next coil is triggered, pulling it through the barrel in this fashion until it exits the gun at tremendous velocity. Because the time the projectile spends in each coil is shorter and shorter as it accelerates, Mr. Rigsby wisely chose to reduce the width of each subsequent coil in the barrel.

Detail of the triggering wheel shows how the surface area of each contact plate in sequence becomes smaller as the amount of time the projectile spends in each coil becomes shorter. This is low-tech timing in the days before advanced triggering circuitry.
These days, coilguns employ a bank of High Voltage capacitors powering each coil. Modern circuits may also employ a second coil next to the acceleration coil, essentially to function as a simple metal-detector, to trigger the next acceleration coil in the sequence. Some advanced designs may use hall-effect sensors or an optical trigger that fires when the projectile breaks a laser/IR beam between the source and sensor. The optical triggers require slots to be cut into the barrel or often use barrels made of transparent borosilicate glass which is resistant to high temperatures and stress, while still being reasonably permeable to an electromagnetic field.
The biggest downside to this design (besides looking too awesome in front of the enemy, thereby ending the fight before it begins) was that it would have required a monumental amount of electricity to fire each round. These projectiles aren’t paper weights so they required a corresponding level of power at very high amps for each coil multiplied by each time fired. Due to inefficiencies of conversion from electromagnetic energy to kinetic energy, there will also be a lot of heat produced in the coils and triggering mechanisms.
That said… I’m totally building one of these when I have time.