Castles were normally the homes of royal families and barons. A king might have only visited a castle occasionally, before moving on to the next of their many homes. During their visits, the castle would become home to crowds of: workers, cooks and servants.
Wooden motte-and-bailey castles were gradually replaced with castles built from stone as it was a stronger building material and couldn’t catch fire as easily.
To help protect them from attack, these new castles had:
Castles would be permanently guarded by sentries, who would check people coming to the castle and would be armed with: bows, arrows and pikes (a kind of spear).