When was the first gun invented?

When was the first gun (Gun meaning any weapon which used the force created by igniting gunpowder to expel a slug, bullet, or cannonball at lethal velocity) invented, and when did firearms begin to come into common use among militaries? Although i’ve heard vague references in history classes about the advent of gunpowder bringing about the end of castle-building and the use of heavy armor in battle, i’ve never been able to find a hard answer as to when this occured.

Don’t know if this constitutes a “hard” answer, Smapti, but I found the following at this site on weapons history:

It is a common misconception that gun appeared and it was suddenly curtains for castles and the armoured knight.

Guns have a long history and the earliest were very primative indeed - the pot-de-fer (from about 1326) seems to have been a solid bronze gun shaped like a large vase with a cylidrical barrel. It fired a large bolt which probably had a wood shaft of diameter just a little less than the barrel and about twice its length, iron flights where fitted to the shaft at the point where the shaft stuck out of the barrel and there was a heavy iron arrow head at the business end. Modern reconstructions have shown the the pot-de-fer was a capable a practicable weapon, at least as good as a first class balista of Roman type and probably much easier to maintain, use etc.

Other early cannons were used for seige warfare to which they were well suited. Castles of this period were already changing in design because of the Trebuchet (a very powerful type of catapault). Before this time, castles and wall tended to be ‘the higher the better’, but a Trebuchet could knock down a tall thin wall from a safe distance. New castles were built with lower, thick rounded walls and some old castles were reinforced. Gunpoweder simply accelerated this trend. Slowly, fortifications got lower and walls got thicker - Henry VIII, of England built some splendid ‘modern’ castles even though guns had become quite sophisticated and numerous by that time. The trend continued with forts eventually being ‘buried’ behind huge mounds of earth. The real demise of fixed fortifications was the exploding shell - as witnessed by the American Civil War. Even so, there were plenty of fixed fortifications at the time of WWII although most were of limited effectiveness (e.g. Atlantic Wall).

Early handguns were used in just the same way as crossbows - crossbows being in many ways superior for a long time. Armour remained popular, but small pieces of metal became a liability as they made bullet wounds worse. Chainmail was the first thing to go. In general the fancy, all enveloping, fully articulated knights armour, which peeked in sophistication just as gunpoweder was being introduced (see Henry VIII jousting armour at the Tower of London, UK) was displaced by armour consisting of fewer stronger plates. Armour was still popular at the time of the English civil war, when guns the dominant weapon on the battlefield. Personal armour had all but disapeared by Napoleonic times, but it is still with us today.

See: http://xenophongroup.com/montjoie/gp_wpns.htm this includes a different interpretation of the pot-de-fer.

Some of the early Robin Hood stories mention “proof” armor, armor which had survived being shot by a variously a crossbow bolt, and later by early firearms. The armor was placed on a stand, and fired upon. If the projectile failed to damage the armor, the armor was labeled “proof”, and commanded a higher price. Especially good armor was shot twice, and was called “double proof”, commanding a very high price indeed.

This armor was available in the early 1600’s for certain, but may have been available earlier (bottom of the page).