In the US, movie ticket sales were abysmal this summer — concluding with the worst Labor Day weekend since 2000. This followed six straight months of American box office decline in 2017, with big movies like The Great Wall, The Mummy, and King Arthur: Legend of the Sword flopping spectacularly.

There’s some evidence that better quality movies (and especially blockbusters) do better commercially than tired sequels and half-hearted spectacles. So why does Hollywood keep churning out Pirates of the Caribbean sequels and reboots that seem destined for not just critical, but also commercial failure in the US?

The answer: Studios are making those movies for everybody else.

International box office has a huge impact on what kind of films Hollywood makes

Most people who track box office returns look at “domestic” (meaning US) and “worldwide” box office when thinking about how a movie performed in the marketplace. The key to understanding what constitutes a success by Hollywood standards lies in the combination of those two figures — and sometimes, in the difference between them.

To see how this box-office model played out in 2017, take a look at this chart, which shows the worldwide earnings of the year’s top 20 movies as of Labor Day weekend, and how those earnings are split between domestic and foreign sales:

Many of the movies on this chart also appear on the top 20 list for just the US. Beauty and the Beast, for instance, sits comfortably in the top spot on both lists. Both lists have many of the same films on them, albeit in different spots: Wonder Woman is No. 2 on the US list but No. 6 worldwide; The Fate of the Furious is No. 7 in the US, but No. 2 worldwide.

Yet it’s the differences that are more telling. Several films on the worldwide chart never even broke into the US top 20, like Wolf Warriors 2 (No. 109 in the US), The Mummy (No. 25), Your Name (No. 92), xXx: The Return of Xander Cage (No. 39), and The Great Wall (No. 35), the last of which stars Matt Damon and was expected to do much better in the US for that reason.

The percentage of gross box office that comes from US versus worldwide is where things get really interesting. Consider the movies whose foreign box office dwarfs the US percentage: The Fate of the Furious (part of a franchise that has always done well globally, due in part to its diverse cast), Pirates of the Caribbean: Dead Men Tell No Tales, Transformers: The Last Knight, xXx: The Return of Xander Cage, and The Mummy, which gave Tom Cruise his biggest global opening weekend ever despite an anemic debut in the US. These films, like many that become hits abroad, tend to be heavy on spectacle and action and light on story. This isn’t because foreign audiences prefer bad storytelling, but rather because visual spectacle translates across languages more readily than plot, with its dependence on dialogue and shared cultural ideas, does.

This plays out in a slightly different way with animated movies, like Despicable Me 3, The Boss Baby, and Cars 3, which tend to do well no matter where they open, because the hunger for kids’ entertainment is huge and universal. But they also have a distinct advantage in the foreign market: dubbing, rather than subtitling, is more appealing for foreign markets, and much easier to do believably with animated films than live-action ones. The Despicable Me franchise is particularly notable in this respect, as the gibberish-speaking Minions who have come to define the series have helped propel it to continued box-office dominance worldwide.

A few outliers on the chart also illustrate the ever-increasing importance of one foreign market in particular: China.

Take Wolf Warriors 2, which did open in the US, but you’d be forgiven for missing it completely, as it opened in a grand total of 53 theaters here. But the Chinese-produced movie is the fifth-highest-grossing movie of the year worldwide, and that’s almost entirely due to its popularity in China: With its nationalist message, going to see the film has been deemed a patriotic act.

A very different case is the Japanese animated film Your Name, which was the highest-grossing film in its home country in 2016 (and the fourth-highest-grossing Japanese film of all time) and became the most profitable Japanese film in China this year. When it opened in the US in 2017, American critics raved, giving the film a 98 percent rating on Rotten Tomatoes — but it still got a comparatively small opening in the US, earning just over $5 million in about 300 theaters. (By contrast, a movie like Despicable Me 3 opened in more than 4,500 US theaters.)

Targeting the worldwide market — and in particular China — is important for the success of certain kinds of movies. Opening a movie in China is complicated because of government censorship practices and regulations around how many movies from foreign production companies can play in Chinese theaters. But increasingly, China drives decisions in Hollywood; for some high-earning movies, it can account for about half of ticket sales worldwide. So some Western studios have sought to get around these stringent regulations by partnering with Chinese production companies, which boosts the film’s chances of both passing muster with the government and attracting Chinese audiences.

But it’s not a perfect solution. The eye-popping epic The Great Wall, starring both Damon and Chinese stars like Jing Tian and Andy Lau, was a kind of test case for Hollywood-Chinese co-productions, given that it was the biggest joint production of its kind. But it got middling reviews in both the US and China, and opened tepidly in both countries. Its less-than-stellar reception in both the US and worldwide, particularly in China, may show that co-producing a big-budget blockbuster isn’t necessarily the key to success in all markets.

Still, the numbers indicate that even though Americans may seem to be souring on some kinds of movies — the endless sequels, the limp reboots — those movies will almost certainly continue to be made, because studios have an eye not just to the US, but also a broader worldwide market. And as long as that worldwide market is profitable, the movies will keep being made.