Perchtoldsdorf Castle probably was laid out before 1000 AD, part of a chain of fortifications along the eastern rim of the Vienna Woods. One Lord Heinricus de Pertoldesdorf was mentioned in an 1138 deed, during the Babenberg rule. Their Perchtoldsdorf vassals continued to rule from the castle even when the Babenberg dynasty became extinct in 1246.
The conflict between the Habsburg emperor Frederick III and his younger brother Archduke Albert VI of Austria started an unstable period in the region. In 1446, many homes in the town were burned during the invasion of the Hungarian regent John Hunyadi. During this time, the castle was occupied by various rival forces, including mercenaries of King Matthias Corvinus from 1477 until about 1490, when Frederick's son King Maximilian I re-established Habsburg control over the area. This turbulent period interrupted the construction of the tower house (Wehrturm), the town's landmark with a height of 60 metres. The tower and other fortifications permitted a successful defense of the city against the Ottoman troops during the 1529 Siege of Vienna, while the surrounding area was devastated.
References:Herceg Novi was founded (on a former small fishing village, existing since Roman Empire times) as a fortress in 1382 by first Bosnian King Stjepan Tvrtko I and was called Sveti Stefan or Castelnuovo. The Turks conquered Herceg Novi in 1482, and ruled for 200 years, until 1687. However, there was a short pause between 1538 and 1539 when it was held by the Spaniards before they were defeated in the Siege of Castelnuovo. Turkey ruled again until 1687, from then until 1797, the town was ruled by the Venetian Republic.
The Herceg Novi old town is amazing. It is on a fairly steep hill that leads all the way down to the sea. Wandering through the small stairways to the various plazas and fortresses is a many hour adventure.