There is actually a Stargate episode about this where two civilisations lived in bunkers and fought each other with drones without really knowing why anymore.
There is the old Star Trek episode where two civilisations decided to forgo a real war for a simulated war where the computers would simulate attacks and then parlay the losses to each as a list of people who died in the attack who would then promptly commit suicide.
Actually what I recall was one side had real pilots, but the side SG1 came in on were flying drones. They were offered a chance to fly themselves then O'Neil was disturbed to see there was a person in the other aircraft.
That reminds me of the Screamers movie about a war between the mining company (N.E.B.) and "The Alliance" (former mining and science personnel) on the planet Sirius 6B.
"Five years into the war, Alliance scientists created and deployed Autonomous Mobile Swords (AMS) — artificially intelligent self-replicating machines that hunt down and kill N.E.B. soldiers on their own. They are nicknamed "screamers" because of a high-pitched noise they emit as they attack. Screamers track targets by their heartbeats, so Alliance soldiers wear "tabs" which broadcast a signal canceling out the wearer's heartbeat and rendering them "invisible" to the machines.
A fragile stalemate is in effect between the two exhausted, poorly supplied, and undermanned armies. The Alliance recovers a message from a dead N.E.B. soldier, killed by screamers as he approached the Alliance compound, guaranteeing safe passage through N.E.B. territory to discuss a truce.
When Alliance commanding officer Joe Hendricksson reports this development to his Earth-based superiors, he is told that peace negotiations are already underway on Earth; but Private "Ace" Jefferson, newly arrived from Earth, says that is untrue. Hendricksson is not surprised; he has long suspected that both sides have simply written off Sirius 6B and abandoned their armies."
-- wikipedia
The script is loosely based on a story by Philip K. Dick:
"Set in a world where war between the Soviet Union and United Nations has reduced most of the world to a barren wasteland, the story concerns the discovery, by the few remaining soldiers left, that self-replicating robots originally built to assassinate Soviet agents have gained sentience and are now plotting against both sides."
-- wikipedia