In order to stop your village being razed or captured you need a strong castle layout to withstand the heavy waves players send at you. This also allies to the AI attacks that hit your frequently. If your castle is not built strong you can find both players and AI pillaging and ransacking your village all the time. The best castle layouts have great towers as the basis for their defence with guard houses, turrets and ballista towers protected inside the castle. Moats should form the main area between your towers so you have a mix of both stone and water based defence s that the enemy has to work hard to destroy. Your castle layout should simply make it very hard for the enemy to cross your white line and nearly impossible to reach your keep.