Age of Ancients
In the beginning, the world was unformed, shrouded by fog; homogeneous. Gray crags, archtrees, and everlasting dragons were the extent of that which existed there. This period was known as the Age of Ancients.
But then, the Advent of Fire occurred. This created Disparity in the world: with it came heat and cold, life and death, and light and dark. From the dark, came humanoid creatures - Hollows. These creatures found souls near the First Flame, and took on the powers they gave. With the strength of these souls, four figures were born: Gravelord Nito, the Witch of Izalith, Gwyn, the Lord of Sunlight, and the Furtive Pygmy. With the powers gained, the Lords overthrew the dragons, ushering in the Age of Fire.
Age of Fire
With the dragons defeated, the Lords took over the world. It was a prosperous era, and from it many nations were born. The land which the lords hailed from, Lordran, became the center of many adventures for those of other nations to engage in. The First Flame became linked to the bonfires throughout Lordran, and gave power to them. In time however, the Flame began to fade.
Desperate to ensure that their Age of Fire continued, and afraid of the coming Dark, Gwyn did everything to keep the flame lit. They linked the bonfires to humanity, and shepherded the humans to kindle the flames. In contrast, the Witch of Izalith attempted to use her soul to create a new flame, but this did not work, instead birthing the Bed of Chaos and, by extension, the creation of Chaos and Demons.
Aware that time was quickly running out for his kingdom, Gwyn and a detachment of his knights entered the Kiln of the First Flame. Gwyn had them stand guard while he entered the room which contained the First Flame. Gwyn then sacrificed himself to the Flame, turning the Kiln to ash, and incinerating all of his knights, creating the Black Knights and dooming them to wander the lands as disembodied spirits forever after.
The start of Dark Souls takes place some time after all of this has occurred, and the Flame is quickly fading. Soon, only Dark will remain.
In Dark Souls III, many Lords of Cinder had come and passed and the Age of Fire had persevered. However, when the new chosen Lord, Prince Lothric, refused to link the fire, a desperate attempt to save the fading Flame began. Four Lords of Cinder were resurrected to link the fire once more, however - aside from Ludleth of Courland - they too chose to abandon their duties, forcing the Ashen One to drag them back.