How does defending work in DQB2?

Looking to get the game, but not clear how you can/can’t defend your settlements.

My sense is that you build a town, monsters can come attack at night or whatever, and you can defend by building simple walls and going out and hacking away at the monsters yourself. Villagers might be able to defend themselves too if you give them weapons.

Does it go further than this? Is there any sort of “tower defense” element? Can I design traps? Can I program townspeople to do certain things / defend certain areas? Can I devise strategies to hold off waves beyond just hacking away at them myself?