It seems that from about the 1500s and onward, nobles and royals stopped building castles for both residential and defensive purposes and preferred to build palaces with little to no defensive utility for their residences while purely military installations such as star forts replaced the castles of the middle ages.