IT WAS undeniably tragic when five teenage girls died in an escape-room fire in the Polish city of Koszalin on January 4th. But many in the industry thought it was an accident waiting to happen. Most entertainment venues, like cinemas and bowling alleys, go out of their way to identify and illuminate emergency exits. Escape rooms, in which paying participants are locked in a room and must solve puzzles against the clock to secure their release, are explicitly about not having an easy way out. But perhaps even more surprising to some people reading about the news from Poland is that the escape room involved was one of 1,100 in the country. How did escape rooms, a relatively new and niche business, increase in popularity so quickly across the world?

The first escape room is believed to have opened in Japan in 2007. But there are several sources of inspiration behind the idea, says Mink Ette, an escape-room designer based in Britain. The first escape rooms in Japan were inspired by computer games in which participants had to perform a puzzle to escape from an imaginary locked room. In America some of the first escape rooms were based on haunted houses, a popular attraction at funfairs. In eastern Europe the idea first spread as a way of making money out of city-centre basements for which there were few other profitable uses.

Whatever their original inspiration, they have become much more popular in more recent years. In 2014 there were just 22 escape-room venues open in America. Now there are over 2,300 in that country alone, according to a recent survey by Room Escape Artist, a website about the industry. In Britain there was just one open at the start of 2013; now there are more than 600. Around the world there are probably over 10,000 escape rooms now in business.

In spite of their rapid increase in numbers, supply has yet to overwhelm the demand. The industry is still very profitable. Some entrepreneurs report that the cost of launching their escape rooms was as little as a few thousand dollars. Would-be escapees often pay premium prices for the experience—around $25 to $30 for a one-hour game—and with up to 12 participants per hour, the profits add up for a business with low start-up and operating costs. David Middleton, co-owner of Bewilder Box, a game in Brighton, says that the various groups that visit them—not just gaggles of teenagers but also stag parties, corporate teambuilding events and grandparents taking their families out for the day—keep them filled up all week, keeping margins healthy. Bigger entertainment companies are also beginning to get in on the game, such as AMC Theatres, a cinema chain that recently launched escape rooms to promote the release of the latest “Mission: Impossible” film.

Many landlords and local authorities look favourably on the rise of the industry. Landlords can make money from poky offices, shops and basements that are increasingly hard to rent out. Municipalities can help revive fading high streets suffering from the rise of internet shopping, and add things to do for visitors in places not blessed with enough beauty or other attractions to make them hotspots for tourism.

But the industry has one big regulatory problem that comes inevitably with locking people in confined spaces: how to comply with fire-safety rules. The tragedy in Koszalin last week shows that in some countries there is still a way to go towards dealing with this issue. Escape rooms in Britain and America are safer: fire regulations and laws prohibiting kidnap mean that punters cannot be locked in without an alternative means to set themselves free. But that is not true elsewhere in Europe. One survey of escape rooms by Scott Nicholson of the Wilfrid Laurier University in Canada found that in 43% of European escape-room players, once locked in, are dependent on staff outside the room. Some venues in eastern Europe even handcuff escapees to the scenery, as part of the challenge. It is no surprise that the Polish government has closed over a dozen escape rooms for breaches of building regulations since the fire in Koszalin.

There are many ways in which escape rooms can be made safer. The installation of panic buttons or magnetic locks that open the door in an emergency is one solution. Making up new games that do not involve locked doors, such as solving a murder, is another. And the use of virtual- and augmented-reality technology, the next frontier in escape-room technology, could make the days of locking players in an actual room a thing of the past, says Yariv Levski of AppReal-VR, a software company in Israel. A fine thing, as the fire in Koszalin is unlikely to do much to dampen the international craze.