Oversized chest would be the most appropriate I mean, with some other stuff of course.
The ability to upgrade your castle (huge sums of money) not necessarily engineer it, just say, upgrade walls, or upgrade tower, etc.
Don't need to make a complicated economy, just, recruit/rescue farmers and assign em either to farm or to craft. Farmers generate food stuffs in the castles inventory and craft men generate money you can collect from a character in a room in the castle. While you can use food to feed your army or sell of in the towns. If only to help pay off the costs of the castle
It should also have a monthly 'wage' to maintain your castle. If you don't maintain this 'wage' any upgrades you have will slowly deteriorate until you're left with a barely defensible ruin.
Have a simple system to store troops in the castle, and the ability to 'store' a hero with training ability in the castle to train your men while they sit there idling. Yet another use for marnid and borcha
Should also be able to store prisoners, say your carrying around 5 enemy knights you dont' want to sell off for money, so you store them in there until some lord/count/king asks you to bring him some knight prisoners.
Of course, you will be able to pass the night in the castle free of charge.
Also generate an open field outside of the castle and enable enemy parties to attack your castle, this is where your towers and walls come in. Towers can shoot arrows thru slits at the enemy, so having good towers is a boost to your men as they fight, better towers have more slits to shoot from. Having good walls will also mean that you won't have to be turning back to your castle every time its attacked. So if some lowly bandits attack the castle they will be turned back by the mighty stone walls, or be able to crash thru the simple wooden fence (this doesn't have to be simulated in actual battle, just as a script at the end of a 'battle').
About the battle, won't need to do much other than place the castle in the middle of the field, don't need siege engines or anything. Just as it is right now, you ride towards the enemy and fight below the castle walls. If you win, well, good for you, you receive some loot. If you loose or retreat then the enemy would be able to raid your castle OR be turned back by the walls, according to the wall's rating and the amount and quality of the enemy.
Also, every quality should be able to be upgraded using money. Walls, to raise their ratings to prevent raids. Towers to aid in the battle for the castle. Dungeon, to keep more prisoners. Barracks, to keep more troops. Shops, to be able to assing more peasants as craftsmen to generate money. Farms, to assing more peasants/farmers to generate food.
To get a castle, you can do it 2 ways: 1. Earn lots of money and buy it. 2. Earn a certain rank in a faction and be assigned one, but you have to do special quests like raising troops, providing food etc. to keep it. I also think you should be able to build several independent castles, but should be pretty hard to maintain all that.
Implementing castles also means you will be able to attack them. How this would happen is also simple, fight in a field, just as you can now, only that theres a structure in it, that shoots arrows. If you win the melee, then a script will run at the end, checking if you have enough troops to overcome the castles defenses. If not, then you take some casualties and are turned back, if you win, then you get a TON of loot and money, and have a % chance of taking over the castle. Which you can either sell off for a lot more money or take it as your own. This could also be implemented in quests, where you are told to take down a castle (could be randomly generated once you talk to the count as with the raiders and troublesome bandits)
Just suggesting a more doable way of implementing castles. Without having to do 'sieges', 'urban' style fighting inside a castle (complicates AI), and other problems.
Benefits of having a castle:
Source of Money
Source of Food
Place to store Prisoners of War
Place to store and train troops
Downsides to owning one:
Monthly (30 days) fee to maintain castle in shape
Having to use money to upgrade castle features
Having to remain close to the castle to defend it against attacks, at least until you get solid walls.
Advantages to gameplay:
A useful 'money sink'
Yet another style of play that can be done (you can be a roaming mercenary/knight, or have your very own castle)
A very flexible feature that adds yet another level of immersion to the game.
EDIT:Oh, and about the visual representation of the castle:
2 Representations need to be made, inside and outside.
If you enter the castle during peacetime it would load the 'inside' scene, where you can talk to the engineer to purchase updgrades, the quarter master to exchange troops from the barracks and store items, the Master Craftsman to assign NPCs to be craftsmen, the Foreman to assign NPCs to farming and see the foodstuffs.. The Dungeon Master to exchange prisoners and the Keep Manager to sleep. Maybe some others I might be missing.
If you 'enter' the caslte while there's a battle going on the 'outdoors' loads instead of the 'indoors'. Outdoors would simply be a large field with a castle in the middle. . Also, not only do you fight using the troops in your party, but the troops barricaded in the castle would be added temporarily to your party, don't need a menu or anything, just make it like its done already when joining a battle between an ally and an enemy, part of your army fights and part of your allies army fights.
The appearance could change according to what level of upgrades you have. Since you can't individually engineer each part of the castle pre-made and pre-arranged which would be a LOT easier to implement than custom built castles.
IF you REALLY want to complicate castle attacks, you can add a 'siege unit' which you'll have to tow along with your party or store in your castle. Doesn't have to appear during the battle, its simply a way to better your chances of overcoming the enemy walls when the battle ends. Of course, there would be different qualities of siege units and the better they are, the higher the chance of taking a castle, but they will slow down your party and cost a lot of money.
EDIT*
Sry for triple post forgot a few things.
EDIT**
Some changes for coherence and added some stuff.
EDIT***
I know coding is difficult and especially adding a whole new gameplay element, but I think the way I'm suggesting is the most doable, less complex and 'easier' to implement than some of the VERY complex Ideas I'm reading, since it uses already existing features in the game.
OT-
Woohoo I'm a craftsman