The short film, shot on location around the city, depicts a dystopian future where tiny killer drones are programmed to carry out mass killings.
Slaughterbots, which was shot on location around the city, predicts how artificial intelligence (AI) could be used to seek out and destroy certain individuals.
Campaigners hope that the film – which depicts an attack on students in Edinburgh – will help bolster the case for a global ban on lethal autonomous weapons systems.
The machines featured in the film, produced by the Campaign To Stop Killer Robots, use facial recognition to identify their targets before administering a lethal explosive blast to the skull.
The seven-minute film shows a classroom full of students being murdered after a swarm of drones were launched from the Braid Hills.
Locations throughout Edinburgh’s Old Town were deployed in the film, which was released by the campaign group at the UN Convention on Conventional Weapons in Geneva.
It was instigated by the Future of Life Institute, an AI watchdog backed by the likes of physicist Stephen Hawking.
The film features a fictional Apple-style presentation of a miniturised drone, which is small enough to fit into the palm of a hand and is said to react 100 times faster than a human being.
Professor Stuart Russell, a leading artificial intelligence expert at the University of California, appears at the end of video and also spoke at the UN conference.
He states: “This short film is more than just speculation, it shows the results of integrating and miniturising technologies that we already have.
“I’ve worked in AI for more than 35 years. Its potential to benefit humanity is enormous, even in defence.
“But allowing machines to choose to kill humans will be devastating to our security and freedom – thousands of my fellow researchers agree. We have an opportunity to prevent the future you just saw, but the window to act is closing fast.”
The Slaughterbots film was made by UK firm Space Digital, based at the media hub in Salford, in Greater Manchester. The company worked with the Film Edinburgh commission to shoot in locations like Castle Terrace, Calton Road, the Cowgate and Victoria Street.
Rosie Ellison, manager of Film Edinburgh, said: “We were contacted by Space Digital about a film they were making about the potential dangers of AI weapons falling in to the wrong hands, in which university students get attacked, and for this element they were looking for iconic parts of the UK and had decided on Edinburgh.
“They wanted to show deserted streets patrolled by armed police. The ‘bots’ would be added in post-production.
“Our involvement was to look at how and where this might be achieved and advise the producers about the procedures to put this into action. Most importantly, we connected them with an experienced Edinburgh-based location manager to take the lead on ensuring detailed communication, within an appropriate timeframe, with the council and police, as well as with businesses and residents who might look out of their window and see an armoured police unit outside. Everything went off without a hitch and the results are very chilling.”