Many of the hundreds of thousands of homes that gave way in the earthquakes that have rocked Nepal in April and May shared one common feature: heavy roofs. Building collapse in Kathmandu and surrounding areas contributed to a death toll now rising toward 10,000. The destruction of buildings sharing the same flaw helped kill 200,000 in the 2010 quake in Haiti, more than 80,000 in China in 2008 and at least 80,000 in Pakistan in 2005, to name just the most recent deadly disasters.

In contrast, only around 500 people died in Chile when it was struck in 2010 by a temblor 10 times stronger than the one that shook Nepal. The difference was simple: Chile spent more money on better construction technology and ensured that people built appropriately following a disastrous earthquake in 1960. Chile's approach shows that it is possible to build structures that can dramatically reduce the loss of life in a strong quake, but implementing such methods remains a challenge in much of the world.

"Human nature seems pretty universally to favor quicker and cheaper, particularly when considering relatively rare consequences," says William Holmes, a structural engineer at San Francisco–based engineering firm Rutherford + Chekeneo. Corruption further exacerbates that leaning toward fast and cheap, as builders submit fraudulent bids, construction is hurried and officials and engineers are bribed or simply too busy to supervise and ensure new buildings meet safety standards. As Holmes adds: "The large majority of countries have building codes in place that would significantly improve performance if enforced."

Civil engineer Elizabeth Hausler Strand, the social entrepreneur behind  preparedness outfit Build Change, has an even simpler explanation: "If people don't have the money to build a safe building, then they won't."

Nepal has had a building code since 1994. But enforcement is lax or nonexistent. Tin roofs held up by steel rebar–reinforced concrete columns remain the norm, rather than the more traditional—and more earthquake resistant—combination of wooden supports for brick buildings. When inflexible concrete and steel replace flexible wood, especially concrete and steel that is neither properly built nor reinforced as in Nepal, then the buildings come down on the people within when the ground shifts. "Masonry is a very poor material in an earthquake," Hausler Strand explains. "Once it cracks it has no more capacity to absorb energy," just as a piece of chalk snaps under pressure whereas a tree branch bends. But wood has become a rare building material in Nepal and some other countries because of forest overuse. Those forests that remain are now protected.

Better building techniques can help in the absence of wood. Hausler Strand has her rule of the three Cs: configuration, connections and construction.

In Nepal the buildings that collapsed tended to have bad configurations. In multistory buildings hollow first floors to allow for retail supported heavy floors above where people lived. Support walls could help with that but would cut down on retail space. Stiffer, stronger columns would be the only way to allow for both greater strength and shops, Hausler Strand suggests. "The first step is to listen to the home owners," she adds. "If the architecture is not what they want, then they're not going to listen to us about building safety."

Simply wrapping rebar with rebar—steel encircling steel inside of the concrete—is enough to reinforce a building strongly enough for it to withstand most earthquakes, an example of good construction. In addition, bricks and cinder blocks must be as well-made as possible—using a high enough temperature for proper firing, allotting the right amount of cement and aggregate to make the blocks and setting aside enough time for the cinder block to properly cure. Ensuring that mortar is placed between each piece of masonry or at least linked together more firmly with a plaster coating imparts additional strength. But all of that costs money. "You have to convince the home owner to invest in that or provide a subsidy," Hausler Strand says.

The idea is not to ensure that buildings emerge undamaged but that building collapses do not become "weapons of mass destruction," as geologist Roger Bilham of the University of Colorado Boulder and computer scientist Vinod Gaur of CSIR Fourth Paradigm Institute in Bangalore put it in a paper on earthquake risk in the Himalayan region in Science in 2013. "The development of improved estimates of seismic risk will be futile if governments permit unauthorized and unsound construction practices to continue," the authors wrote.

"For small homes, governance is a long way off," Holmes adds. "Education on how to properly build is most important."

There are ways to promote better building. One idea is to use the government cash offered for rebuilding in installments as an incentive to build back properly. "If you don't follow building standards, then you don't get the cash," Hausler Strand explains. But that approach requires the government have money to offer. In China after 2008 the government provided plenty of cash to rebuild so the challenge was ensuring rebuilding was done correctly. Oversight from home owners themselves, who had been trained in what to watch for in terms of good or bad construction, seems to have helped. In Indonesia after the 2004 tsunami there just was not enough money available to rebuild properly.

The hope is that the lessons of the Nepal disaster can also inspire prevention elsewhere, such as the retrofit programs Build Change is attempting in Colombia and Guatemala. In Colombia, as people's lives improve, they add floors to their homes. These additions are not built to withstand a disaster like an earthquake, however—new floors often jut beyond the dimensions of the ground floor. Build Change is attempting to add support columns and beams with the help of a government subsidy, following the example provided by Chile.

Turkey is better preparing for its next temblor by retrofitting schools to be earthquake safe, a task the Muslim nation started in 2000 and expects to finish by 2018. Istanbul has completed an earthquake master plan, including enforcing building codes and strengthening existing substandard buildings. But "there is less money available to prevent disasters than there is to respond to them," Hausler Strand admits, noting that Build Change raised more money for Nepal in three days after the quake than it did to retrofit Guatemalan schools over the past three months.

Of course, no building can withstand every disaster. Building for an earthquake can leave a structure more vulnerable to another type of disaster, like flooding or sea level rise paired with storm surges. A lighter roof that might fare better in a quake may fly off in a storm with powerful winds, like a tropical cyclone. "You have to make sure everything is tied down and connected together—roof to wall to foundation," Hausler Strand notes.

Even if the bolstered buildings survive an earthquake, thereby protecting the people inside, many challenges may follow in its aftermath, not least the potential of an aftershock like the one that struck Nepal on May 12 to knock down already damaged buildings. In addition to powerful aftershocks, soil liquefaction, destruction of water and sewer systems, along with road collapse and fires from shaken electricity and gas infrastructure can hinder recovery—whether in the developing world or the richest cities in the world. Nevertheless, as Holmes says, "resilience for the poorest would clearly start by making sure their houses do not collapse."