At least half of Hong Kong movies today are co-produced with mainland organizations, and screenwriters here are also having to toe the Beijing line. “That’s why we usually make ‘ancient swordsman’ films, or stories that happen in the period before the founding of the New China,” the Hong Kong screenwriter explained. He meant that you can show something negative in mainland China only so long as it happened before the Communist revolution in 1949 — but be careful not to portray that period as a golden era, because for that you might get censored.

Can a good story be written under such conditions? It’s difficult. Some screenwriters have managed through cunning: One director squeaked a crime movie set in Hong Kong past the censors after claiming the action took place before the transfer in 1997, while the territory was still under the rule of those evil Brits.

More often, the rules kill creativity. The 2002 Hong Kong movie “Infernal Affairs,” a gripping tale about a triad member who infiltrates the police, was remade in Hollywood as “The Departed,” which won four Oscars, including one for best adapted screenplay. In the original, the gangster antihero ultimately avoids being exposed by killing someone in his own gang. Is he still faking it, or has he become the top cop he was pretending to be? In the version of the film that was reshot in China, the ending is a clunker: Confronted by police officers who accuse him of being a mole, he turns in his badge without a word.

That crime story I co-wrote with the Chinese director had to be rejiggered multiple times. It eventually resulted in an implausible tale about an Italian businessman who flies into Beijing, steals a huge cache of art treasures, and flies out while pursued by noble detectives of Chinese origin. It was never filmed, to my relief.

The problem is not about to go away. According to Xinhua, the state-run news agency, China’s uncompromising president, Xi Jinping, told a forum of writers in October, “The arts must serve the people and serve socialism.” Anthony Lee, a Hong Kong Polytechnic University lecturer on entertainment, said, “The buzz in the industry is that the toughness of China’s new leader is making things harder, not easier.”

Screenwriters may find some hope in the fact that in the long run the Chinese public, and investors, will demand global standards of story writing. On a domestic airline in China recently, I noted that a movie showing a lone Chinese hero defeating a Japanese horde was playing on drop-down screens. Not one passenger seemed to be watching it. Instead many were watching Hollywood films on portable devices.