The origin of the festival is traced to the epic 16th century novel Journey to the West (Xiyou Ji, 西遊記) written by the Chinese novelist Wu Cheng'en (1500–1582) during the Ming dynasty (1368–1644).
Harassed by demons and bandits, he visits ancient India, accompanied by his disciples, and protectors, Sun Wukong the Monkey King, Pigsy (猪八戒) and Sandy (沙悟浄).
When the Monkey King appeared in a Buddhist novel, he attained a higher recognition in the cultural ethos of ancient China; temples were built in his honor and his biography was established.
The medium is possessed by the spirit of the Monkey King and then runs barefoot across a bed of hot coals before climbing a ladder made of knives.
The possessed person is then awakened and given a sword, which he swings around wildly, jumping over tables and benches, displaying a kind of martial art.