This piece is part of Future Tense, a partnership of Slate, New America, and Arizona State University. On Thursday, Oct. 2, Future Tense will host an event in Washington, D.C., on science fiction and public policy, inspired by the new anthology Hieroglyph: Stories & Visions for a Better Future. For more information on the event and to RSVP, visit the New America website; for more on Hieroglyph, visit the website of ASU’s Project Hieroglyph.

Perhaps because cities are hotbeds of social and technological innovation, they often have starring roles in futuristic stories. But these aren’t generally tales of a better tomorrow. They’re ugly and dystopian, with drone-patrolled slums, pollution, overpopulated high-rises, and ubiquitous surveillance machines. But we can’t dismiss these stories as pure nihilistic sensationalism. They are also twisted messages of hope. If we could just heed these fictional warnings to city planners about how our cities might fail, we might figure out how to fix them before disaster strikes.

One of the first cinematic masterworks in the genre, 1927’s Metropolis, is about the horrors of the modern, industrial city. The towering skyscrapers of Metropolis—inspired by the architectural imagination of Le Corbusier—are crowned by gorgeous rooftop apartments for the ruling class. There, they play tennis among the low clouds. But down on the ground, an industrial working class labors in horrific conditions to keep the city’s gears turning. This class division, both literal and allegorical, leaves the city vulnerable to destruction when a malicious robot leads the people in violent retribution against Metropolis’ 1 percent.

In the 1950s, Frederik Pohl and Cyril Kornbluth’s influential novel The Space Merchants gave us the Midcentury Modern version of Metropolis with its sprawling, overcrowded cities whose inhabitants are addicted to junk food and cigarettes pimped by the military-advertising complex.* The overcrowded, hyper-dense New York City of The Space Merchants is a monstrous future vision inspired partly by building projects like those initiated by Robert Moses. One of the most powerful urban planners in New York’s history, Moses successfully lobbied the U.S. government for money to develop parks and other public spaces—but he also razed neighborhoods for high-rises and freeways. His top-down management of development drew the ire of activists like Jane Jacobs, who fought to keep neighborhoods intimate and diverse, more like villages than Mega-City One.

Jacobs and other neighborhood activists advocated for cities that welcomed pedestrians with a mix of commercial and residential uses in each neighborhood. Her advocacy probably saved many American cities from turning into mini-Metropolises pulsing with highways, but neighborhood preservation ultimately spawned its own kinds of problems.

The ideal Jacobsian neighborhoods didn’t benefit everyone—sometimes they gentrified, and locals were pushed out in favor of wealthier transplants. Another urban shift after the fall of Moses-style centralized planning was dubbed “white flight.” A combination of factors, including racial discrimination in loan policies, allowed whites to flee urban cores for the suburbs in the 1950s and ’60s. They escaped growing urban blight and neglect in ways that people of color could not.

Around this time, we see a new set of stories about the city emerging in science fiction. Paul and Anne Ehrlich’s wildly popular book The Population Bomb popularized neo-Malthusian predictions about humanity’s imminent demise from overpopulation. Suddenly, people were worrying that food would run out. The new urban nightmare became one of overcrowded ghettos, full of starving people who would do anything to survive.

Perhaps the most famous example is Harry Harrison’s Make Room! Make Room!, a disquieting novel about urban overpopulation, which became the cult classic film Soylent Green. Though the cannibalism angle was added just to spice up the movie, both stories offer a realistic and terrifying picture of what will happen to urbanites in a world wrecked by famine. We see a similar portrait of the urban future in John Brunner’s Stand on Zanzibar, about crowded post-colonial cities.* Books like these feel like fantastical justifications for white flight. Cities are social dead ends, doomed to be trimmed out of human history in a catastrophic Malthusian correction.

Though the green revolution in agriculture defused fears about the population bomb, urban dystopias continued to focus on urban decay as a source of terror. Now, however, pollution joined overpopulation as a crucial part of dystopia. This trend continues today.

The popular young adult series City of Ember, whose eponymous first novel became a film in 2008, shows us a very different kind of city that’s coping with catastrophic resource decline. When the story begins, our main characters are living centuries after some kind of apocalypse has made the Earth’s surface uninhabitable. The underground city of Ember is, as far as we know, the last remaining human colony on Earth. Sustained by a dwindling energy source, its population and resources are rigidly controlled. Teens are assigned jobs when they come of age, and must never deviate from their social roles. This social rigidity, which echoes the toxic class rigidity in Metropolis, is maintained by a ruling group desperate to maintain order among the closely packed, deprived citizenry.

Unlike most of the urban famine dystopias, City of Ember has a happy ending of sorts. Two teens escape from the city and find their way to the planet’s surface. The Earth is habitable again, and it turns out that Ember’s austerity program was unnecessary (though other problems await). We see an even more radical hopefulness in Ernest Callenbach’s classic utopian novel Ecotopia, about a future San Francisco that exists in a “stable state” economy created by a new coastal nation founded after a civil war. In this carbon-negative social democracy, women run the government, everything is recycled, and San Francisco’s Market Street has once again become a river.

San Francisco is the heart of urban utopia in the Star Trek series, too. We might trace its special status in fiction back to conservation movements in the 1960s that prevented the city from filling in the San Francisco Bay with landfill, which would have created a massive urban sprawl stretching from Marin down to San Jose. It’s as if San Francisco exists in some kind of alternate timeline, where cities remained small, intimate, and green. Of course, just like Jacobs’ beloved Greenwich Village in New York, these once-progressive policies have led to rampant gentrification in present-day San Francisco.

The San Francisco Bay Area’s tech industry has also spawned many of the machines that inhabit a new kind of urban dystopia story, where technologically advanced “smart cities” become sentient and impose a form of social order that’s virtually impossible to resist. Even subversion and escape are impossible. The data-driven smart city was the brainchild of Bay Area companies like Cisco and IBM, and it has grown up in science fiction at almost exactly the same time it was being formulated in business plans.

Probably the first stories to explore this idea in a sustained way are the novels in Kathleen Ann Goonan’s prescient Nanotech Quartet. Published in the 1990s and 2000s, they are thought experiments about what might happen if we built our cities using biotech so that they become living ecosystems. The hope is that we’ll solve our sustainability problems by eliminating the boundary between cities and nature in some kind of crazy Archigram-like moving city; the reality is that scientists can’t completely control our artificial ecosystems and Cincinnati begins to rebuild its citizens to suit the city’s semi-programmed whims. In the first novel of the series, Queen City Jazz, a virus infects Cincinnati, causing it to transform itself and all its inhabitants into a replica of the Jazz Age version of the city that it accesses in historical archives.

Forced to relive history every night, the people in the city become sick automatons—while those outside its walls surrender to a different virus, which gives them an obsession with riding the Mississippi River on rafts. Sly literary allusions aside, the novel offers a creepy, disturbing picture of how a futuristic city can actually drag us backward in time. In Goonan’s smart city, authority over the urban landscape has been centralized in a way that Robert Moses could only dream of. The whole city can be refashioned overnight, its inhabitants unable to protest.

Authoritarian surveillance systems are another crucial part of the smart-city dystopia. Nowhere is this more obvious than in the CBS series Person of Interest. Set in the very near future of New York City, it’s about a group of vigilantes who stop crimes with the help of an artificial intelligence called simply the Machine. Using millions of surveillance devices planted over every surface of the urban environment, coupled with data records online, the Machine is able to predict who will be at the center of violent crimes—sometimes days or hours before they happen. Government agencies, private industry, and our do-gooder heroes fight to control the Machine, who has humanity’s best interests in its (programmed) heart. The problem, of course, is that this living embodiment of urban surveillance is only as good as its programming. If a corrupt group were to take control of it, the Machine would become the ultimate tool of an authoritarian state.

Though the good guys always win by a slight margin on Person of Interest, we’re always left with the sense that the Machine’s smart city could turn against us at any time. In both the Nanotech Quartet and Person of Interest, the living metropolis is breathtaking, but always just a little too dangerous. Perhaps, these dystopias suggest, we are not yet ready to cope with what we’ll get when the city comes to life. It may rebel against us, wrecking our lives far more completely than class warfare could.

Ultimately, however, the dystopian city is not a stop sign. These tales do not suggest we should halt innovation, or shut down our dreams of a futuristic city that’s better than what we have today. Instead, they are warnings to remember that cities are more alive than we care to admit. They are full of human beings who are vulnerable, and whose needs should come before those of the industries and individuals powerful enough to shape the urban landscape. The living city of Queen City Jazz is not, in other words, just a metaphor. It is a profound truth, and to forget it means watching our cities fail again.

*Correction, Sept. 24, 2014: This article originally misspelled Frederik Pohl’s first name. It also misstated that Stand on Zanzibar is about an off-world colony. It is about post-colonial cities.