The story in The Romance of the Western Chamber by Wang Shifu of the Yuan Dynasty (1271-1368) directly came from the prose romance The Story of Yingying by Yuan Shen of the Tang Dynasty (618-907). The Story of Yingying is a tragedy about the love, union and separation between Zhang Sheng and Cui Yingying in the first year of the Zhenyuan reign in the Tang Dynasty (618-907). Several episodes in the story have certain influence on The Romance of the Western Chamber in terms of subject matter, dramatis personae and plots as well.
The Romance of the Western Chamber tells that a young scholar Zhang Sheng went to the capital city to take the highest imperial examination. When he stayed in a temple, he met Cui Yingying, daughter of the then Prime Minister and fell in love with her. At that time, a group of robbers besieged them. Yingying's mother declared that she would marry her daughter to whomever could save them. Zhang Sheng managed to do that with his friend's help. But her mother refused to keep her words because he was poor. However, Yingying and Zhang Sheng loved each other very much. With the help of Hong Niang, Yingying's maid, they broke the traditional barrier.
Since the appearance of this play in the thirteenth century, it has enjoyed unparalleled popularity. The play has given rise to innumerable sequels, parodies, and rewritings; it has influenced countless later plays, short stories, and novels and has played a crucial role in the development of drama criticism.
The theme of the drama is an attack on feudal mores, supporting the longing of young people in those days for freedom of marriage, although it follows the timeworn pattern of a gifted scholar and a beautiful lady falling in love at first sight. According to the orthodox viewpoint of feudal society, love was not supposed to be a basis for marriage, as most marriages were arranged by the parents of the couples, but the happy ending of The Romance of the Western Chamber embodies the aspirations of people for more meaningful and happier lives.
Thus, the biggest difference between The Story of Yingying and The Romance of the Western Chamber lies in their endings -- the former has a sad ending while the latter has a happy ending. What's more, The Romance of the Western Chamber carries a more profound meaning in its clou, and directly suggests to may all lovers in the world be settled down in a family union, with a more sharp-cut theme of attacking feudal mores and feudal marriage system.