Anti-aircraft guns were deployed on ships and around important defensive areas during the Second World War. Light machine-guns were used against low-flying aircraft. Large cannon, with a range of 25,000 feet were employed against fighter planes and heavy bombers. The most effective of these was the Bofors Gun.
Those aircraft that were capable of performing rapid three-dimensional manoeuvres were extremely difficult to hit. So also were high-flying bombers and the main tactic was to throw up an enormous barrage of time-fused shells in front of a bomber formation. This was an expensive operation as research suggests that only one per 2,000 shells hit the target.
Just before the war Robert Watson-Watt, designed and installed a chain of radar stations along the East and South coast of England. During the Battle of Britain and the Blitz these stations were able to detect enemy aircraft at any time of day and in any weather conditions.
All countries used barrage balloons to channel aircraft into corridors of fire. During night raids searchlights were used to pick out individual targets. The British also used radar to help gunners to calculate quickly and accurately the speed and course of their targets.
Small ships carried light machine-guns but larger ships employed 20-40mm cannon against dive-bombers such as the Junkers Stuka. In the later stages of the war the Japanese Navy used phosphorous rockets against enemy aircraft.
In 1943 the Allies began using proximity fuses. These contained a small radio transmitter which detonated the shell on interference from a nearby aircraft. These were used against the V1 Flying Bomb in 1944.