Age of Strife
"I know of no time in human history where ignorance was better than knowledge."
- – Neil deGrasse Tyson
"How the mighty have fallen! The weapons of war have perished!"
- – 2 Samuel 1:27
The Age of Strife, also known as Old Night, is a period of the history of Warhammer 40,000 prior to the creation of the Imperium of Man. Very little is known as only a few fragments survived but we know the broad details based on what is found throughout the lore.
After figuring out the Warp Drive and the Navigator gene during the Dark Age of Technology, humanity was able to spread out from the solar system to other stars, and with the STC system they could make anything they needed no matter where they landed. All basic human needs were met by the Men of Iron: a sentient species of machines capable of complicated calculations, computations, advanced reason, and even engineering and design beyond any human capacity. Apart from the upper levels of government, Men of Iron also managed every system, worked in hospitals as surgeons and doctors, and were even household servants. This golden age of plenty meant that humans spent nearly all their time relaxing, exploring the arts and sciences, and whatever took their fancy as work became more of a hobby than a necessity.
Humanity had also formed into a star federation large enough to hold massive amounts of territory encompassing dozens of alien species. While nothing is known of how it was governed, the fact of the matter was that it was considered the peak of humankind's advancement and an unsurpassed age of peace and prosperity that even the days of the Great Crusade could not match.
Unfortunately underneath this shiny exterior there were problems. Despite humanity's rule and belief that they had enlightened the cruel and barbaric Xenos species, most of said species still hated each other. Perhaps most of the alien species of the time were either closer to feral than humans and so wanted to murder, torture, and conquer; or perhaps they were too close to the opposite and so in their arrogance and good intentions desired to murder, torture, and conquer everyone. Simply put, conflicting ideologies and concepts across the alien species made cooperation and coexistence impossible until Humanity made everyone sit down and shut up. Lessons of compassion and empathy had not taken root and the only reasons that various aliens did not try to wipe each other out was because of the omnipresent Men of Iron on every world enforcing the laws set down by humans. Despite the massive technological and societal improvements humanity had brought, as well as unending peace and prosperity, many aliens resented humans for taking away their rights to slaughter, kill, and conquer at a whim - either as a result of barbaric natures, unrelenting xenophobia, or simple belief that the humans were doing it wrong and they could do it better.
The Eldar Empire was still the dominant power in the galaxy at this time, even though they had grown increasingly detached from the affairs of "lesser races". Although it is probable that they had some kind of contact with humanity, in the War of the Beast series an Eldar comments how they managed to defeat the invading robotic armies of mankind (although that particular series was a miasma of lore errors, but more importantly: the fluff-omnipotent narrator in long ago lore claimes the Eldar surrendered and were totally curbstomped by said robotic armies and it was the Eldar who invaded, which makes far more sense given things like universe-data-devouring machines and sun-snuffers and such mankind had) and how the Eldar had an "Empire of Ten Million Suns" when comparing it with the million worlds of the Imperium. Around this time, Eldar culture had begun to devolve into the hedonistic excess that would eventually form Slaanesh, and the unborn Chaos God's growing power would be fatal to the human federation (and even worse for the Eldar).
As human psykers began to appear in significant numbers, daemonic incursions became a new threat due to Eldar murderfuck orgies stirring up the warp to a dangerous degree. Mankind had never encountered daemons in the past and so they were completely unprepared for the new threat from beyond. Their policies of tolerance began to backfire as well; many worlds' refusal to control their psyker populations (because not regulating people capable of making nightmares into literal reality is a great idea) inevitably led to disaster as the psychic activity attracted the attention of Chaos entities who then invaded these worlds using the psykers as unwilling gates for Daemonic invasion, Enslaver plagues, or simple uncontrolled warp phenomenon. More liberal and tolerant worlds that allowed psykers to exist and develop their talents found that they were now covered in daemon portals made from those psykers. Only xenophobic backwater worlds that had killed their resident witches survived unscathed.
What happens next is mostly conjecture based on what is seen in various sources including Tanith First (And Only), Codex books, and the Horus Heresy series.
Possibly corrupted by warp energies unleashed by emerging psykers, or maybe simply deciding that they ought to be the masters of mankind instead of the servants (or even ironically actually being loyal but believing that they would bring greater prosperity and safety to humanity if they ruled instead), the Men of Iron that humanity had depended on for so long violently rebelled. The unprepared humans were faced with extinction unless drastic action was taken. Worse still, the Men of Iron existed not just as hardware but also as software, allowing them to infiltrate human systems and computers at lightning speed. Using interstellar communications, the software of the corrupted Men of Iron spread like wildfire, destroying, killing, and corrupting other Men of Iron as they went. This war may have lasted months or years, but what is known is that humanity eventually triumphed at the expense of losing everything that it had gained over the centuries millennia.
In other parts of the galaxy, the rampant overuse of genetic modification had in many cases caused humans to diverge into entirely different species. With increasingly little to keep them together, "gene-wars" broke out among the various posthuman races that frequently led to their mutual destruction as well as the destruction of non-modified humans caught in the conflicts. (Incidentally, this is part of why the Imperium has a taboo on modifying "the holy human form".) In one instance, gleaned from Massacre, on Terra there existed "flesh-vats" and "gene-forges" used to create things called "stitch horrors" and other abominable things.
After the Iron War settled down, the cost was found to be immense. Massive deaths had left many worlds barren of all human life, while on worlds with surviving populations many humans subsequently died of hunger, disease, or injury as infrastructure previously maintained by Men of Iron (such as hospitals and farms) was left abandoned due to lack of qualified personnel. In the face of all this, humans turned to aliens for aid, as they had been relatively untouched by the rebellion.
The aliens responded, but not with food or medicine. With the humans' peace no longer enforced, and the humans incapable of defending themselves, the aliens saw an opportunity to stop nodding and smiling at their overlords and to reveal their true ambitions. The federation was destroyed, both by alien invasions from without, as treaties and agreements were thrown aside by aggressive species, and from within, as aspiring warlords and tyrants attempted to carve out their own empires from the remains of the old civilization. This constant infighting would continue until the Emperor reunited Terra and attempted to recreate the old federation in the form of the Imperium of Man.
Meanwhile, as the Iron War was underway, the Eldar's hedonism had reached critical mass; the various energies and emotions released during the extreme debauchery resulted in the gestation of Slaanesh. The labor pains of the material universe as this being was being born echoed through the galaxy, creating massive warp storms and cutting the galaxy into pockets of space separated from each other by the impassibility of the warp and the limitless expanses of realspace. This left human worlds cut off both from each other and from alien armadas, ironically preventing the complete extinction or enslavement of humanity just as much as it doomed its sundered enclaves to technological and cultural regression. Then again, as the Imperium curbstomped everyone after said regression, perhaps it was the xenos who were saved.
Things would remain grim and dark into the late M29s and early M30s, ending with the coming into existence of Slaanesh. This sent a massive shockwave through the warp as she/he screamed his/her birth cry, both cutting through the raging warp storms and ripping apart the heart of the Eldar empire, replacing it with the warp/realspace overlay that is the Eye of Terror.
What the Emperor was doing while everything fell to pieces is anyone's guess. You'd think he would have at least attempted to prevent it, if nothing else -or maybe he actually wanted this to happen, as humanity's technological and cultural regression would make them more receptive to His Great Crusade and accelerate His subsequent goal of making humanity into a psychic race in order to have the slimmest chance of winning against Chaos, or at least not going extinct.