In medieval times, castles were often under siege for months on end. In all of the history I've read, the defenders were always defensive, except for the occasional sally out to light up a few tents or slaughter a few workers that didn't have adequate protection.
Here's a gag that castle defenders never seem to have thought of.
As soon as the siege started, or news arrived that one would, they should have torn down a few stone buildings and used the stone to build two walls in the courtyard.
The walls would have been about 12 feet high, thirty feet long, and four feet thick, extending inward from the sides of the front gate in a VEE shape that closed to juuuuuust wide enough for one man to pass through. Sideways. Barely. If he was real skinny.
Then the next (or first) time the enemy charged, they should have opened up the front gate, raised the portcullis, dropped the drawbridge, and sent five guys out who were under orders to take one look at the attackers, throw down their swords, and run screaming back into the castle.
Leaving the gate open behind them.
(Oh Gosh, Martha! Deserters have breached the defenses!)
Those "terrified" guys would then run right up some handy ladders, exit the veetrap, and haul the ladders up behind them.
(Oh, shucks! No ladders for Bad Guys!)
Sensing a swift and decisive victory, the enemy troops would have swarmed in and gotten jammed up in the veetrap worse than a Bloomingdale's elevator on a Super Sale Saturday.
Hundreds would probably have suffocated within minutes. The defenders on the ramparts would have finished off the rest. And those who got stopped just outside the gate, right under the Boiling Oil Disposal Ports.
The first nine guys in would have seen the one-man exit, and raced each other to be the first man through--to survive!
They would have had to to settle for a six-way tie.
Everybody else would have played Follow the Leader until it was much too late to turn back. Until it was impossible to turn back.
When the veetrap was packed full, no amount of battering or burning would get past the 30-foot plug of dead bodies. Even if they'd brought up a battering ram it would have been useless.
And, anyway, the porticullus would have dropped as soon as the veetrap was full. There would have been no escape for the few still alive.
After a while (and huge losses) the enemy would have had to pull back. And probably abandon the siege entirely.
The defenders would have then cleared out a few score bodies at their leisure, and closed the gates for the remainder of the evening.
Note that not only would they have decimated their attackers, they'd have acquired a lot of bodies to repatriate with their catapults.
That's always good for morale.
Now, fast-forward about a thousand years...give or take.
In a really hard-core SHTF situation, if an eventual mass assault was a given, basic veetraps could be constructed at the front and back doors of a residence or a refuge building. (And/or sliding glass doors, if any.)
Eventually, a group of attackers would make their move: they'd kick in a door, charge in, and be stopped dead a couple of 3/4" plywood wild-walls, braced by 2X4's, and decorated with waist-high ports cut in them for convenient lead injection.
Six sheets per entry would probably be plenty. Painted black on the inside for night ops, of course.
In a pinch, you could cobble your veetraps together out of whatever was handy. Beds, furniture, refrigerators, bookcases. Even fence wire.
Afterwards the well-rested defenders would have lots of fresh ammo, many new items for the armory, a lot of good-for-barter garb to wash the blood out of, and maybe even a little fresh food, if times were REALLY tough!
Just a thought, y'all!