Image copyright ALAMY

Tragic tales of doomed romance and supernatural horror, often set in baroque castles, have thrilled readers for centuries. But many modern-day fans of gothic literature may not be familiar with the 18th Century novel that inspired the genre, writes Peter Ray Allison.

Ask anyone about gothic literature and they are likely to reference Bram Stoker's Dracula or Mary Shelley's Frankenstein as early examples.

In fact, the roots of the genre can be traced back to the publication of Horace Walpole's 18th Century novel The Castle of Otranto - a work whose aesthetics have shaped modern-day gothic books, films, art and music as well as the goth subculture.

Walpole - the son of Sir Robert Walpole, the first prime minister - was a member of parliament for the Whig party and it was during his tenure as MP for King's Lynn in 1764 that he wrote The Castle of Otranto.

Image copyright Getty Images Image caption Horace Walpole

The novel focuses on Manfred, the lord of the castle, as he seeks to avert an ancient prophecy by marrying his dead son's betrothed, Isabella, to produce another male heir.

As the novel progresses and Manfred's machinations become more vile and duplicitous, the castle seemingly becomes haunted.

Pictures begin to move and doors close by themselves, whilst a giant knight can be heard - and occasionally glimpsed - in the halls.

The Castle of Otranto was inspired by Walpole's fascination with medieval history and artefacts. He even built a fake gothic castle, which became known as known as Strawberry Hill House, in 1749.

It was one of the first examples of gothic revival architecture, which appealed to the baroque tastes of that time, and would later become entwined with the gothic literature movement.

Walpole initially claimed that The Castle of Otranto was a translation of an earlier manuscript from 1529. The novel employs an archaic style of writing to further reinforce this subterfuge. It was only in the second edition that Walpole admitted authorship - fiction generally being considered a waste of a gentleman's time in the 1760s.

However, the tale was a big success and inspired many contemporary imitators, including Clara Reeve's The Old English Baron in 1778 and MG Lewis's The Monk in 1796. Jane Austen's Northanger Abbey affectionately played with gothic tropes for comic effect.

In her preface, Reeves admits: "This Story is the literary offspring of The Castle of Otranto, written upon the same plan, with a design to unite the most attractive and interesting circumstances of the ancient Romance and modern Novel."

Image copyright Alamy Image caption The Nightmare by Henry Fuseli - one of the most famous gothic paintings

In his novel, Walpole sought to blend together what was termed "new" and "old" romance. "Old" romance was identified by its fantastical nature, whilst the "new" variety (at the time of writing) was more grounded in reality. In this blending of the two styles, Walpole placed ordinary people in extraordinary situations.

The core elements of The Castle of Otranto quickly became staples of gothic fiction. Despite being written 250 years ago, the legacy of The Castle of Otranto continues to be found within modern fiction.

Take Stephenie Meyer's hugely popular Twilight novels, in which Bella is romantically pursued by the vampire Edward and the werewolf Jacob while fleeing the supernatural machinations of the vampires James and Victoria.

Image copyright ALAMY Image caption Twilight - a gothic fantasy centring on the relationship between Bella and the vampire Edward (centre, seated)

Stephen King's The Shining is steeped in gothic influences, including The Masque of the Red Death by Edgar Allen Poe (which was also directly influenced by The Castle of Otranto). The Overlook Hotel in The Shining acts as a replacement for the traditional gothic castle, whilst Jack Torrance is a villain tinged with tragedy who seeks redemption.

While not gothic per se, the horror in HP Lovecraft's writing was undoubtedly influenced by the gothic tales told by his grandfather.

Gothic cinema has rarely been far from the screen, as proven by the British Film Institute's recent season dedicated to the gothic. Many of the early gothic movies, such as a Nosferatu, are still hailed as classics to this day, while Bram Stoker's Dracula has repeatedly been adapted for film.

What is Gothic?

Image copyright Getty Images

Goths were Eastern Germanic people, responsible for the sack of Rome in 410 - the first time it fell in its imperial history

Term used by Renaissance art historian Giorgio Vasari to insult the "barbarous German style" of medieval architecture

Consequently "Gothic" emerged as cultural term, to denote a style which was opposed to the classical (or Roman) idiom

Shorterned form "goth" first used in 1980s to describe genre of post-punk youth culture (above)

BBC iWonder - a timeline of gothic fiction

Tim Burton's cinematic adaptation of Sleepy Hollow also includes many elements that were first established in The Castle of Otranto, with its patriarchal figures and a plot revolving around revenge and land rights.

There have also been television series such as Lost - which, despite being set on a tropical island, nonetheless follows Walpole's example of placing ordinary people in extraordinary situations, with survivors struggling to avoid the "smoke monster". The video game Fatal Frame (also known as Project Zero) features an autocratic family master, ancient curses and tragic romance.

Then there are the goth or gothic bands who emerged in the 1980s such as The Cure and Sisters of Mercy, inspired by the gothic literature and with lyrical themes of death, love, spirituality and identity. The Cure's The Drowning Man, for example, was directly influenced by writer and illustrator Mervyn Peake's gothic Gormennghast Trilogy.

Image caption The Cure on Top of the Pops, 1989

The exotic aspect of gothic literature that Walpole first introduced in The Castle of Otranto influenced the gothic subculture. Gothic fashion is designed to reflect a particular kind of lifestyle that is synonymous with gothic literature.

The Castle of Otranto itself took inspiration from previous works.

Meg Tasker, an Associate Professor at Federation University Australia, observes that Walpole drew on "a whole range of literary sources and folklore, German as well as English and Scottish". The works of William Shakespeare were also an influence, as demonstrated by Walpole "alternating between comic and serious scenes".

Despite its fantastical elements, there remains a consistent internal logic within the novel. For example, apparitions appear to protest to against anything that could result in the Alfonso and Don Ricardo families being united.

Strawberry Hill House

Image copyright Getty Images

Gothic revival villa built in Twickenham by Horace Walpole between 1749 and 1776

Eclectically influenced by the look of medieval castles and cathedrals, in contrast to classicism of many 18th Century buildings

According to architectural historians, it was the first house in house to be built from scratch in the Gothic style, and the first to borrow from historical examples, eg chimney-places borrowed designs from tombs at Westminster Abbey

Wapole never married and left no heir - in the 20th Century the building was used as a teacher training college; opened to public in 2010 following extensive restoration

Visit Strawberry Hill - Horace Walpole's Gothic Castle

"History is a romance that is believed; romance, a history that is not believed," Walpole said.

Tasker explains that The Castle of Otranto was "framed in such a way that the 18th Century (Protestant) educated reader could dismiss magic or miracles as Catholic superstitions". Members of the lower classes and women are portrayed in the novel as "superstitious, idolatrous, slavishly obedient to the Church".

Despite the horror within the Castle of Otranto, there remains a subtle vein of almost farcical humour.

"A castle making a groaning noise with the release of pent-up vapours is an elaborately worded early example of that staple of English humour, the fart joke," says Tasker.

A gigantic helmet falling from the sky onto one character predates the absurdism of Monty Python.

Image copyright ALAMY Image caption Jack Nicholson in The Shining (1980), based on Stephen King's novel

As the genre matured, later authors of the genre tended to focus on the horror and tragedy. The farcical humour that once permeated The Castle of Otranto was found mostly in spoofs of the genre.

For instance, Wallace & Gromit: The Curse of the Were-Rabbit (2005) is a lampoon of the gothic genre, yet the film also celebrates its influences.

It is filled with gothic tropes and literary references, from Wallace being transformed into the were-rabbit yet still being drawn to his paramour Lady Tottingham, to the character Lord Victor Quartermaine - a reference to Allan Quatermain from H Rider Haggard's classic 1885 novel King Solomon's Mines.

In this respect it is true to the spirit of The Castle of Otranto, which both celebrated and mocked the fantastic. As Tasker says, the novel is "sublimely silly".

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.