Compare Say the USS Hartford, flagship at the Battle of Mobile Bay, with its 24 guns, to the USS Constitutions 54 guns. Why the big reduction? Was it just an increase in destructive power that made that many guns obsolete? More maneuverability from steam engines made less guns more important?
Thanks for answering.
The number of guns on ships fell throughout the 19th century for several reasons:
The guns themselves became larger, throwing first larger shot and later larger explosive shells. This means both that the weight of broadside can increase even while the number of guns falls, and that the destructive power of the shot or shell increases even while the number of guns falls.
Larger guns require larger mountings, and larger areas to traverse, so you simply can't put as many, say, Parrot rifles or Dalghren guns on a given hull as you could with guns on carriages
Larger guns also usually require a larger crew, at least until widespread automation of turrets and barbettes; for a similarly sized ship, as Hartford is to Constitution, manning requirements limit the number of guns.
Since you brought up Hartford v. Constitution, we can look at some of the differences in their armament. Constitution was armed differently at different times in her career, but what's fairly often cited as her War of 1812 armament is 30 24-lb cannons on her gun-deck and 22 32-lb carronades on her spar-deck, giving her 52 guns total. She also carried two bow and two stern chase guns, but those aren't usually counted in the ship's armament.
Anyhow, that broadside of 15 24-lb long guns and 11 32-lb carronades would allow her to throw a weight of 712 lb of metal, most often as solid iron shot. Constitution could also fire a variety of chain, bar and grape shot to mangle rigging and enemy sailors.
Hartford as built was armed with 20 9-inch Dalghren guns, and 2 20-pounder Parrot rifles, as well as 2 12 lb guns that were used as chase armament. The 9-inch Dalghrens fired shot weighing 90 lb or shells weighing 73.5 lb, so 10 of those firing on broadside would throw 900 lb of shot or 735 lb of shell -- the shell would obviously have far more destructive power than the solid shot. The Parrott rifles fired 20 lb shells, but they had a range out to 4,400 yards.
For a considerable time the main figure of merit for the armament of a ship was how much weight it could throw in a single broadside. This choice then favoured designs with the most guns. As cannons got better and as ships got better this theory started to fall out of favor. For one ships wouldn't necessarily be shooting one another at point blank range. The more guns you have, especially of different types, the harder it is to adjust their aim properly, especially in the heat of battle. Additionally, small guns might not do you much good, if they can't penetrate the enemy's hull. And there's an advantage in less diversity of ammunition, if you carry X amount of one kind of ammunition you don't have to worry about optimizing the balance between different calibers.
Quite significantly, there was also the advent of exploding ammunition, which started to become commonplace in the 19th century and very much advantaged the use of fewer big guns over many small guns.
To compare the USS Constitution and the USS Hartford more directly, consider that the largest guns on the Constitution were 32-pounder carronades, whereas the largest guns on the Hartford 9-inch (70+ lb) Dahlgren guns. A carronade is the nautical equivalent of a shotgun, it's a comparatively short barreled cannon that typically fired shot over short ranges. It was an excellent way to mess up the enemy's crew and rigging at close range, but it was comparatively useless in long range engagements. Each of the Hartford's 9" Dahlgren guns could throw roughly 3x the amount of shot that the Constitution's carronades could, but they could also throw a shell out to 3000 yards and still hit something with accuracy. The Constitution going up against the Hartford would get blown out of the water at a range where the Constitution could simply not engage effectively.
Add to that the fact that the guns on the Hartford were individually much larger, more complex gun which required more space on deck and a larger crew to handle and it starts to make sense why later ships had fewer (though individually much more capable and bigger) guns.