By Dave Lee
BBC World Service
Crowds at music festivals enjoy being close - but it's not the same in airports
Predicting how large crowds will react in certain situations has long been the holy-grail for architects and planners.
Many factors, such as a person's emotions or intelligence, can determine how they act when confronted with a busy scene or an emergency.
Crowd simulation software has always tried to recreate realistic behaviour, but the unpredictable nature of people is yet to be faithfully replicated.
But new software designed by the University of Milano-Bicocca hopes to change the way in which we simulate crowd control.
Project co-ordinator Sara Manzoni explained to BBC World Service's Digital Planet why their approach is unique.
"The traditional approach concerned trying to design equations that describe flows of people.
"What we do is to try to observe the individual behaviour of people who are part of the crowd."
The team has developed a complex artificial intelligence system which treats each simulated person - or 'agent' - as an individual.
It is broadcast on Tuesday at 1232GMT and repeated at 1632GMT, 2032GMT and on Wednesday at 0032GMT
Crucial to this is the social research into how people interact with others when confronted with different problems in a range of places.
For example, groups of people in airports tend to stay as far away from each other as possible and crowds are seen as uncomfortable or upsetting.
But other large groups, such as those at concerts or sporting events, have no issue with being in close proximity those around them - with many even seeking out crowds to enhance the experience of the event.
Architects of new buildings will be able to use the software to predict how crowds will cope in the instance of a bomb threat or other emergency, as the software allows a series of 'what if' scenarios to be acted out.
Ms Manzoni and her colleagues hope the technology will lead to safer, better designed buildings in the future.