The second image is strictly inferior though, enemies can make it to the base of the wall and are then much harder to hit/target. Ideally, you’d be able to make a six sided star fort to fit with the usual hexagonal grid, but that’s up to your dm.
Well, technically it doesn't say your connecting walls have to be straight, just 80 feet long. Not exactly sure how you're going to make them connect up into a hexagon or star out of "four turrets with square bases, each one 20 feet on a side and 30 feet tall, with one turret on each corner", but if you've got a diagram I'd love to see it. 😆
Any self respecting tactician would copy a 15th century actual proven in use fortress. If you are limited to four turrets, then the drawing on top is best.
But you'd have to go outside the walls to get to the turrets. And you're in a situation where you have someone who can cast 8th level spells. I'm not sure this advice is sound. 🤨