Utilization of computational approach in the study of social behaviour of animals is increasing and we attempted such an approach in our study of tree-dwelling bats. These bats live in highly dynamic fission–fusion societies that share multiple roosts in a common home range. The key behavioural component associated with complex and non-centralized decision-making processes in roost switching is swarming around potential locations in order to recruit members to the new roost. To understand roost switching dynamics of bat groups in their natural environment, we employed a computational model, the SkyBat, which is based on swarm algorithm, to model this process. In a simulated environment of this agent-based model, we replicated natural fission–fusion dynamics of the Leisler’s bat, Nyctalus leisleri, groups according to predefined species and habitat parameters. Spatiotemporal patterns of swarming activity of agents were similar to bats. The number of simulated groups formed prior to sunrise, the mean number of individuals in groups and the roost height did not differ significantly from data on a local population of bats collected in the field. Thus, the swarm algorithm gave a basic framework of roost-switching, suggesting possible applications in the study of bat behaviour in rapidly changing environments as well as in the field of computer science.