In Hollywood, the deal is king. Deals are how scripts get optioned, how stars and directors get signed up, how films make it to production. A good one can mean financial security and a name above the title. A bad one can be as dispiriting, gruelling and financially ruinous as building your dream house on unmarked floodland. The bad news is sometimes it's worse than that, and in the current financial climate it's getting tougher to make the right deal.

In these straitened times, George Clooney is allegedly settling for upfront fees of a paltry $2m, while Megan Fox has walked away from Transformers 3 because her salary demands "cannot be met". The most dramatic illustration of the difficulties Hollywood faces, though, comes in the plight of MGM – reportedly $3.7bn in debt – which has postponed production of the 23rd Bond film, despite it being part of the second most successful franchise of all time, after Harry Potter. MGM's much-anticipated co-production (with New Line) of The Hobbit is in similar disarray, with director Guillermo del Toro leaving the project last month, because his contract had only been for three years and he didn't fancy stretching it to infinity.

It isn't all doom and gloom for big-time dealmakers, though: the Potter films come to an end later this year, after generating fortunes for all concerned. (Prominent UK entertainment lawyer Reno Antoniades explains: "If you're doing Potter, there are no issues – the head of Warner Bros presses the green light and off you go.") And it's probable that the likes of James Cameron and Dark Knight director Christopher Nolan – who was handed $170m to enjoy relative artistic control on the forthcoming Leonardo DiCaprio blockbuster Inception – aren't feeling the chill wind either.

The trickiest deals for producers to hammer out are generally in the so-called "mid-price" market – lower-end Hollywood movies and aspirational indies seeking finance and distribution agreements. Ricky Gervais, who became his own producer with 2009's The Invention of Lying, says: "The more you need to court different people to get their money, the more they try to interfere." The story behind Mike Figgis's 1993 movie Mr Jones remains a salutary tale for aspirant dealmakers. Figgis still seethes at his treatment by producer Ray Stark: he says he was banned from the editing room and discovered people he thought were allies were also working for Stark."Finally I read my contract myself and discovered that what Ray Stark had told me – that he had the final cut – was not true," he says. When, in a meeting, he accused Stark ("Fuck you, Ray, you don't have final cut!"), it transpired that the head of the studio, who did have the rights, had delegated them – to Stark.

Andrew Eaton, the producer behind A Mighty Heart and 24 Hour Party People, says the most exasperating element of deal-making in Hollywood is the prevailing culture of obstruction. "A lot of people in business affairs think the last bit of power they have is to stop something happening. They take up time going over these ridiculous what-ifs: what if the ceiling collapses, what if there's a flood? It's just willy-waving. Similarly, agents don't like it if you speak directly to talent. I remember a producer friend of mine had an agent come up to him and say, 'You've shat in my mouth.' He meant the producer had talked to the client before he talked to the agent." He adds, darkly: "There are people in the business who consider the green-lighting of any project a failure."

Certainly, there are numerous stories of agents punishing producers for leaving the marked path. Stephen Woolley says he pitched the storyline of his 1986 thriller, Mona Lisa, to Sean Connery as they descended 28 floors in a lift. Connery loved the idea and told Woolley he wanted to do it. "So I called his agent, CAA, one of the biggest agencies in the world, and the assistant said: 'What do you mean Sean's read it? You mean you didn't come through us?' The agent himself refused to take my calls. That was it – doomed."

Even if you do get the star you want, reaching agreements on their dizzying array of demands can be wearisome. Apart from negotiating "back end" top-ups on stars' fees (anything from gross profit participation and image rights payments to awards bonuses), studios and producers have promised all sort of things to "quirky" actors, such as unlimited Montecristo cigars (Roger Moore), round-the-clock chauffeurs (Eddie Murphy), and a mysterious clause that Eaton was forced to offer – a guarantee to one actor that "no orifices" would be shown on screen.

Eaton admits the sheer slog of trying to close a deal in LA has occasionally broken down his defences to an embarrassing degree. "We did bad deals on The Claim with Pathe and MGM/UA. They kept asking for changes which meant all our fees were eaten up. I remember at the very last minute, 10 o'clock at night on Friday, when we thought the deal was finally done, someone from business affairs came into the room and said, 'No, actually, we want you to defer another chunk of your fees.' I can't remember the exact words I said but I know the last one was 'cunt'. Then I stormed out and burst into tears."

Of course, no matter who you are, a deal can go wrong, as John Travolta found out when he took half his usual $20m fee for 2000's Battlefield Earth, in favour of a $15m bonus if it took over $55m. It didn't. But if you're a wannabe producer whose hope has not entirely deserted, there are a few pointers that might come in handy.

One, tell the studio your script is "life-affirming". Apparently DreamWorks supremo Jeffrey Katzenberg begins pitch meetings by asking, "How is this movie life-affirming?" (Meaning, Basic Instinct writer Joe Eszterhas has said, "How will this movie make $100m?"). Two, don't fall out with a powerful lawyer (some say it's equally crucial not to upset any powerful Scientologists). Three, don't leave a deal before it's finished. According toWoolley, whose $63m-grossing The Crying Game aided Miramax's ascent to super-indie powerhouse status in the 90s: "It's all about timing, knowing the point when you've gone as far as you can with a distributor, where they are still in the contract zone and you can close the deal. You don't want them to sleep on it. My ex-partner Nik Powell would go to people's hotels and sleep outside their rooms until they came out for breakfast. That's how you close a deal."

For Gervais, the secret is simply to care more about your film than the money. When he was preparing The Invention of Lying, he says: "I went into every meeting with one great strength: I was always ready to walk away. I don't care if they say no and that makes me bulletproof. They don't know what to say when I say I don't care about the money. The room literally goes quiet. I don't think they think, 'Wow, what a man of integrity.' I think they're thinking, 'Wow, what a fucking idiot.'" Nevertheless, he says, the secret of good film-making is not worrying about the bottom line: "If you want to make a good film – try to make your film for £40."

It's all worked rather well so far for Gervais, who secured final edit on The Invention of Lying and had the film in the black before it was released, having kept the budget down and sold 50% of the film's equity (retaining the other half for himself) to a studio for more than it cost to make. But the new climate of film-making is hugely challenging for the mid-range film-maker working with a budget between $5m and $50m. Pre-sales – the industry practice of selling distribution rights before a film is actually made – are drying up, and the studios, fearful of the democratising properties of digital media, are pouring their energies into 3D, a process still beyond the financial realities of most non-studio film-makers.

According to Colin Vaines, a former executive vice-president in the European arm of Miramax and now a producer, it's increasingly important for a mid-budget film looking for finance to have an X Factor: a newsworthy headline-generator putting your film above the movie-fan parapet. For Vaines, currently producing Ralph Fiennes's directorial debut, Coriolanus, this comes in the shape of gossip-magnet Gerard Butler. For Eaton, it's Liam Gallagher, with whom he is working on the Beatles biopic The Longest Cocktail Party. Vaines's next project? A time-spliced love story, directed by Madonna. Harvey Weinstein sure taught him a few things.

Clause for concern: five classic movie deals to learn from

The first "morality" clause was implemented in 1921 when actor Fatty Arbuckle (below), was arrested for the manslaughter of a young actress. Arbuckle was found not guilty but a good behaviour clause is still common in Hollywood today.

In 1949, Jimmy Stewart became the first actor to be awarded profit participation. Universal-International, concerned about the upfront costs of Anthony Mann's ambitious western Winchester '73, struck a deal with Stewart's legendary agent, Lew Wasserman, to give Stewart half the profits instead of a large fee. In 1980, Paramount gave birth to the modern super-producer, when it granted George Lucas retained ownership of 50% of Raiders of the Lost Ark and control of every aspect of expenditure on the project, while assuming all risk and sacrificing a hefty share of revenues before recouping costs. The film needed to gross $42m before Paramount turned a profit. It grossed $242m.

Johnny Depp is set to become Hollywood's highest paid actor of all time, when he picks up his "guaranteed minimum" cheque for $35m for appearing in Pirates of the Caribbean 4. All in all, the Pirates movie franchise will net him at least $80m. Screenwriter Joe Eszterhas broke the record for a script fee, when he received $3m for his work on Basic Instinct (above, starring Sharon Stone and Michael Douglas), in 1990. The amount led to a meeting of studio heads to discuss ways of keeping script prices down. Eszterhas claims it took 13 days from idea to the script auction.