Introduction

In many bat species individuals dwell together in caves (or similar roosts), forming large colonies with tens to tens of thousands of individuals1. Each evening, at approximately the same time, the bats take off from their roost, navigating through its passages toward the exit. The high density of bats flying simultaneously in great proximity poses many challenges for orientation in such a crowded and noisy environment. Flying while avoiding collisions, often in a pitch-black cave, demands the constant detection and localization of both obstacles and nearby bats2,3. Employing echolocation, bats emit strong ultrasonic signals and interpret the reflected echoes to perceive their surroundings4. The reception of neighbors’ loud calls, which may share similar acoustic features with their own calls, can potentially hinder the bats’ ability to detect the faint echoes reflected off the walls and the surrounding bats4,5. We examined whether bats could rely solely on echolocation to exit the roost even during such a chaotic ‘rush hour’.

The question of how bats cope with acoustic interference has been extensively researched using playback experiments, field observations, on-body tags, and computational simulations615. However, much of this research has focused on foraging bats in small groups4,5,8,1518. The challenges bats encounter during roost exits (e.g., cave exits), however, differ markedly from those encountered during group foraging. First, during roost exits the bat density is significantly higher, and they need to detect and follow static walls or obstacles, which produce loud echoes, rather than small, sporadic prey items that generate faint echoes19. Finally, their flight maneuvers involve flying directionally and avoiding collisions with conspecifics, unlike the hunting maneuvers typically observed while foraging. Echolocation studies during dense collective movement are scarce3,5,2023, likely due to the complexities in recording separate echolocation calls and tracking individual flights within the swarm. While collective movement has been extensively studied in various species, including insect swarming, fish schooling, and bird murmuration2431, as well as in swarm robotics agents performing tasks such as coordinated navigation and maze-solving3234, most studies have focused on movement algorithms while overlooking the sensory challenges involved3542.

The present study addresses these gaps by introducing an agent-based sensorimotor model based on the well-documented echolocation capabilities of bats, simulating multiple bats pathfinding their way out of a cave-like structure. We modeled the echolocation behavior of two insectivorous bat species: Pipistrellus kuhli (PK), which roosts in abandoned buildings and frequently navigates through conspecific-dense, cluttered corridors and the cave dwelling Rhinopoma microphyllum (RM) which emerges from its roosts with thousands of individuals simultaneously. These two species differ in their echolocation signals. In brief, PK echolocation signals are characterized by a wider band width than RM calls. We quantified the performance of an individual bat flying among conspecifics, demonstrating that even a relatively simple sensorimotor algorithm can facilitate successful orientation in such complex environments. The modeling approach enabled us to explore how various biological and ecological factors influence successful navigation under such challenging conditions.

Results

In our 2D simulations6, each bat emits sound signals and receives the echoes reflected from roost walls and other bats which are often masked by the calls emitted by conspecifics. The bat then estimates the distance and direction of each reflector, adjusts its echolocation accordingly, and maneuvers in search of an exit while also avoiding collisions. The bats dynamic echolocation responses were modeled following the vast literature (see6 and Methods). Their reception was modeled using a biologically inspired filter-bank receiver comprising 80 gammatone channels6,43,44. Each bat adjusted its flight following a simple pathfinding algorithm based solely on the estimated locations of the detected reflectors (see Methods, Supplementary Figure 1, and Supplementary Movie 1 for additional details). The bats had to exit a roost designed as a corridor (14.5 m long x 2.5 m wide), with a right-angle turn located 5.5 m before the exit (Figure 1A). Additionally, an obstacle (1.25 m wide) was situated 2.25 m in front of the opening. The simulated bats initiated their flight from the far end of the corridor taking off in the general direction of the exit (±30 degrees), without prior knowledge of the roost’s structure. The basic sensory model took all interference signals into account, while assuming that the bat can distinguish between echoes from the walls and echoes from conspecifics. In brief, the bat responded to echoes as follows (see detailed description in the Methods): If a static reflector or a conspecific was detected in front of the bat and was too close (less than 0.4 m), the bat would maneuver to avoid a collision. Otherwise, to find the exit, the bat would follow the direction of the walls by flying toward the farthest static reflector ahead. Finally, if a gap greater than 0.5 m was detected between adjacent reflecting points, the bat directed its flight toward the center of the gap.

The sensorimotor model.

(A) Top view of the cave with three bats. Data are presented for the focal bat (black bat, and wide yellow trajectory). The flight trajectories are shown in thick lines, while the bat’s moment-to-moment decisions are indicated by the inner colored lines (see panel D). Green squares depict reflectors detected by the focal bat along its route. (B) A zoomed-in view of the dashed rectangular area in Panel A, where the focal bat (black) emitted one echolocation call (black filled) and received echoes from the cave walls (green hollow) and from two other bats (blue hollow). It also received conspecifics’ calls (red filled) and their reflection from the cave walls (orange hollow), as well as the reflections from other bats (red hollow). Green squares indicate points that were detected by the focal bat from this call and red x’s indicate missed points due to acoustic masking. The locations of the detected reflectors (green squares) are marked according to their localization by the bat (with simulated errors). The lines near the bats depict their flight direction. (C) The acoustic scene received by the focal bat is as depicted in B, including the emitted call and all received signals (colors as in panel B). (C1) The time-domain plot displays the envelope of signals, encompassing the emitted call and the received signals: the desired echoes from the walls and conspecifics; the calls of other bats; the echoes returning from conspecific calls and reflected off the walls and off other bats. Notably, in this example, some of the desired wall-echoes are jammed by the stronger echoes reflected off conspecifics. (C2) The spectrogram of all the received signals presented in C1; for clarity, the emitted call is not depicted. (C3) The responses of the active channels of the cochlear filter bank after de-chirping. Each channel is represented by its central frequency on the y-axis. Each black dot represents the timing of a reaction that was above the detection threshold in each channel. Note that early reactions in low-frequency channels (marked by yellow arrows) result from the stimulation of those channels caused by the higher frequencies of the downward FM chirp. However, most of these stimulations do not reach the detection threshold and are therefore not detected (see Methods). (C4) The detections of each channel are convoluted with a Gaussian kernel, summed, and compared with the detection threshold (dotted red line). The colored asterisks illustrate detections of the received signals (colors of the sources are as defined above). Panel D depicts the navigation algorithm used by the bat. The algorithm involves a correlated-random flight during the search phase (blue), collision avoidance (yellow), flying along the wall at a constant distance (green), and flying toward the center of a gap between obstacles as an indicator of a possible exit (cyan). After each echolocation call, the bat awaits an IPI (Inter Pulse Interval) period before emitting the next call. Based on the received signals, it then modifies its next call design and adjusts its direction and speed accordingly.

The ability of the bats to exit the roost within 15 sec was evaluated for different group sizes, from a single bat and up to 100 individuals. For simplicity, we will refer to the initial density at the cave’s far end as the number of bats per 3m2 (i.e., for groups of 100 bats, the density is 100 bats/3m2, or 33.3 bats/m2). The bat densities we tested were chosen to reflect the typical range of bat densities observed in natural caves during emergence events22,45,46. Key model parameters, such as the sensory integration window, object target strength, echolocation parameters, and flight velocity (see Table 1), were manipulated and their impact on the exit performance was analyzed. To explicitly quantify the effect of sensory masking vs. the effect of collision avoidance only, we turned the acoustic interference on and off to measure its impact.

Key model parameters and their effects on performance metrics.

The table presents the key parameters tested, their ranges, default values, and effect sizes on various performance metrics: exit probability, jamming probability, and collision rate. The parameters comprised the number of bats, bat species (PK-Pipistrellus kuhli, RM –Rhinopoma microphyllum), integration window, nominal flight speed, call level, echo mis-identification with temporal aggregation (yes/no), masking (yes/no), and wall target strength. In each scenario, all parameters except the tested one were set to the default value. The effect sizes for each parameter on exit probability, jamming probability, and collision rate are provided (per bat). Square brackets present the minimum and maximum values of the metric across the tested range. Asterisk (*) indicates a significant impact. Each scenario was tested using Generalized Linear Models (GLMs) with number-of-bats and the tested parameters set as fixed explaining variables. Exit probability and jamming probability were treated as binomially distributed, collision rate was treated as a Poisson distributed, and all other variables were considered normally distributed. Explaining variables were set as fixed factors. The number of repetitions for each scenario was as follows: 1 bat: 240; 2 bats: 120, 5 bats: 48; 10 bats: 24; 20 bats: 12; 40 bats: 12; 100 bats: 6. ѱ A significant difference in call intensity was found only for a bat density of 100 bats/3m2, and between the group with a level of 100dB-SPL and all other groups.

Bats find their way out of the cave even at high conspecific densities

We first examine how bat density affects bats’ ability to exit the cave, alone and in a group. Higher bat densities significantly reduced the probability of exiting the cave in 15 seconds (Figure 2 A, see Supplementary Movie 1 for a view of the bats’ movement, p<10−10, tStat=−23, DF=4077, GLM, see details in Table 1). In trials in which a single bat was flying alone, it successfully exited the cave in 100% of the cases. Even without sensory interference, the probability of exiting decreased significantly from 100% to 86%±1.4% and 91%±1.7% at densities of 100 PKs/3m2 and 100 RMs/3m2, respectively (mean ± s.e.). When acoustic interference was added, the exit probability further decreased to 63%±1.4% and 67%±1.4% for 100 PKs and RMs, respectively (see Figure 2A).

Exit performance of P. Kuhli (PK) and R. Microphyllus (RM).

(A) Sensory interference significantly impaired the probability of exiting the cave (compare dashed black line with continuous black line). The probability of a successful exit also declined as the number of bats increased, with no significant difference observed between the species when masking interference was applied. The insert shows the spectrograms of the echolocation calls of PK (top) and RM (bottom). (B) The time-to-exit, which was calculated for successful trials only, and (C) the collision rate with the walls both increased as a function of the number of bats. (D) The probability of jamming significantly increased to about 55% and 63% with 100 bats for PK and RM, respectively. (E) The detection probability of a wall reflector at one meter or less in front of a bat decreased as a function of the number of bats. In panels (A-E), circles represent means and bars represent standard errors (see details in Table 1). Asterisks indicate significant differences between the lines in each panel.

The difference in exit probability between the two species was not significant (p=0.08, tStat=1.74, DF=4077, GLM as above, Figure 2A). Similarly, the difference in echolocation parameters between the two species did not affect the collision rate with the walls (with a maximum of 0.29 and 0.3 collisions per bat per second for PK and RM, respectively, with 100 bats (p=0.63, tStat=−0.48, DF=4077, GLM, Figure 2C, see details in Table 1). To quantify sensory interference, we defined a jammed echo as an echo entirely missed due to masking. The jamming probability, which was calculated as the number of jammed echoes divided by the total number of reflected echoes, was significantly higher for RM compared to PK with a maximum difference of 14.3% for 10 bats, and 9.8% for 100 bats (p<10−10, tStat=6.56, DF=4077, GLM, Figure 2D, see details in Table 1). Accordingly, PK demonstrated a minor but significant advantage in detecting the cave walls (p=0.024, tStat=−2.25, DF=4077, GLM, Figure 2E, see details in Table 1). With 100 bats flying together, the probability of detecting a wall echo at a distance of 1 m in a single call was around 50% and 46% for PK and RM, respectively. Despite this minor disadvantage in detection, RM bats exhibited a better time-to-exit average than PK bats, being 0.5 seconds faster to exit (p=0.0005, tStat=−4.06, DF=3533, for n=40 bats, Figure 2B). It should be noted that the time-to-exit was calculated only for successfully exiting bats. RM bats also suffered from a significantly higher probability of the desired conspecific’s echoes being jammed (p=0.00016, tStat=3.8, DF=3593, GLM, see details in Table 1).

A longer integration window improves exit performance

We next examined whether bats improve their performance when integrating information from several consecutive calls. The integration window determines the number of previous calls the bat uses at each step to guide its next movement decision (see Methods). The basic model used five calls. The probability of exiting the roost significantly increased when increasing the size of the integration window for all bat densities (p<10−10, tStat=28.5, DF=10197, GLM, Figure 3A, see details in Table 1). For example, at a density of 40 bats/3m2, the exit probability improved from 20%, to 75%, and to 87% as the window size increased from one, to three, and to 10 previous calls, respectively. In addition, increasing the window size resulted in a significant improvement in the time-to-exit and the avoidance of wall collisions (p<10−10, tStat=−12.8, DF=7661; p<10−10, tStat=−46.5, DF=10197, respectively, GLM, see details in Table 1). With 100 bats, the collision rate decreased by a factor of 2 from 0.53 to 0.25 collisions per second as the window increased from 1 to 10 calls. The size of the integration window had no significant effect on the jamming probability (p=0.37, tStat=0.9, DF=10197, GLM, see details in Table 1).

Exit performance as a function of key sensorimotor parameters.

(A) The effect of the integration window on the probability of exiting the roost, the time-to exit, the rate of collisions with the walls, and the probability of jamming (from left to right, respectively). Each colored line shows the trend as a function of the window-size for different bat densities, with each color representing a specific density. (B) The effect of the nominal flight speed of the bats, with panels and line-colors as in panel A. An optimal speed of approximately 6 to 8 m/sec can be observed for all densities above one bat. (C) The effect of call intensity on exit performance, panels as in (A). In all panels, circles represent means and bars represent standard errors. See Table 1 for the number of simulated bats.

Exit probability was maximal at an intermediate flight-speed

We observed a significant and non-linear effect of the flight speed of the bats on the performance, as shown in Figure 3B (p<10−10, tStat=−29.9, DF=10196, GLM, see details in Table 1). The exit probability increased with flight speed until it reached a maximum at 6-8 m/s and then declined rapidly. This was the case for all bat densities, with the maximal exit probability ranging between 65% to 99%. At the optimal velocity, the time-to-exit was also minimal. However, the collision rate increased monotonically with speed, with a steep incline above the optimal speed.

Call intensity had only a minor effect on exit performance and only at high bat densities

For low bat densities (<40 bats), call intensity did not have a significant impact on either exit probability or collision rate (Figure 3C, p=0.89, tStat=0.13, DF=5757; p=82, tStat-0.21, DF=5757, respectively, GLM, see details in Table 1). Call intensity affected exit performance only when the intensity dropped to 100 dB-SPL and only at a high bat density of 100 bats/3m2 (Figure 3 C). In this scenario, the exit probability declined from approximately 60% to 49.5% (p=0.003, F = 8.45, DF = 2396, One-way ANOVA with ‘hsd’ post hoc test), and the collision rate increased from 0.3 to 0.35 collisions per second (p<3·10−6, F = 22.18, DF = 2396). Notably, this low intensity is below the typical search-call intensity of most echolocating bats. At the same bat density (100 bats/3m2), further increasing the call intensity to above 100dB-SPL had no significant effect on either exit probability (p=0.6) or collision rate (p=0.07). Calling louder also slightly, but significantly, decreased the jamming probability at all bat densities, with a decrease of 3.5%±8% to 5.5%±5% (mean ± s.e.) (p=0.02, tStat=−2.26, DF=8157, GLM, see Table 1).

While confusion between the desired echoes and those from conspecific calls may significantly impair exit performance, temporal aggregation helps to mitigate this

We next addressed the challenge of echo classification, assuming that a bat can differentiate an echo resulting from its own calls from echoes resulting from the calls of other bats. To examine this assumption, we tested another model in which bats responded similarly both to wall echoes returning from their own emissions and to those from conspecific emissions, treating all as their own echoes. This confusion significantly decreased exit performance for all bat densities (above one bat). The probability of a successful exit for a density of 40 bats/3m2 dropped from 83.3±2.4% to 14.6±2.3% (p<<10−10, tStat=−20.7, DF=2877, GLM, see details in Table 1), the exit time increased from 7.6±0.18 to 9.3±0.2 seconds (p<<10−10, tStat=15.5, DF=2157, GLM), and the collision rate increased significantly from 0.2±0.007 to 0.8±0.013 collisions per second (p<<10−10, tStat=−30, DF=28777, GLM, see Figure 4, red and yellow lines).

The impact of confusion on performance.

The figure illustrates the impact of classification confusion on roost-exit performance under various conditions. Blue lines depict trials with masking, while assuming that bats can distinguish between echoes from their own calls and those of conspecifics (referred to as “No Confusion”). Red lines depict performance where confusion between echoes is assumed. Yellow lines depict performance under the confusion condition, with the added capability of temporal aggregation process in a short-term working memory (referred to as “confusion with mitigation”, see text for further details). In all panels, circles represent means and bars indicate standard errors. (A) The probability of exiting the roost significantly decreased with masking and confusion. In conditions with confusion and no aggregation process, only 15% of bats successfully exited the roost, at a density of 40 bats/3m2. Temporal aggregation partially mitigated the confusion effect but did not eliminate it. (B) Bats with the ability to distinguish between echoes demonstrated significantly shorter exit times than those experiencing confusion. Note that time-to-exit refers only to successful attempts. (C) The collision rate with walls was highest for bats experiencing both masking and confusion but decreased significantly when without confusion. Temporal aggregation process restores performance to the “No Confusion” condition, reducing collision rates accordingly, at densities between 1 to 40 bats/3m2.

To further examine whether this decrease in performance could be mitigated by integrating detections from successive calls, we tested a slightly improved aggregation model that clustered detected reflectors over one second periods (see Methods). This temporal aggregation process significantly improved performance, but exit probability and time-to-exit still remained significantly lower than without echo-confusion: exit probability = 58±3% in comparison to 83.3±2.4% without echo confusion (p<<10−10, tStat=18.3, DF=28777, GLM), time-to-exit =9.3±0.2 seconds (p<<10−10, tStat=−13.7, DF=1996, GLM), see Figure 4, yellow line. The results above are reported for a density of 40 bats/3m2. Interestingly, the aggregation process restored the collision rate to the levels observed under the “No Confusion” condition (p=0.68, tStat=−0.42, DF= 2877, GLM, see Figure 4C, dark-purple and red lines).

Discussion

We present a model-based approach that suggests how echolocating bats might find their way out of a crowded roost while contending with severe sensory interference caused by numerous nearby conspecifics. Our results demonstrate that a single bat, lacking prior knowledge of its location and of the roost’s structure, can reliably find the exit using echolocation alone. As bat density increases, the bats face increased collision risks and more substantial acoustic interference, both of which reduce the probability of efficiently finding the exit. Nevertheless, even at densities of 100 bats/3m2, most bats (63%) successfully exited the roost within a short timeframe. In brief, we demonstrate how a simple sensorimotor approach can solve this supposedly challenging task. This approach encompasses the following principles: (1) emission of echolocation calls; (2) reception of reflected echoes and interference signals; (3) detection of reflectors (including walls and conspecifics) using a gammatone filter bank biological receiver; (4) localization of the detected objects; (5) employment of short-term integration of acoustic detections; (6) adjustment of flight and echolocation behavior based on the distance and angle to the reflectors; and (7) application of simple pathfinding rules to follow walls and gaps while avoiding collisions. Notably, despite the jamming of a substantial percentage of the echoes (up to approximately 50% of the echoes from a 1 m distance), the bats managed to maneuver correctly even with this simple approach and partial data. Real bats likely use a much more sophisticated approach that also includes memorizing the roost’s structure47, using landmarks inside the roost48, reliance on the movement of nearby conspecifics42,45, and exploitation of other sensory modalities. We thus expect their actual performance to surpass that of our modeled bats.

Our model suggests that acoustic jamming might be less problematic than has been generally assumed4,10,49 and that movement under severe acoustic masking could be mitigated by increasing the call-rate, creating a redundancy in information across several calls- similar to how real bats react in a complex environment5, and using simple sensorimotor heuristics. This is consistent with several relatively recent studies that have hinted in this direction6,22,23.

The bat densities we simulated (ranging from 1 to 100 bats per 3m2) reflect a wide range of observed bat densities. Although bat colonies can be much larger than 100 bats, the density that we simulated resulted in bats moving very close to each other, with an average distance of 0.27 m to the nearest bat. This density is higher than some of the most-dense reported bat aggregations, including studies on Miniopterus fuliginosus45, Myotis grisescens50, and Tadarida brasiliensis3,46,51, where bats emerge from the roost at rates of 15 to 500 bats per second, but fly with an average distance of 0.5 meters between individual bats.

We compared the performance of two FM echolocating insectivorous bat species: Pipistrellus kuhli (PK) and Rhinopoma microphyllum (RM). PK bats emit wideband echolocation signals that are less prone to jamming than RM bats’ narrowband signal14,52. Our findings show that PK signals slightly reduce jamming probability (by 9%) and improve wall detection. However, no significant differences in exit probabilities were noted between the two species.

Using a simulation allowed us to separate the effects of sensory and spatial interferences (i.e., avoiding other bats) and revealed new insights into the sensorimotor strategy that is probably applied by real bats. The spatial interference reduced the probability of exiting the roost from 100% to 87%, while the sensory interference further decreased it to 63%. Increasing call intensity had little effect on exit performance, although slightly improving it at high bat densities. When all bats increased their calling intensity, both desired echoes and masking signals intensified equally, resulting in only a marginal effect. There is, thus, no benefit beyond a certain level of calling intensity that is needed to ensure proper obstacle detection (ca. 110dB-SPl, which is in accordance with actual call intensities used by bats). These results align with previous studies that have drawn similar conclusions6,23.

Bats constantly adjust their flight speed to their surroundings5356 and specifically when conspecifics are nearby57. Our study suggests that the optimal velocity for flying through a crowded roost ranges from 6 m/sec to 8 m/sec for densities of 2-100 bats/3m2. Exceeding this velocity-range led to a significant drop in exit probability due to a significant increase in wall collisions. We found that this speed did not depend on bat density in accordance with the observations of Theriault et al.46. Notably, the reported velocities of RM when exiting a cave22 and PK emergence velocity near the cave58 are close to the speed that appears optimal, based on our simulations.

Our basic model assumed that bats can distinguish between wall echoes and conspecific echoes, as demonstrated in previous studies 59. We suggest that this is a feasible assumption because echoes from cave walls are longer and exhibit distinct spectro-temporal patterns, whereas echoes from smaller objects, such as conspecifics, are shorter43,60,61. However, wall echoes reflected from conspecific calls might resemble those from the bat’s own calls in their amplitude and time-frequency characteristics 18,57,62. This led us to question how the misidentification of such echoes as obstacles might affect navigation. When unable to distinguish between these echoes, the simulated bats responded to all as if they were their own and thus mis-localized conspecific wall echoes. The confusion led to a significant drop in exit performance, in which only 15% of the bats successfully exited (compared to 82% without confusion), and the collision rate rose from 0.2 to 0.85 collisions per second, at a 40 bats/3m2 density.

Previous studies have demonstrated that bats can aggregate acoustic information received sequentially over several echolocation calls, effectively constructing an auditory scene in complex environments4,6366. Accordingly, we tested how temporal aggregation process, which also included clustering of nearby reflectors and estimating wall orientation based on integration, rather than processing single detections, might assist bats in pathfinding even under the assumption of full confusion. At bat densities of 1 to 40 bats/3m2, the temporal aggregation process completely restored the collision rate with walls from 0.85 back to 0.2 collisions per second, and significantly improved the exit probability, raising it to 58%, although it did not entirely eliminate the impact of confusion. Our assumption of total confusion between echoes from a bat’s own calls and those from conspecifics, as well as our relatively simple integration model, likely underestimates the true capabilities of real bats when flying in complex environments.

Navigation in bats involves processing complex sensory inputs and applying effective decision-making, often requiring an ability to switch strategies6773. Bats possess a highly accurate spatial memory63,69,7375, which is essential for tasks like long-distance migration47, homing76, and maneuvering in cluttered environments74. Additionally, they utilize acoustic landmarks to orient in total darkness48, occasionally rely on vision70,71, particularly at the cave edge where light is available, can passively detect echolocating peers, and perhaps eavesdrop on conspecifics’ echoes21. In this study we focused on whether echolocation alone is sufficient for one of the most difficult orientation tasks that bats perform – exiting a roost at high densities without prior knowledge of the roost’s shape, aside from the initial flight direction. Thus, our echolocation-only model, which was based on a five-call integration window during most simulations, probably underestimates real bats’ actual performance which also benefits from additional sensory input and can employ addition navigation strategies by sharing information between each other to coordinate and optimize the routes, such as manifested by swarming intelligence32,77,78.

Our model highlights the importance of considering sensory interference in animal behavior research and illuminates the impressive capabilities of echolocating bats. Additionally, the model showcases the value of simulations and establishes a framework for future studies on collective movement and swarming animals, and on robotics in complex environments.

Methods

The simulated bats rely solely on echolocation to detect and locate obstacles and other bats by analyzing the sound waves they receive. They emit directional echolocation calls and receive the echoes reflected by roost walls and conspecifics, as well as the calls of conspecifics and the echoes returning from their calls. The bats adjust their flight trajectory and echolocation behavior based on the estimated location of the detected objects (range and angle), which deteriorates upon acoustic interference. The detection of the received signals is based on the mammalian gammatone filter bank receiver, under the assumption that bats can differentiate between the desired detected obstacles, conspecifics’ echoes, and masking signals. We conducted simulations with varying number of bats (from 1 to 100) to analyze the flight trajectories with and without masking interference by conspecifics. In the trials without masking interference the bats successfully detected walls and conspecifics without any hindrance. For a detailed description of the MATLAB simulation see Mazar & Yovel 20206.

All bats in our model start their flight simultaneously within a 0.1 sec window from a random point at the cave’s end over a 2 x 1.5 m2 area, heading in a random direction between −30 and 30 degrees relative to exit direction (see Figure 1). They employ a simple navigation algorithm that dynamically adjusts flight direction based on the detected obstacles or conspecifics (Supplementary Figure 1 and Figure 1D). If no obstacles or conspecifics are detected, they continue in a correlated random walk with a maximal turning rate of approximately 30 deg/sec. When obstacles are detected, they are first localized with an error (see below and6). Then, if an opening(i.e., a gap of at least 0.5 m between obstacles) is detected, the bats fly through it, if not, they follow the walls while maintaining a 0.8 m distance from them. When approaching a stationary obstacle too closely (<1.5 m and at an angle <60°), they execute an obstacle avoidance maneuver. High proximity to another bat (<0.4 m) triggers an avoidance maneuver away from the nearest conspecific. If the bat collides with a wall, it immediately turns so that its new flight direction is at a 90° angle to the wall. Each decision relies on an integration window that records the estimated locations of detected reflectors from the last five echolocation calls, with the parameter being tested between 1 and 10 calls. This algorithm functions without any prior knowledge of the bats’ location or the roost’s structure. To assess performance, we measured the probability of successfully exiting the roost within a 15-second window, chosen because it is approximately twice the average exit time for 40 bats and allows for a second corrective maneuver if needed..

Echolocation behavior and flight speed follow the phases widely reported in insectivorous bats, categorized as “search,” “approach,” and “buzz”7982 with specific echolocation parameters for Pipistrellus khulli (Kuhl’s pipistrelle)54 and Rhinopoma microphyllum (greater mouse-tailed bat)22. The distance to the detected object defines the phase and accordingly determines the following parameters: Inter Pulse Interval (IPI), call duration, and start and stop frequencies. The simulated echolocation call consists of the dominant harmony of the bat’s FM Chirp (1st harmony of the PK and 2nd harmony of the RM). Table 2 provides the specific echolocation parameters used in the model. During the search phase, the bats fly at a nominal velocity of 6 m/sec, reducing it by half during the approach phase and continuously adjusting their speed according to the relative direction of the target, using a delayed linear adaptive law6,83,84. The maneuverability of the bats is constrained to a maximum of 4 m/sec², limiting both angular and linear accelerations.

Echolocation parameters.

The table presents the echolocation parameters of the two bat species we simulated during the specified flight phases (i.e., search, approach, buzz, and final buzz). In each phase, except for the search phase, in which the parameters remain constant, the parameters for each call are determined by the distance to the closest detected object.

The sound intensity of the echoes generated by the bat’s own calls and those of its conspecifics are calculated using the sonar equation6,85 (pp. 196-198), as shown in Equation 1. The received levels of the masking calls are determined by using the Friis transmission equation86, as shown in Equation 2. Bats are modeled acoustically as spherical reflectors with a uniform target strength of −23dB, reflecting sound isotropically. This acoustic characterization approximates a sphere with a radius of 0.15 m, corresponding to the approximate wingspan of Rhinopoma microphyllum (RM) 22,87. Walls are modeled as composites of individual reflectors placed 20 cm apart; each treated as a sphere with a 20 cm radius and a target strength of −20dB. The directivity of the calls and the received echoes is defined by the piston model6,82 with radii of 3 mm for the mouth-gap and 7 mm for the ear. Echo delays are calculated as the two-way travel time of the signals from the emitter to the target.

where,

Pr: level of the received signal [SPL]

Pt : level of the transmitted call [SPL]

Pmask : level of the masking signal as received by the bat [SPL]

PechoesFromMasking : level of the echoes reflected by conspecifics and received by the bat [SPL]

Gt(ϕ, f): gain of the transmitter (mouth of the bat, piston model), as a function of azimuth and frequency (f) [numeric]

Gr(ϕ, f): gain of the receiver (ears of the bat, piston model) [numeric]

ϕtarget : angle between the bat’s direction and the target [rad]

D: distance between the bat and the target [m]

ϕii, Dii : angles[rad] and distances[m] between the emitting bat or receiving bat (tx and rx, respectively) and the target

αatt(f): atmospheric absorption coefficient for sound [dB/m]

σ(f): SONAR cross-section of the target [m2]

λ: The wavelength of the signal [m]

To model the bat’s cochlea, we employed a filter bank receiver43,88,89 consisting of 80 channels, each with three components: (i) a gammatone filter of order 8, acting as a bandpass filter with center frequencies logarithmically scaled between 10kHz and 80kHz6; (ii) a half-wave rectifier; and (iii) a lowpass filter (Butterworth, fc=8kHz, order=6). Object detection and distance estimation are conducted using Saillant’s method6,43,90, based on the sum of detections in the active channels, see Figure 1C, D. Initially, a de-chirping process calculates the reference frequency-delay by detecting the peak in the response of each channel to the emitted call in a noise-free environment. Subsequently, the received signal, containing both desired echoes and masking sounds, passes through the filter bank. In each channel, all peaks above a threshold level are detected and time-shifted by the de-chirp reference. Peaks from all channels are aggregated in 5 µs windows and convolved with a Gaussian kernel with σ=5 µs. Output peaks that exceed the threshold level, set at 10% of the number of active channels, and fall within a time window of 100µs around the expected delay, are considered successful detections.

To evaluate the impact of acoustic interference, we conducted the detection procedure twice. The first, termed “interference-free detection”, comprised only the desired echoes, with Gaussian noise at a level of 0 dB-SPL and without masking signals. The second, termed “full detection” comprised the desired echoes, Gaussian noise, and the masking signals. Detected echoes in the full detection were defined by the strongest peak within a four-millisecond window (three milliseconds before and one millisecond after, accounting for forward and backward masking) detected within 100µs of the interference-free detections. Jammed echoes were those detected in the interference-free condition and not in the full detection condition. The jamming probability was defined as the ratio of jammed echoes in the full detection condition to the detected echoes in the interference-free condition.

After detection, the bat estimates the range and the Direction of Arrival (DOA) of the reflecting objects. The range is determined by the delay of the detected echo, including any errors derived from the filter-bank process in the “full detection” process (i.e., including all masking signals). The direction is estimated by adding directional errors to the calculated angle between the bat and the target6. These errors are normally distributed with a zero mean and a standard deviation that depends on the Signal-to-Noise Ratio (SNR) and the angle. At an angle of 0° and an SNR of 10dB, the standard deviation of the error is 1.5°91,92.

To evaluate the impact of the assumption that bats can distinguish between echoes caused by their own calls and those caused by other bats (i.e., conspecifics’ reflectors), we tested an alternative model in which the simulated bats treat all echoes reflected from walls as if they have originated from their own calls. The distance to the conspecifics’ reflectors is estimated based on the time difference between the echo and the bat’s last call. The direction of arrival is estimated by the angle between the bat and the physical reflector, with an added random error (the same process used for their own echoes).

In real bats, spatial processing in the brain involves aggregating auditory information over time to construct a coherent map of the environment 4,93. This neural computation is crucial for navigation and prey detection in complex environments. Therefore, we also examined how the inclusion of temporal aggregation process in the environment perception procedure helps bats mitigate the confusion problem. The integration comprised the following steps, which were executed within a one-second working memory (or integration window): (i) clustering all detections in memory into groups with a maximum internal distance of 10 cm; (ii) reconstructing the estimated walls positions and directions based on the average of clusters that include at least two detections (and not based on single reflectors); and (iii) looking for openings between wall edges ranging from 0.5 to 2.25 meters in width, see Supplementary Figure 1. Note that detections from the last calls, even if not clustered, are still used for obstacle avoidance maneuvers.

Statistical analysis

Statistical analysis and the roost-exit model were conducted using MATLAB© 2023a.

Tests were performed with a significance level of 0.05. For each simulated scenario, we examined the effect of the various parameters on exit probability, time-to-exit, collision rate, and the jamming probability, using Generalized Linear Models (GLMs). The GLM tests were executed with MATLAB built-in function ‘fitglm()’. Probability variables (such as exit and jamming probabilities) were treated as binomially distributed; rate variables (such as collision rate) were treated as Poisson distributed, and all other variables were considered normally distributed. Unless otherwise stated, all explaining variables were set as fixed factors. All statistical analyses, including the statistical test and the corresponding sample sizes, are described throughout the text and summarized in Table 1.

Data availability

All data and codes generated during this study are included in the manuscript and supporting files. Source code files have been uploaded with a Graphical User Interface and a readme file for explanation. Data are available at: link https://drive.google.com/drive/folders/1hxnxbd37I2qVOLTWUob7cGhqXaQakEXs

Decision-making in echolocation-based pathfinding

The diagram illustrates the sequential steps in a bat’s pathfinding process based on echolocation. This process starts with the emission of an echolocation call (1) and the reception of echoes and interfering signals (2), followed by sensory processing for detection, range estimation, and direction of arrival (DOA) (3). After integrating detections over a 1–10 call window (4), the bat engages in crash avoidance (5) by evaluating the proximity of conspecifics and obstacles directly ahead. If either is too close, the bat turns to the opposite direction. If no immediate threat is detected, the bat proceeds to pathfinding (6). During pathfinding, it checks for obstacles and, if an opening is detected, flies toward the gap’s center. Without the optional temporal aggregation process (green), the bat simply integrates detections and flies toward the farthest detected obstacle, interpreting it as a wall edge. If the temporal aggregation is included (9), a one-second short memory aids in clustering detections, estimating wall edges, and identifying openings, while also allowing the bat to follow walls at a constant distance. Throughout, the bat continuously adjusts echolocation parameters (8) and controls flight direction and velocity (7) based on ongoing sensory information and decision-making.

Additional information

Author contributions

O.M - Software, Formal analysis, Data acquisition, Validation, Visualization, Methodology, Writing - original draft, Writing - review and editing. Y.Y - Conceptualization, Resources, Supervision, Funding acquisition, Validation, Investigation, Methodology, Project administration, Writing - review and editing

Additional files

Supplementary Movie 1.