It's worth noting that if the gun is elevated, the force of recoil is partially horizontal and partially vertical. While the gun carriage rolls backward as a result of the former, the deck must absorb the shock of the vertical component. That's one of the reasons that bomb ketches, whose principal armament was a large mortar, had a strongly-reinforced mortar bed to absorb the shock.
Fixed Carriage. Initially, pivoted guns were light weapons. However, some of Chapman's designs had pivoted heavy guns, and the nineteenth-century British and American navies toyed with the concept of providing a ship with fewer but heavier, more versatile artillery pieces. Both long guns and carronades were placed on pivots. (ChapellaHASN 238, 319, 422).
Early pivot designs had to be combined with raised decks or cut-down bulwarks, which exposed the pivot gun crews to small arms fire. This problem was corrected by a mount introduced during the War of 1812. With improvements to sturdiness, it could be used with a "long" 18-pounder. (319).
With a pivot mount, guns could be given a broad field of fire, but this meant that to avoid obstruction, a ship had to carry fewer (but perhaps larger) guns. Larger ships nonetheless retained broadsides; it took time to abandon the notion that the rank and seniority required to command a large warship shouldn't be based on the number of guns, but rather on the weight thrown. Hence, pivot guns tended to be used mainly in smaller vessels until the 1840s. (422). Eventually, design philosophy changed, and the big guns (say 10" up) were mounted on turntables and the smaller guns (9", firing 72 pound shell, or smaller) in broadside. (Canfield).
When pivoted guns became heavy enough to need to be mounted on a turntable, the designer had to decide whether to protect the crews from enemy fire and if so, whether the armor would rotate with the gun (true turret) or be a fixed part of the hull, a semicircular parapet (hooded barbette) that the gun fired over. The "hood" could be a light hood, just to fend off splinters, or a heavy one, to resist shells directly. If there was no protection at all, just a turntable, that was an open barbette.
The problem with the hooded barbette was that it limited the gun's range of elevation, whereas the true turret's disadvantage was weight (you probably want to use an auxiliary engine to turn it).
Another option was the disappearing gun; after the gun fired, its turntable would sink more deeply down inside a barbette for reloading. This design was used on HMS Temeraire (1877). It worked, but it was expensive to build and slow to reload, and was deemed a failure.
A true oddity, the British Wolverine (1798), had eight main deck guns which could be switched from side to side by thwartship tracks or skids, and which also had pivot mounts. (ChapelleHASN 422).
Recoil Reduction. With a muzzle loader, recoil had the advantage that it ran the gun into a reloading position. With a breech loader, recoil is simply annoying.
To reduce the recoil distance, you need to supply some countervailing force. If the gun was on a slide mount, the slide could curl upward on the inboard side, and the carriage's recoil would be slowed by gravity. Friction brakes were sometimes used to slow the recoil of wheeled cartridges. Pneumatic (compressed air) brakes were experimented with, but there were problems with air leakage.
The most successful recoil brake was of a hydraulic nature. The carriage was connected to a piston that fit into a liquid-filled cylinder. As the carriage recoiled, the piston was thrust into the cylinder, encountering fluid resistance. Tapered grooves in the cylinder allowed some liquid to pass from one side to the other, thus altering the dynamics of the system. A typical recoil liquid was a mixture of glycerin and water.
After the recoil was exhausted, the carriage had to be returned to the firing position. In our period, this was done manually. Later, gravity, springs, pneumatics or hydraulics were used to effectuate the return, and an additional brake might be used to soften the end of the "counter-recoil."
Admiral Simpson's ironclads have guns with hydraulic recoil and hydraulic counter-recoil (and, for that matter, hydraulic gunport control and ammunition hoisting). However, it's important to note that the hydraulic systems were salvaged from mining equipment, not made from scratch. Hence, only a few ships can be so equipped.
One method of avoiding recoil is to fix the gun securely and sturdily to the ship structure. This is not a Third Law violation; the force and momentum are transmitted to the entire ship, and that is so massive that the firing of a single gun is not going to have a discernible effect. (A full broadside would probably roll the ship substantially, and could strain the hull, which is why broadsides were actually rippled, not simultaneous.)
The catch is the word "sturdily." The part of the ship structure to which the gun is attached must be sturdy enough so as to withstand the force and transmit it to the rest of the ship. It would not be very good for continued employment as a ship designer if the bulwark broke off.
While this is less likely to be an issue for an ironclad, in which the gun is connected to the armor, it's a concern with wooden ships. Still, wooden bomb ketches were constructed in such a manner as to absorb the shock of firing a heavy mortar. And "non-recoil carronades were first used by the Arrow in 1796. . " (Blake 140).
The recoilless guns of land warfare use a different cheat; they eject a counterblast of equal momentum (mass * velocity) in the opposite direction at the time of firing. This may be propellant gas, or liquid or solid material that is forced out by the gas. The problem, of course, is that it is dangerous to stand behind the breech end of the cannon in the path of the counterblast. (Not that standing behind a recoiling cannon was smart.) The German Bohler 78 mm had the counterblast fired obliquely upward, to reduce the risk to crew (Hogg 135); but this would also require a larger blast to compensate for the angle, and create a downward force on the deck. Also, these recoilless systems are very wasteful (~80 %) of propellant.
An intermediate solution is a muzzle brake. This is a baffle attached to the muzzle end; the gases escaping with the projectile are deflected sideways and upward, so that they don't create a backward reaction force on the gun carriage. (Payne 265).
Gun Laying
A gun is elevated vertically, and traversed horizontally, so that with the chosen projectile and charge, and discharged at the correct moment, it will strike the target. The greater the range, the more important it was that the gun be elevated to compensate for the fall of the projectile, and traversed to lead the target.
Elevation (the angle between gun bore and horizontal, not the height of the gun above sea level) was relatively straightforward. Since about 1450, cannon were cast with trunnions-short lugs extending on either side of the barrel to serve as an axle. This fitted onto the gun carriage, and the barrel pivoted up-and-down around it.
Maximum elevation was dependent on the geometry of the barrel and carriage, but probably was about 15°-the highest value typically given in nineteenth-century gunnery tables. One source says the limit was about 7°, but that ships could hit a more elevated target by firing on the up-roll. (Volo 256). Douglas (252) proposed that nineteenth-century ships be equipped with "dismantling guns" that could achieve at least 30° elevation.