Today China is the world’s biggest consumer of wheat, which the country uses to make a host of noodles, dumplings, buns, and other pastries. But it wasn’t always that way.

Wheat only came to the area now known as northern China toward the end of the Neolithic period, some 4,600 years ago. And, my research has shown, things weren’t so delicious back then: Initially, wheat seems to have been treated as a crop of desperation rather than a culinary delight, grown in an attempt to stave off starvation.

The first farmers of northern China primarily grew millet—a drought-tolerant, small-seeded grain in the grass family that today is mostly grown in East Asia and is used for birdseed in the United States—starting as early as 11,500 years ago. Based on historical records and early recipes, researchers have long known that by the time of the Tang dynasty (A.D. 618–907), many thousands of years later, wheat had replaced millet and become the region’s major crop. But relatively little was known about exactly how or why this shift occurred.

Today the benefits of wheat seem obvious: Other than its versatility in cooking, wheat also grows faster and has a consistently higher yield than millet. But ancient farmers didn’t know all that right from the beginning. From the historical records, it is evident that until at least the Tang dynasty, wheat was usually consumed as gruel—the same way millet was prepared. The grains were steamed or cooked whole, producing a tough and unpalatable dish. Many early writers commented that wheat gruel was food “for the barbarians and farmers,” possibly only consumed in desperate times.

So why did northern Chinese farmers switch to wheat?

In an attempt to track the answer, while working on my doctoral research back in 2014, I began to gather as much information as possible about when different areas in northern China started to grow this crop.

Traditionally, archaeologists deduced this by looking for the physical remains of grains in dig sites, but that really only revealed what was available for consumption, not how much was being eaten. Recently, researchers have moved to a more direct method of working this out: looking at isotopes in human remains. (Isotopes are different versions of an element, like carbon, with slightly different atomic weights; some isotopes are radioactive and decay over time, but others are stable.) The proportions of different stable isotopes of carbon and nitrogen found in everything from bones to teeth convey powerful information about the dietary practices of ancient people.

Many early writers commented that wheat gruel was food “for the barbarians and farmers.”

Various plants, like millet and wheat, grow using different chemical pathways, and so they incorporate distinctive proportions of stable carbon isotopes from the soil. (This difference distinguishes so-called C 3 and C 4 plants.) Since we are what we eat, those specific ratios of carbon then get incorporated into human remains and can be detected centuries later.

Millet, in particular, was the only major C 4 crop grown in northern China, so it’s relatively easy to see when people switched from eating mainly millet to mainly something else—like wheat, a C 3 crop.

By searching through published reports, I eventually amassed a collection of nearly 1,200 datapoints covering more than 50 sites from the mid-Neolithic, about 9,000 years ago, to after the collapse of the Eastern Han dynasty in A.D. 220. The sites were scattered across eight modern provinces, spanning from Gansu province in the northwest to Shandong province in the east—roughly the distance from Los Angeles, California, to Denver, Colorado.

My colleagues and I noticed something interesting in this huge dataset: Groups across this vast study area all started to go from an exclusively millet-based diet to a more mixed diet at the same time. This is very surprising. A sudden and nearly simultaneous change in culinary practices across such a vast geographic area needs a bigger explanation than just a hankering for new food.

This animation shows how four of the ancient world’s most important domesticated grain crops spread between 7,000 and 3,500 years ago. Javier Ventura/Washington University

One possible explanation is a major climate shift, called the Holocene Event 3, which happened around 4,200 years ago. At this time, the climate became colder and dryer across continents. Across the Eastern Mediterranean and Western Asia, for example, rainfall declined by a third to a half, resulting in a 45-meter drop in the level of the Dead Sea. This “megadrought” is known to have caused havoc for crop production throughout the world, resulting in political upheavals from Mesopotamia to the Indus Valley—and the collapse of Neolithic cultures in China’s central plain.

On top of this, the late Neolithic period was also a time of rapid population growth around the world. With an ever-increasing population and fluctuating crop yield, it is reasonable to assume that Neolithic farmers in northern China were struggling.

Wheat, it turns out, actually needs more water than millet, making it seem a poor choice for a dry period of history. But it also, importantly, has an alternating optimal sowing season with millet: It can be sowed after millet has been harvested. If millet failed in any given year, farmers would still have time to grow wheat for relief. That, we think, is the most likely reason why the people across northern China started to grow wheat.

There is a serious moral to this story. From more extreme weather to changing coastlines, climate change has always brought unexpected and sometimes dramatic changes to societies. In this instance, the aftermath of the Holocene Event 3 in northern China proved, eventually, delicious: Today the people of northern China enjoy noodles, dumplings, and Chinese bread. But it might not have turned out so well. It doesn’t always.

Problems with food supplies can lead to starvation and riots, as in this image of Ireland during the potato famine of the 1840s. British Library/Flickr

Monoculture—the practice of relying heavily on just one crop—has always been a terrible idea. Consider, for example, the Great Potato Famine in Ireland: Close to a million people died in this potato-reliant country when a deadly blight hit crops during the mid-19th century.

Yet, despite scientists’ warnings, today many large farms in the United States and other parts of the world seem to be dangerously limited in the number of crops they rely on. Many species of plants are edible—perhaps tens or even hundreds of thousands of them—but today only about 200 are cultivated, and just three (wheat, maize, and rice) make up the majority of humanity’s calories from crops. According to the U.N. Food and Agriculture Organization, 75 percent of the crops grown a century ago are no longer cultivated. Some places are now trying to bring back more traditional crops, including millet, to make local agriculture more sustainable.

In ancient China, farmers were willing and able to move toward a more diverse agricultural system—one that helped them navigate an otherwise devastating event. Archaeological and historical data suggest that they also grew rice, soybeans, oats, buckwheat, and barley, though wheat proved more popular.

There is no one perfect crop. Growing a variety is the key to surviving periods of fluctuating climate. While we should still do all we can to help combat anthropogenic climate change, it is also wise to be pragmatic and prepare for an uncertain future. To prevent future food stress induced by climate change, it is a good time for more farmers to venture out of their comfort zones and expand our culinary base.