Introduction

Group living is widespread in animal taxa, and collective behavior is an emergent phenomenon arising from the local interactions of the members of animal groups. (Krause and Ruxton 2002; Delcourt and Poncin 2012; Herbert-Read et al. 2016; Schaerf et al. 2017). Living in groups can confer a number of ecological benefits, such as enhanced antipredator strategies and vigilance (Treherne and Foster 1981; Krause 1994; Fels et al. 1995), improved foraging speed (Creel and Creel 1995; Herbert-Read et al. 2017), increased reproductive success (Westneat et al. 2000; Bekkevold et al. 2002; Pilastro et al. 2003), reduced heat loss (Andrews and Belknap 1986), and decreased energetic cost of locomotion (Killen et al. 2012; Marras et al. 2015). Such benefits, however, could be partly offset by some costs of group living, including greater visibility to predators (Cresswell 1993; Seebacher and Krause 2017), increased competition for resources (Krause and Ruxton 2002; Pitcher et al. 1982; Webster and Hart 2006a), and increased risk of ectoparasite infection (Brown and Brown 1986; Van Vuren 1996; Han et al. 2015). This potential trade-off between the benefits and costs of group living is a dynamic process that is influenced by a number of ecological factors, such as individual physiology and cognition (Herbert-Read et al. 2011; Von Rueden et al. 2015; Seebacher and Krause 2017), aquatic temperature (Cooper et al. 2018), ecological context (Jolles et al. 2017; Rodriguez-Pinto et al. 2020; Yang et al. 2021; Li et al. 2022), and seasonal alternation (Chen et al. 2019).

Fish that rely on ambient heat regulate their body temperature to maintain their physiological functions at an optimum level. Changes in temperature can directly influence physiological processes related to energy metabolism (Zeng et al. 2010; Sandblom et al. 2014; Lefevre 2016), appetite (Chen et al. 2019), digestive capacity and growth (Legler et al. 2010; Zeng et al. 2018), and swimming performance (Claireaux et al. 2006; Zeng et al. 2009). Several researchers have indicated that temperature can increase hunger levels by increasing the metabolic rate of predators, which in turn affects their predation motivation (Allan et al. 2015; Domenici et al. 2019). Subjected to climate and seasonal changes, surface water in temperate zones can fluctuate widely by up to 20 °C diurnally (Temple and Johnston 1997; Zeng et al. 2009). Moreover, the behavior of fish exhibits rhythms in response to seasonal temperature changes in the water body (Häfker and Tessmar-Raible 2020). As one of the most crucial impacts in the aquatic environment, temperature changes have direct effects on the physiological and biochemical processes of fish. For example, the physiological functions (e.g., swimming ability) of fish increase with increasing temperature within the appropriate temperature range (Lee et al. 2003; Zeng et al. 2009; Peng et al. 2014; Pang et al. 2016). However, at a lower temperature, mitochondrial function is reduced due to a decrease in the metabolic capacity for muscle production (Randall and Brauner 1991; Guderley 2004; Day and Butler 2005), thereby reducing all aspects of fish organism function. Temperature also affects the water environment in which the fish live. When the temperature of a water body decreases, the viscosity of the water body also increases (Temple and Johnston 1997; Lee et al. 2003; Zeng et al. 2009). These changes in temperature are likely to cause modifications to individual functions and hence collective behavior (e.g., structure and function), which in turn will have a significant impact on the group's foraging performance. Therefore, the first goal of our study was to examine the effect of temperature on the individual and collective behavior of group-living fish.

In nature, animal habitats are complex and diverse and are usually compounded by various informational cues that span multiple sensory modalities (Heit et al. 2002; Dall et al. 2005). Habitats that fluctuate significantly in terms of food and shelter (Pitcher and Parrish 1993; Killen et al. 2016) can result in animals responding more flexibly to different contexts (Sih et al. 2011; Richter et al. 2012). Differences in context may lead to corresponding behavioral responses in animals (Herbert-Read et al. 2016; Seebacher and Krause 2017; Jolles et al. 2020). For example, hiding under a shelter or refuge can reduce the risk of predation and routine energy consumption by fish (Maximino et al. 2010; Matsuzaki et al. 2012). Moreover, the group structure and function of group-living animals change greatly according to the context in which they live. For instance, animal groups potentially behave more cohesively when under attack and are more dispersed when foraging (Hoare et al. 2004; Schaerf et al. 2017). While animal groups are more cohesive in situations where food sources are scarce or scattered, they are more dispersed in situations where food is plentiful (Lihoreau et al. 2017; Jolles et al. 2018). However, natural changes in water temperature may affect the foraging efficiency of fish groups in using resources across contexts. Previous studies have focused more on the effects of single contexts on fish collective behavior (Smith et al. 2009; Herbert-Read et al. 2016), while few studies have examined how animal groups function across contexts at given temperatures (Jolles et al. 2018; Hansen et al. 2020; Yang et al. 2021; Li et al. 2022). Thus, the second goal of our study was to test whether individual and collective behavior and their functions across contexts are temperature-dependent.

Crucian carp (Carassius auratus) is a freshwater fish that is widely distributed in rivers, lakes, and reservoirs in Eurasia. It is also a common freshwater economic fish in China and that displays schooling foraging habits. The common seasonal water temperature fluctuations in summer and winter in the upper region of the Yangtze River, China (Pang et al. 2014; Fu et al. 2018), were considered the acclimation temperatures, where 15 °C is the typical water temperature in winter and 25 °C is the typical water temperature in summer (Long et al. 2007). Here, we used crucian carp as an animal model to examine how individual and collective behaviors respond to different water temperatures and whether fish groups exhibit repeatable behavioral differences across contexts.

Materials and methods

Fish

Three hundred two-month-old crucian carp were obtained from a local fish farm in Yongchuan district, Chongqing, immediately transported to our laboratory at Chongqing Normal University, China, and kept in four cyclic temperature-controlled tanks (2 m length × 1 m width × 0.5 m height, water depth of 0.4 m), each containing 75 fish at 20 °C. The water temperature of the two tanks was heated at a rate of 2 °C per day to 25 °C using an aquarium thermoregulator at a starting temperature of 20.2 ± 0.1 °C, while the other two tanks were cooled to 15 °C at the same rate using a chiller (CA-1000A, RESUN, Guangzhou, China). After the target temperatures were reached, all the fish were acclimatized to the given temperature (15 and 25 °C) for at least four weeks. We placed plastic water plants at the bottom of each tank to increase the environmental enrichment. The fish were fed to satiation with mixed bloodworms to ensure that the fish could feed on the mixed bloodworms well during the collective behavioral trials. Before each feeding, both the air and water pumps were turned off to calm the water surface, and the fish were allowed to feed for one hour. After that, a siphon was used to remove residual food and feces within the tank. The dissolved oxygen level was kept above 7.0 mg/L with a 10 L: 14 D photoperiod.

Experimental overview

There were two acclimation temperatures (15 °C and 25 °C) for our study, with 150 fishes at each acclimation temperature and a total of 300 fishes. After acclimatization, 120 fish of similar size were selected at each temperature (Mean ± SE, 15 °C, body size 7.84 ± 0.22 cm; 25 °C, body size 7.73 ± 0.23 cm) and randomly formed into groups of six fish, with 20 groups at each temperature. Given the spatial constraints present in the holding compartment, each group consists of six fish, which conforms with the findings of previous studies in which the group size was controlled between 4 and 8 individuals (Jolles et al. 2017, 2018; Yang et al. 2021; Li et al. 2022; Cao et al. 2023). Each group of each temperature was tested for their collective behavior across three contexts for a total 10 of days. Each group of each temperature underwent a total of five test trials: one in the open water context (10 min), two in the food context (10 min), and two in the food + shelter context (10 min).

Collective behavior

A white circular acrylic tank (80 cm in diameter × 20 cm wall height, Fig. 1) was used to test the collective behavior of the fish. The testing temperature was controlled to be the same as that used during the acclimatization period. To maintain the water temperature at the target value (15 °C and 25 °C), a thermal insulation cover was placed around the outside of the tank wall, which allowed the change in water temperature to be less than 0.2 °C before and after filming. Given the body height of the fish at their current developmental stage and to minimize the possibility of vertical overlap between different individuals swimming in a shoal, we kept the water in the tank at a depth of 6.0 cm. The bottom and inner walls of the tank were pasted with nontoxic white sticker to increase the difference in color between the fish and the tank. The tank was positioned inside a shelf (1.5 m length × 1.5 m width × 2.0 m height) illuminated from the top (test environment light at ~ 240 lx). A ring of green opaque cloth was draped around the shelf to minimize the potential influence of the external environment on the collective behavior of the fish. A high-resolution Sony camera (HDR-PJ820E, 25 frames per second, 1080p) was placed vertically above the tank to film the collective behavior of the fish. (1) In the open water context, no food or shelter was placed in the tank. (2) For the food context, three identical food patches (10 cm diameter × 1 cm height) with 9 grids each inside were placed in an equilateral triangular space at the bottom edge of the tank. Five frozen bloodworms were randomly placed in the nine grids of the food patches when the fish were acclimating within a plastic cylinder at the center of the tank. (3) In the food + shelter context, a shelter composed of five green plastic plants (e.g., these plants were also present in their acclimation waters) was placed in the center of the tank, creating a 20 × 20 cm concealed area. At the same time, five bloodworms were randomly placed in the 9 cells of the food patches when the fish were acclimating within the plastic cylinder.

Fig. 1
figure 1

Schematic of the tank in which the groups of fish were tested across three different contexts: (i) open water context, an environment without food or plant shelter; (ii) food context, an environment with three patches of food; and (iii) food + shelter context, an environment with food patches as well as plant shelter

We exposed each group of six fish at each temperature to a total of 5 tests (5 days in total), one in the open water context (day 1), two in the food context (days 2–3) and two in the food + shelter context (days 4–5). Similar to two previous studies (Jolles et al. 2017, 2018), we tested the groups in random order at each temperature but employed a fixed context order to avoid confounding the behavior of the fish in earlier contexts with experience acquired with the foraging patches and shelter. Before each trial, the fish were transferred from their holding compartments to a cylinder (12 cm in diameter) at the center of the tank without air exposure and allowed to acclimate for 5 min. Afterward, the fish were released by remotely raising the cylinder. At this moment, the collective behavior was filmed for the given recording time. After the trials, the fish were transferred back to their holding compartments, and five bloodworms were fed to each experimental fish to ensure that they maintained an appetite until the next trial. To avoid the influence of potential pheromones (e.g., feces, uneaten foods, and chemical alarm cues) from the previous fish group on the next group's behavioral expression, all the water in the tank was replaced with new aged tap water at the same water temperature. All trials were conducted between 8:30 am and 5:30 pm each day to minimize the potential effect of diurnal rhythms on the collective behavior of the fish. The room was maintained at a consistent and low sound level to reduce the impact of external sound sources on the groups' behavior.

Data collection and calculation

To minimize observer bias, blinded methods were use when all behavioral data were recorded and analyzed. After obtaining a video of the collective behavior, the video was converted to the AVI format using video converter software. The tracking software idTracker (version 1.10, https://www.idtracker.es/home) was used to analyze all the videos. The two-dimensional coordinate data (i.e., pixel values on the x- and y-axes) of six fish in the group per time (1/24 s in our study) in the visual range (i.e., the open area beyond the shelter) were obtained. We obtained the pixel-to-actual distance ratio by transforming the coordinate data with the actual size of the tank (i.e., 11.62 pixels/cm in our study), which was used to obtain a set of actual movement data (measured in cm) of the fish groups in the active field of the test. Then, we calculated the following parameters via the axial data: (1) individual swimming speed, (2) synchronization of speed, (3) interindividual distance (IID), (4) nearest neighbor speed (NND), (5) group polarization (P), (6) distance to group center, (7) group speed, and (8) group percentage time moving (PTM). The calculation of each parameter is as follows:

  1. (1)

    Individual swimming speed (cm/s): In our study, the individual swimming speeds of juvenile crucian carp were taken from the median speed of six fish in a group.

    $$V\left(t\right)=\sqrt{{(x\left(t\right)-x\left(t-1\right))}^{2}+{(y\left(t\right)-y\left(t-1\right))}^{2}} /\Delta t$$
    (1)

    where V(t) is the individual swimming speed (cm/s); x, y(t) and x, y(t-1) denote the horizontal or vertical coordinate values of individual fish at moments t and t-1, respectively; and ∆t is the time interval between the two coordinate points (set at 1/24 s in our study).

  2. (2)

    Synchronization of speed (Sv): Sv is an assessment of the synchronization of individual swimming speeds that range between 0 and 1. The higher the value is, the greater the synchronization of individual swimming speeds.

    $${S}_{v}=1-\left|\left({v}_{i}-{v}_{j}\right)/({v}_{i}+{v}_{j})\right|$$
    (2)

    where vi and vj are the individual swimming speeds of fish i and j in the shoal at an instantaneous time instant, respectively.

  3. (3)

    Interindividual distance (IID, cm): IID refers to the average interindividual distance between all individuals in a shoal to assess group cohesion. The lower the IID is, the more cohesive the group.

    $${\text{IID}}\left(t\right)=\frac{1}{n}\sum\nolimits_{i\ne j}^{n}\sqrt{({x}_{i}\left(t\right)-{x}_{j}\left(t\right){)}^{2}+({y}_{i}\left(t\right)-{y}_{j}\left(t\right){)}^{2}}$$
    (3)

    where xi and yi are the horizontal and vertical coordinates, respectively, of fish i and j in the shoal at instant t.

  4. (4)

    Nearest neighbor distance (NND, cm): This measurement quantifies group cohesion and is the minimum distance (cm) of each fish among a matrix of distances between all individuals in a group.

    $${\text{NND}}\left(t\right)={min}_{i\ne j}\sqrt{({x}_{i}\left(t\right)-{x}_{j}\left(t\right){)}^{2}+({y}_{i}\left(t\right)-{y}_{j}\left(t\right){)}^{2}}$$
    (4)

    where xi and yi are the values of the horizontal and vertical axes, respectively, of fish i and j in the fish group, and fish j indexes all neighbors of fish i at time t.

  5. (5)

    Group polarization (P, no unit): This measurement quantifies the degree of alignment of a group of fish when swimming and can be calculated as the magnitude of the mean movement vector of all individuals (Miller and Gerlai 2012; Gimeno et al. 2016). The group polarization ranges from 0 to 1. The polarization value is 1 when all the individuals moving in a group are perfectly aligned and 0 when all the individuals’ movement vectors completely cancel each other.

    $$P\left(t\right)=\frac{1}{n}\left|{\sum }_{i=1}^{n}{v}_{i}(t)\right|$$
    (5)

    where vi (t) is the movement vector per unit time of an individual fish i, and the direction of movement is from the point of time t-1 to the location point of time t. n indicates the number of members of the group (e.g., n = 6 in our study).

  6. (6)

    Group center (Gx, Gy)

    $${G}_{x, y}\left(t\right)=({x,y}_{1}\left(t\right)+{x,y}_{2}\left(t\right)+{x,y}_{3}\left(t\right)+{x,y}_{4}\left(t\right)+{x,y}_{5}\left(t\right)+{x,y}_{6}\left(t\right))/6$$
    (6)

    where G(t) represents the mean of the horizontal or vertical axes of the six fish in a group at time t.

  7. (7)

    Distance to the group center (cm)

    $$D\left(t\right)=\sqrt{(x\left(t\right)-{G}_{X}\left(t\right){)}^{2}+(y\left(t\right)-{G}_{y}\left(t\right){)}^{2}}$$
    (7)

    where x(t), y(t) and Gx, Gy(t) are the values of the horizontal or vertical coordinates of the individual fish and the centroid of the group at time t, respectively.

  8. (8)

    Group speed (GV, cm/s)

    $${G}_{v}\left(t\right)=\sqrt{({G}_{x}\left(t\right)-{G}_{x}\left(t-1\right){)}^{2}+({G}_{y}\left(t\right)-{G}_{y}(t-1){)}^{2}}/\Delta t$$
    (8)

    where Gx (t) and Gy (t) are the values of the horizontal and vertical coordinates of the group center at time t, and Gx (t-1) and Gy (t-1) are the values of the horizontal and vertical coordinates of the group center at time t-1, and ∆t is the interval between the two coordinates of the group center (e.g., 1/24 s in our study).

  9. (9)

    Group percentage time spent moving (PTM, %)

    $${\text{PTM}}={T}_{{\text{moving}}}/{T}_{{\text{total}}}\times 100$$
    (9)

    where Tmoving is the total time that the group spent performing swimming and Ttotal is the total duration of the video capture (e.g., 600 s in our study). A fish group was considered to be moving when its instantaneous group speed was greater than 1.75 cm/s (Tang et al. 2017).

    (10) Foraging speed (ind/min)

    $$F=i/t$$
    (10)

    where i represents the number of bloodworms ingested by the shoal and t (min) is the total time taken to consume all 15 bloodworms.

Additionally, the following parameters were manually analyzed to evaluate the group dynamics in the context of food and shelter. (1) Number of times the fish group left the shelter (n): This refers to the number of times a group of juvenile crucian carp (consisting of more than four individuals) entered and exited the shelter, with each entry and exit counted as one occurrence. (2) Duration of stay in shelter (s): This refers to the total time that a group of fish, consisting of more than four individuals, spends inside shelters. (3) Group size (individuals): This represents the number of individuals in a group when they emerge from shelters.

Data analysis and statistics

Because 12 videos could not be analyzed by the idTracker software, these fish groups were excluded from the following statistical analysis of individual and group behavior. The obtained data were first analyzed with Excel (v.2021) to obtain the individual and collective behavioral parameters, as mentioned above. The statistical software package IBM SPSS Statistics (v.22.0) was subsequently used to perform the statistical analysis of these parameters. The software Origin (v.2021) was used to plot all the figures. All the data are expressed as the means ± SEs, and the significance level for all the tests was set as P < 0.05.

The data were first tested for normality and homogeneity of variance using the Kolmogorov‒Smirnov test. A linear mixed model (LMM) was used to examine the effects of temperature and context on the behavioral parameters. This model used temperature (15 °C and 25 °C) and context (open water, food and food + shelter) as fixed effects, behavioral parameters as the dependent variables, and group ID as a random effect. If differences were reported by this LMM, differences in individual and group behavioral parameters between the two temperatures within the same context were compared using independent sample t tests, and differences among contexts within the same temperature were compared using one-way ANOVA followed by Duncan’s test. If the data distribution did not conform to the normality analysis, a nonparametric test was used, with the Kruskal‒Wallis test used for between-group analysis and the Mann‒Whitney U test used for within-group analysis. The Mann‒Whitney U test was also used to test the differences in the number of times the fish group left the shelter, duration of stay in shelter, and group size between two temperatures.

We used Pearson’s correlation to examine the potential correlations between the three key components of collective motion. Finally, the repeatability of the approach for individual and collective behaviors at two temperatures across the three contexts was assessed using the intraclass correlation coefficient (ICC), which serves as a reliable measure of measurement or rating consistency. The ICC is computed as a ratio, where ICC = between-cluster variance/total variance (both within and between clusters), thus yielding a value ranging from 0 to 1 (Liljequist et al. 2019).

Results

We found that both temperature and context impacted the individual behavior of the fish (Fig. 2 and Table 1). Across the two temperatures, the fish acclimated at 25 °C moved faster, with individual swimming speeds higher at 25 °C than at 15 °C, irrespective of context (Fig. 2a). Similarly, individuals acclimated at 25 °C had a greater synchronization of speed than did those acclimated at 15 °C in both the open water context and the food context (Fig. 2b). In contrast, at the two temperatures, the fish had the lowest individual swimming speeds in the open water context compared with those in the food context and food + shelter context (Fig. 2a). At 15 °C, the fish swam faster and exhibited greater synchronization of speed in the food + shelter context than in the other two contexts (Fig. 2). However, the fish exhibited a lower synchronization of speed in the food + shelter context than in the other two contexts at 25 °C (Fig. 2b).

Fig. 2
figure 2

Effects of temperature and context on individual swimming speed and synchronization of speed in juvenile crucian carp. The boxes show the median, interquartile range, and whiskers (1.5 × the interquartile range). Boxes topped by the same lowercase letter (a, b, and c) do not differ significantly among the three contexts within a given temperature, while the pound sign (#) indicates a significant difference in parameters between the two temperatures within a given context

Table 1 Effects of temperature and context on the behavioral parameters of crucian carp based on the linear mixed model

Apart from group polarization, temperature and context impacted the group speed and the group PTM of the fish (Fig. 3 and Table 1). The group speed and the group PTM were lower in the 15 °C treatment than in the 25 °C treatment (Fig. 3a, c). In different contexts, both the group speed and the group PTM increased from the open water context to the food + shelter context. The group speed and the group PTM were greater in the food + shelter context than in both the open water and food contexts. In addition, group polarization was modulated only by context and not by temperature (Fig. 3b and Table 1). The fish groups in the food context were arranged more compactly than were those in the other two contexts. No temperature effect on group cohesion was found in the three contexts (Fig. 4 and Table 1). However, among the three contexts, fish in the food context had the closest group structure, with the lowest values for IID, NND, and distance to the group center, compared to those in both the open and food + shelter contexts (Fig. 4 and Table 1).

Fig. 3
figure 3

Effects of temperature and context on collective behavior in juvenile crucian carp. The boxes show the median, interquartile range, and whiskers (1.5 × the interquartile range). Boxes topped by the same lowercase letter (a, b, and c) do not differ significantly among the three contexts within a given temperature, while the pound sign (#) indicates a significant difference in parameters between the two temperatures within a given context

Fig. 4
figure 4

Effects of temperature and context on group cohesion in juvenile crucian carp. The boxes show the median, interquartile range, and whiskers (1.5 × the interquartile range). Boxes topped by the same lowercase letter (a, b, and c) do not differ significantly among the three contexts within a given temperature, while the pound sign (#) indicates a significant difference in parameters between the two temperatures within a given context

Both the foraging speed and foraging latency were regulated by temperature and context (Fig. 5). In both the food and the food + shelter contexts, the foraging speed of the shoals was lower in the 15 °C treatment than in the 25 °C treatment (Fig. 5a). Furthermore, the fish had greater foraging speeds in the food context than in the food + shelter context at 25 °C, but such a contextual effect was not found at 15 °C (Fig. 5a). On average, in the food context, the fish first fed at 42 s and 48 s after the start of the experiment at 15 °C and 25 °C, respectively (Fig. 5b). In contrast, in the food + shelter context, the fish started to feed at 182 s and 102 s after the start of the experiment at 15 °C and 25 °C, respectively (Fig. 5b).

Fig. 5
figure 5

Group foraging performance of the two temperature groups across contexts. The boxes show the median, interquartile range, and whiskers (1.5 × the interquartile range). Boxes topped by the same lowercase letter differ significantly in group efficiency between the two contexts at 25 °C, while the pound sign (#) indicates a significant difference in group efficiency between the two temperatures within the food context

With the presence of the shelter in the tank, the fish tended to split into subgroups, which were dependent on temperature. Between 15 °C and 25 °C, there were differences in the sizes of the groups that left the shelter at any time, the frequency of swimming from the shelter, and the duration of stay in the shelter (Table 2). At 15 °C, due to the longer time (396 ± 29 s) fish spent in the shelter, the fish shoal left the shelter less frequently, and the average fish group size was 2.5 ± 0.2 individuals per outing. In contrast, the fish shoal spent less time (186 ± 20 s) in the shelter at 25 °C than at 15 °C, and the average fish group size was 5.1 ± 0.1 individuals per outing (Table 2). The variables related to individual and group behavior, except for the nearest neighbor distance, were found to be consistent across contexts at 15 °C; however, only individual swimming speed exhibited repeatability across contexts at 25 °C (Table 3).

Table 2 Statistical analysis for the use of shelters and group size differences (mean ± SE) between the two temperatures based on the Mann–Whitney U Test
Table 3 Repeatability of behavioral parameter measurements between three contexts in crucian carp at two temperatures

Discussion

Our study aimed to investigate the effect of temperature on the individual and collective behavior of juvenile crucian carp in different contexts. By analyzing movement data from the fish groups, we found that fish at a higher temperature (25 °C) had greater spontaneous activity than did those at a lower temperature (15 °C), as evidenced by increased time in movement and swimming speed and increased feeding efficiency. Under colder conditions, fish tended to stay in shelters, reducing their foraging activity. Furthermore, compared with the open water context and food + shelter context, the effect of temperature on group structure was only evident in the food context, in which fish exposed to higher temperatures were more dispersed, while those at lower temperatures were more densely arranged. In the different contexts, the locomotor performance of fish groups increased with increasing habitat complexity. Compared with those in the other two contexts, the fish in the food context were the most aligned and arranged themselves more closely together. In contrast, shoals exposed to food + shelter were the most dispersed, and they usually took more time before starting their first group foraging. The presence of shelter in the environment made the fish groups more likely to split into subgroups, with larger group sizes occurring at 25 °C than at 15 °C.

Previous studies have shown that the effect of temperature on individual fish behavior is modulated by the behavioral strategies of the fish (Fu et al. 2018). The spontaneous activity of damselfish (Pomacentrus moluccensis) increases with increasing temperature (Biro et al. 2010). However, the locomotor activity of common carp (Cyprinus carpio) decreases with increasing temperature (Fu et al. 2012), while the spontaneous activity of Chinese bream (Parabramis pekinensis) does not change with increasing temperature (Peng et al. 2016). Such behavioral strategy choices may be modulated by the different physiological states of fish and the environment in which the individual is situated. In our study, compared to the fish at 15 °C, the fish at 25 °C had greater individual swimming speeds (e.g., spontaneous activity) and foraging speeds. Moreover, the fish groups spent more time hiding in the shelter at 15 °C than at 20 °C, suggesting that this behavioral strategy of hiding in shelters in crucian carp groups may be modified by temperature. At lower temperatures, physiological activity and metabolic functions are reduced, resulting in lower spontaneous activity (Claireaux et al. 2000; Joaquim et al. 2004; Zeng et al. 2009; Fu et al. 2018). Under such thermal conditions, the fish may have chosen to compensate for this functional decline by reducing movements and instead staying in the shelter.

Generally, the faster the group moves, the greater the synchronization of speeds, and the greater the IID and coherence of the group (Jolles et al. 2017; Schaerf et al. 2017; Wang et al. 2019; Li et al. 2022). In the foraging context, fish usually exhibit a faster foraging speed and may form looser shoals to reduce competition for food between group members (Hoare et al. 2004; Schaerf et al. 2017). An empirical study showed that the IID and group polarization of stickleback (Gasterosteus aculeatus) increase with increasing group speed (Jolles et al. 2017). In zebrafish (Danio rerio), the faster the group swims, the looser the group becomes (Miller and Gerlai 2012). Compared to those in an open water context, qingbo showed a significant increase in group speed but a decrease in group cohesion and group coordination in the presence of both food and shelter (Yang et al. 2021). In our study, fish in the open water context swam the slowest, those in the food context swam at moderate speeds, and those in the food + shelter context had the highest swimming speeds. Interestingly, the fish in the food context were the most cohesive and closely aligned, having the greatest group polarization and the smallest IID. The groups in the food + shelter context had the greatest group swimming speeds but were not as well aligned as the groups in the food context were. Moreover, although the groups in the food + shelter contexts had the greatest movement speeds, their synchronization of speed was not positively related to individual swimming speeds. There was no significant difference in the synchronization of speed (both 0.65 ± 0.02) between the two temperatures for the fish in the food + shelter context. This may be attributed to the presence of shelters allowing for increased environmental complexity, which may reduce anxiety in fish (Maillet et al. 2015). Environmental contexts might temporarily reduce heterogeneity in behavioral expressions; for example, foraging motivation may change in response to food availability or predation risk (Krause and Ruxton 2002; Jolles et al. 2019). A complex habitat provides a variety of ecological niches for animals and facilitates the coexistence of multiple behavioral strategies within a community (Xu 2020). Furthermore, the physical structure of shelters may also reduce visual contact between individuals but also increase barriers to movement; shelters provide more physical structures while increasing the cost of animal movement (Amat et al. 2018), and animals may be less likely to move in complex habitats (Skalski and Gilliam 2002). Additionally, the presence of more complex environments, as compared to a single biological context, introduces multiple physical dimensions in fish, thereby diverting attention to some extent (Heit et al. 2002; Dall et al. 2005). The presence of shelters increased the potential for fragmentation of intergroup behavioral strategies and led to differences in the behavioral tendencies of members of different groups. In our study, in contexts without shelter grouping is the primary option for safety and it also increases competition for food among group members. In the food + shelter context, however, some individuals that were less hungry tended to stay in the shelter, but others tended to go out for some motivational activities, such as searching for food, resulting in a longer latency to consume food compared to the food context. In this way, although the fish in the food + shelter context exhibited the fastest movement speed, the synchronization of swimming speed did not show a corresponding change, and the group coordination was lower than that in the food context.

Animal foraging behavior is regulated by various factors. It has been shown that under high temperature conditions (especially in hot summers), the activation of the GH/IGF-I axis increases metabolic demand for growth in fish (Gabillard et al. 2003) and can also regulate the expression of appetite centers in the Atlantic cod (Gadus morhua) and Chinese perch (Siniperca chuatsi) (Kehoe and Randall 2008; Song et al. 2017). Additionally, uncertainty about distribution of food patches or predators in the environment may also allow foraging behavior to change. Previous studies have indicated that during foraging, an animal's energy intake increases, but the risk of exposure to predators also increases (Andrews and Belknap 1986). When not foraging, animals can scan the environment for predators or rest in a shelter, thus reducing the risk of predation but decreasing energy intake (Higginson et al. 2012). The presence of shelters, in addition, enhances environmental complexity, potentially impeding communication between group members and consequently reducing their foraging speed (Tang and Schwarzkopf 2013). Consistent with the findings of previous studies (Hansen et al. 2015; Allan et al. 2015), our study found that the foraging speed of fish at 15 °C was lower than that at 25 °C in all three contexts. Compared with those in the 15 °C treatment, the fish in the 25 °C treatment may have had greater metabolic demands for basic energy expenditure, growth, and appetite, and they were more strongly motivated to forage at larger group sizes under the 25 °C treatment. Fish often delay feeding when shelters exist. The presence of shelters may not only provide shelter from potential risks but also reduce the animals' visibility to the habitats (Lima and Zollner 1996; Tang and Schwarzkopf 2013). In our study, fish first entered the shelter after being released into the tank to scan their surroundings or to rest in the shelter to balance foraging benefits and costs. The food context was relatively simple in terms of environmental cues, and the fish could quickly observe and assess the potential risks of their surroundings and find food to then make group decisions when compared to the food + shelter context. It is noteworthy that the juvenile crucian carp used in the present study were obtained from a local fish farm, implying a probable lack of exposure to really natural predators, and suggesting that their antipredatory behavior likely stems from innate evolutionary responses.

In conclusion, changes in temperature and context lead to differences in individual behavior of group members, which can further lead to changes in collective behavior and group functioning. Even at the same temperature, collective behaviors are modulated according to the different contexts in which they occur and are temperature-dependent. Consistent differences in collective behavior can occur even when the same group is faced with different contexts. In the food context where only a single stimulus cue (e.g., food) is present, the fish groups show the tightest and neatest structure. However, with the addition of shelter to the tank, the environmental complexity increased, and the behavioral tendencies of the group members changed. It becomes more difficult for fish groups to assess the potential risk of their surroundings over time, and fish may need to spend more time to trade off the benefits of foraging against these risks. Such adaptive variation in fish groups may impact colony survival and reproduction. Currently, in the face of global climate change and frequent human activities, animals may face multiple survival stresses and challenges. Whether animal groups develop adaptive variations in response to rapid environmental changes in their habitats as well as the associated behavioral responses deserves attention. Future studies should focus on the collective behavioral patterns of animals and explore the links between collective behavior, functional performance, mechanisms, and ecological processes in the face of global climate change.