Fleets of drones may one day soar the skies while delivering sneakers, pasta sauce, and basketballs that people order online. But before that happens, specialized air-traffic control systems must be developed to pilot the flying robots and keep them from colliding into each other.
To help create these drone air-traffic control systems, NASA and a group of partners including universities, drone manufacturers, and technology giants like Amazon and Google, are working together to develop the technology that would make such a system possible. Amazon (AMZN) and Google (GOOG) stand to benefit because both companies are working on drone deliveries.
As part of the project, a team of Stanford University researchers said on Thursday that they are building software that can alert multiple drones before they crash in mid-air and reroute them.
At the heart of the system is a so-called conflict-avoidance algorithm that will prevent collisions after being integrated into an air-traffic control system, according to a Stanford announcement about the research.
The collision avoidance technology is a variant of similar technology created to help airplanes steer clear of mid-air accidents. That technology was created by Stanford assistant professor of aeronautics and astronautics Mykel Kochenderfer during his stint at MIT.
Kochenderfer is now modifying the technology for piloted aircraft to coordinate multiple drones. The researchers said that creating a similar system for drones presents a unique challenge because many drones could be flying in close proximity to one another in crowded cities while, for example, delivering items to a house simultaneously.
“As the number of aircraft grows, the avoidance problem becomes exponentially more complicated, a challenge that mathematicians call the curse of dimensionality,” Stanford researcher Hao Yi Ong said in a statement. “So we have to come up with better ways than just brute-force searching and iterating through all possible solutions.”
The researchers claim that they have performed over 1 million drone collision simulations using the software, but they acknowledge that it’s not quite ready for primetime. The software has to take in account bad weather, problems with the drones communicating with one another, and “deliberately disruptive drones.” The Stanford team expects the finalized software to be used in the overarching air-traffic control system that NASA hopes to complete by 2019.
Over the summer, researchers at the University of Nevada, Reno created software that lets drones communicate with servers on the ground and tested the technology with a drone startup called Flirtey. Flirtey was the company behind the first federally sanctioned drone delivery in July.
Subscribe to Data Sheet, Fortune’s daily newsletter on the business of technology.
For more about drones, check out the following Fortune video: