The film is set in early 11th century China during the reign of Emperor Renzong of the Song dynasty. The emperor neglects state affairs and indulges in personal pleasures, while the government sinks into corruption and war continues to rage on at the borders of the Song dynasty. The Song dynasty is being invaded by the armies of the rival state of Western Xia.