Basically, it is the expansion ratio of the burning powder being converted to gas which determines the velocity. A .729" 12 gauge bore 30" long has approximately 12 Cu Inches of capacity. A 3-dram load of black powder has .345 Cu/In. 12/.345 gives an expansion ratio of around 36+.
Consider that a .30-30 carbine has a ratio of about 10, a .30-06 6-8 depending on barrel length & some of the big magnums go as low as around 4, & the shotgun is using faster burning powder. Even Black Powder burns faster than do most rifle powders, except perhaps the very fastest ones.
As far as the ballistics go you can do about anything you want to do in a 12 gauge with 26" barrels or for sure 28". Everything else is handling qualities.
Barrel length is mostly "FAD".
My personal favorite is 28" in a shotgun. This is based a lot on aesthetics, I am comfortable with a length of pull around 14" & to be a double shotgun looks well proportioned when the barrels are approximately around twice the pull length. Shorter barrels look stubby & long ones look like stilts. I have only ever shot a couple of shotguns with 32" barrels both heavy 10's, one a 3" magnum. For pass shooting at Canada Geese, this was fine, I have no desire for a gun I plan on carrying around through the fields to be any longer than 30" & truly prefer them @ 28".
I have not done an extreme amount of Duck Hunting, but to the best of my recollection, every duck I ever killed was done with a 2 3/4" 12 gauge wearing 26" tubes choked .012"/.024". I used 1oz of either #5 or #6 shot. I did some Swamp hunting for mostly Woodies & Mallard calling them into holes in the timber, so not really long range shooting. I hunted a few times with my late Father-in-Law in southern IL where we hunted the retention ponds around coal mines. When they dug these ponds they dug out the earth & piled it around the pond making berms about 8-10 feet high all the way around the pond. We would ease up to the top of the bank & locate the ducks, then back down & walk around the outside & try to come up at the right spot. We would crawl up the steep side & when we got to the flat on to stand & jump the ducks & shoot as they took off. These were mostly Redheads & at that point could only kill two. He was shooting an early Rem (pre-1100) gas auto with 1 7/8oz 3" loads of #4 as I recall, & I was still using my 1 oz of #6. After one Foray when I had knocked down my second duck He remarked, "I'll have to say one thing for your little gun, "It'll Reach Out There & Touch Someone". Many of you may recall when "Ma Bell" used that slogan pushing their long distance plans. All my Duck shooting was done when Lead was legal, so the shot all reflects lead shot.
That expansion ratio is of course why the .22 LR reaches its peak velocity in 16 to 18 inches of barrel. Beyond that, the expansion of the gases simply falls short of overcoming the friction of driving the bullet. I have a Win model 67 single shot .22LR with 27" barrel. It will leave about the same amount of "unburned" powder flakes in the barrel as will a little 04 with about a 20" barrel, or for that matter, my Ruger Mark 1 with the 6" barrel, or is it 6 3/4".