The king from the neighbouring city has become fed up with constantly being ransacked by beasts and horrors so he has enlisted the help of a strapping young lad to help him build defenses for his castle and prevent the constant destruction.
there are many different species of monster that all have different quirks and ways of getting into where ever they want to go so you must study them and learn how they work so you can then plan out your defense.
for example you could use the humble barricade to prevent the goblin horde from pushing through the front lines, but that is easy, and unfortunately monsters can be a bit smarter than that.
create a roof system for the archers on the castle walls to prevent dragons from picking them up or just burning the heck of them, depending on the species of dragon you might need to put some thought into what kind of protection would be used, as you could probably guess a flame resistant roof would not work against a poison dragon.
use mages to put up specific types of shields around the castle depending on what exactly is being thrown at you, you would have a basic shield which can deflect normal type projectiles such as rocks and sticks, or ones that deflect specific schools of magic, so fire proof or lightning proof.
you are basically a commander for the army, you will need to tell specific groups of soldiers to focus on a certain enemy type. for example a goblin running at you carrying a bucket of bombs might be a bit more urgent than a goblin twiddling his thumbs.
these are just a couple of examples, there will be a lot more than this to plan for. such as different types of invasions:
-Goblins
-minotaurs
-dragons
-demons
-orcs
to name a few. hopefully you dont get the attention of the warlords of each species...
image from:
https://upload.wikimedia.org/wikipedia/commons/6/60/Warkworth_Castle's_keep,_2007.jpg