Each city or village in China had its own Cheng-huang god to protect it, and a small temple to that god. Many of these local gods were based on real men from that town who had been well known while they were alive. After a great man died, if he became a god, he would send dreams to people who were still alive to let them know. Cheng-huang protected the moats and walls of towns when enemies were attacking them.
Cheng-Huang also made sure the King of the Dead didn’t take any souls away without Cheng-huang’s permission. And if anyone was doing anything bad in the town, Cheng-huang would send you dreams about who it was so you could stop them.
Bibliography and further reading about Chinese religion:
The Gods and Goddesses of Ancient China, by Leonard Everett Fisher (2003). . One page for each god, with lots of pictures and some historical context.
Five Heavenly Emperors: Chinese Myths of Creation, by Song Nan Zhang (1994). Stories .
Chinese Mythology A to Z, by Jeremy Roberts (2004).
Dragons and Demons : Myths of China, by Stewart Ross (1998). A few Chinese stories, retold .
Dragons, Gods and Spirits from Chinese Mythology, by Tao Sanders (1983). More of a child’s encyclopedia.