There was a city wall of rammed earth around the Shang capital at An-yang, and around other cities like Zhengzhou, a little south of An-yang. These were built by piling up dirt and pounding it (probably with stones or wooden mallets) until it was as hard as rock. You could compare these walls to the mud-brick walls that men built around cities in West Asia and Egypt about the same time. Probably the walls had watch-towers on them every so often. They were only about twelve feet thick at the base, though – much smaller than later walls.
Other people in China were building rammed earth altars, in circular patterns like this one to worship Heaven, and square ones to worship Earth.
In the countryside of northern China, a lot of Shang dynasty people seem to have lived in caves, or in man-made caves dug out of the dirt: sunken houses with roofs made of domes of sod, like the sod houses of American pioneers. People built fire-pits in the center of their round houses, and they were probably nice and warm even in winter because the earth made good insulation against the cold. They smoothed and plastered both the walls and the floor, to keep them clean.
But in the summertime, people sometimes moved out of their dark sod houses and lived instead in a tree-house built on a wooden platform (like on a play structure), with the roof made of poles and branches. Living high up in the air kept them safe from animals and snakes.