Coevolutionary game dynamics with localized environmental resource feedback
Abstract
Dynamic environments shape diverse dynamics in evolutionary game systems. We introduce spatial heterogeneity of resources into the Prisoner’s Dilemma Game model to explore the co-evolution of individuals’ strategies and environmental resources. The adequacy of resources significantly affects the survival competitiveness of surrounding individuals. Feedback between individuals’ strategies and the resources they can use leads to the dynamic of the “oscillatory tragedy of the commons”. Our findings indicate that when the influence of individuals’ strategies on the update rate of resources is significantly high, individuals can form sustained spatial clustered patterns. These sustained patterns can directly trigger a transition in the system from the persistent periodic oscillating state to an equilibrium state. These findings align with observed phenomena in real ecosystems, where organisms organize their spatial structures to maintain system stability. We discuss critical phenomena in detail, demonstrating that the aforementioned phase transition is robust across various system parameters including: the strength of cooperators in restoring the environment, the initial distributions of cooperators, and noise.
I Introduction
Coevolutionary game dynamics with environmental feedback are topics of great concern in complex system science. In an ecosystem with limited public goods, individuals will inevitably defect in pursuit of their own benefits, ultimately depleting available resources. Hardin called this dilemma “the tragedy of the commons” (TOC), and he mentioned that there is no technical solution for this dilemma[1]. Recently, Weitz et al. studied a class of dynamics which was named “oscillatory tragedy of the common” (o-TOC) with the consideration of payoffs with environmental feedback[2]. Defectors destroy environment and cooperators restore it. Thus, system cycles between deplete and replete environmental states and cooperation and defection behavior states. Because individuals tend to choose cooperation in deplete state and defection in replete state respectively in order to get higher payoff. For instance, overgrazing degrades grasslands, which can be restored if pastoralists control grazing[2]. Tilman et al. proposed a comprehensive framework for eco-evolutionary games, providing examples and analyzing the dynamic mechanisms underlying the oscillation phenomena[3]. They theoretically deduced the conditions for the avoidance of the oscillatory tragedy[2, 3].
However, the aforementioned studies assumed a uniform environment, which may not accurately reflect the real-world systems. Spatial heterogeneity of environment was already taken into consideration in studies of ecosystems such as mussel bed, arid ecosystems and bacterial colonies[4, 5, 6]. Compared to non-spatial models, spatial interactions can significantly affect system stability and promote the formation of spatial patterns[7]. Game transitions can effectively promote cooperation rate, which represent the effect of localized environmental feedback in evolutionary games, and it is related to the idea of partner-fidelity feedback in evolutionary biology like grass-endophyte mutualism[8, 9, 10, 11, 12, 13]. Other researchers have also utilized game transitions to investigate the affection of game information, reinforcement learning individuals and state-dependent strategies[14, 15, 16]. Lin et al. considered spatiotemporal dynamics with environmental diffusion in individual based model and analyzed dynamic mechanism of o-TOC[17]. Hauert et al. investigated asymmetric evolutionary games in heterogeneous environment that consists of patches of different qualities and found a series of dynamic phenomena[18]. In summary, heterogeneous environmental feedback has significant influence on evolutionary games that cannot be ignored.
Thus, in this work, we introduce spatial heterogeneous resources into the Prisoner’s Dilemma Game model with environmental feedback. Environmental resources are assigned to nodes in square lattices which can be used by individuals on adjacent nodes. System oscillates between deplete and replete states of resources because individuals tend to cooperate in nodes with sufficient resources and defect in nodes with deficient resources, respectively. When the update rate of resource is sufficiently high, sustained clustered patterns emerge in the distributions of strategies and resources, leading to a phase transition from the oscillating state to an equilibrium state.
II Model and simulations
We study the evolutionary dynamics of games in square lattice with nodes and periodic boundary conditions. Every individual takes up a node alone and has a strategy , . stands for cooperation and stands for defection. Initially, individuals’ strategies is randomly assigned as cooperation with equal probability or defection with probability . Each individual is assigned a certain amount of resources, represented by the parameter . means node has the poorest resources, and means node has the most abundant resources. Individuals can use their own and their neighbors’ resources. Thus, the total resources individual can use are
(1) |
are the neighbors of individual , and are their resources respectively. When individual plays games with their neighbors, its payoff is determined by and the following payoff matrices:
(2) |
where and are the matrices which correspond to situations of resource scarcity and resource abundance respectively. represents the payoff matrix of the Prisoner’s Dilemma Game which is used when resources are abundant, corresponds to the payoff matrix that benefits cooperators when individuals deplete their resources, respectively. The advantage of cooperators in arises because cooperators can regenerate resources in hostile environments.
(3) |
where () denotes the reward of cooperation, () denotes the sucker’s payoff, () denotes the temptation to cheat, () denotes the punishment for mutual defection.
At each step , we randomly choose an individual to play games with its neighbors and update its strategy to by myopic rules[19, 20, 21] with probability
(4) |
where is the average payoff of individual ’s games with four neighbors, is the opposed strategy of , is the average payoff of individual with strategy , controls the noise. After updating individual ’s strategy to , we update node ’s and its neighbors’ resources
(5) |
. is the parameter that controls the update rate of resources relative to the update rate of strategies. denotes the strength of cooperators in restoring the environment. when and when . We restrict while updating resources. If should be updated to a value bigger than 1 according to Eq. (5), we set it to 1. Similarly, if should be updated to a value less than 0, we set it to 0. We take steps with chances to update strategies and resources as a Monte Carlo(MC) step, every individual has equal chance to update its strategy once in each MC step.
The fraction of cooperators is defined as
(6) |
where when , when . The average resources of the system is
(7) |
We use these two parameters to discuss the co-evolution of the cooperation level and the average resources of the system. In our simulations, without loss of generality, we set noise and system size . The payoff matrices are
(8) |
In our results of Monte Carlo simulations, the initial probability for individuals to cooperate is , the initial resource of nodes are all set to .
III Results and discussion
III.1 Oscillating dynamics



From Fig. 1 we can see that the system exhibits persistent oscillating dynamics of the fraction of cooperators and the average resources of the system . Upon reaching a periodic oscillating state, the system cycles through four distinct states within each period: (1) deficient resources and low fraction of cooperators (, ), (2) deficient resources and high fraction of cooperators (, ), (3) sufficient resources and high fraction of cooperators (, ), and (4) sufficient resources and low fraction of cooperators (, ). Assuming the system initially starts in state 1, characterized by deficient environmental resources and dominance of defectors. Individuals gradually choose cooperation to obtain higher payoffs in the barren environment, and the environmental resources remain at a low level during this process, the system evolves to state 2. At this point, the dominant cooperators gradually restore sufficient environmental resources, leading the system to evolve to state 3, where cooperators maintain their dominant position. Moreover, individuals tend to choose defection for higher payoffs, and defectors quickly occupy almost the entire system before the environmental resources are significantly depleted, reaching state 4. After this, the environmental resources are gradually consumed by the defectors, returning the system to state 1. The distributions of the four states in Fig. 1 are taken from consecutive periods of time after the simulation has stabilized. They are marked by four vertical red dashed lines in the time series of Fig. 1(j) in order from left to right. Figs. 2(a) and 2(b) illustrate the time series and phase space of the fraction of cooperators and the average resources of the system, respectively. In Fig. 2(b), the phase trajectory exhibits a periodic rotation within a region similar to an irregular rounded quadrilateral, the four vertices regions of the quadrilateral correspond to the four states described above (they are also shown more clearly in Fig. 1(j)). This behavior is analogous to the o-TOC dynamics described in Ref. [2]. Individuals tend to choose cooperation when resources are deficient and defection when resources are sufficient to maximize their immediate payoff. Additionally, the interplay between cooperators’ production and defectors’ consumption of resources drives the system through these cyclical states.
According to the myopic rule (see Eq. (4)), the probability of cooperation is not influenced by individuals’ previous strategies. Based on Eqs. (1) - (4), given the neighbors’ strategies and the total amount of resources available to the individuals, the individuals’ probability of cooperation can be calculated, as shown in Fig 3. The probability of choosing cooperation decreases as an individual’s available resources increase. Furthermore, an individual’s propensity to cooperate diminishes rapidly to nearly zero when the average resources of the system approaches a critical value determined by the number of cooperative neighbors (see Fig. 3). This mechanism further explains the observed oscillations: cooperators tend to defect when resources are sufficient or when there are fewer cooperative neighbors, while defectors are inclined to cooperate when resources are deficient or when more neighbors are cooperative. Thus, the system orderly cycles through the aforementioned four states: (, ), (, ), (, ), and (, ). Distributions at is shown in Figs. 2(c) and 2(d), clusters of cooperators and defectors appear, expand, and disappear rapidly and do not last.
III.2 Patterns and oscillations

When we keep the value of constant, an significant increase in the update rate of resources results in the disappearance of the previously observed persistent oscillations (see Figs. 2(a), 2(b), 2(e) and 2(f)). As shown in Figs. 2(e) and 2(f), after several periods, the system transitions from an oscillating transient state to an equilibrium state. In the time series, the amplitudes of the fluctuations rapidly decrease within a short period, eventually resulting in only minor fluctuations (see Fig. 2(e)). Following several periodic rotations, the phase trajectory gradually converges towards the center (see Fig. 2(f)). Figs. 2(g) and 2(h) display clustered patterns clearly in the spatial distributions of strategies and resources. We demonstrate that these clustered patterns account for the emergence of the equilibrium state. The oscillating state is transient; once spatial patterns begin to form, the amplitude of the time series gradually decreases. The duration of the oscillating transient state is unstable, and under the same parameters, different systems generate spatial clustered patterns and enter the equilibrium state at different rates. Additionally, spiral patterns appear at the beginning of the transformation process (see Figs. 4(a) and Figs. 4(b)). These spirals eventually couple and form clustered patterns, leading the system into an equilibrium state characterized by only slight fluctuations in the time series, caused by the movements and deformations of these clusters. In our simulations, oscillations did not significantly influence the average fraction of cooperators, given the same other parameters.

To further investigate the relations among parameters, patterns, and oscillations, we conducted several groups of simulations for varying values of and , some of which are shown in Figs. 2 and 5. When is sufficiently small, persistent oscillations occur without sustained spatial patterns (Figs.2(a) - 2(d)). Conversely, as increases, clustered patterns emerge and the system eventually reaches an equilibrium state (see Figs.2(e) - 2(h)). Further increases in result in smaller cluster sizes (see Figs.2(i) - 2(l)). By altering , we observe different spatial distributions, including variations in the sizes of clustered patterns (see Figs.5(e) - 5(l)), and even the absence of sustained spatial patterns (see Figs.5(a) - 5(d)). In summary, increasing the update rate of resources triggers a phase transition from random unsustained patterns to sustained clustered spatial patterns, leading the system from the oscillating state to an equilibrium state. And the critical value is influenced by other parameters (see Fig. 6).
As we mentioned before, the clustered patterns are not entirely static, slight fluctuations in the time series and phase trajectories occur due to the movements and deformations of the clusters. Clusters of cooperators tend to migrate to nodes with deficient resources, while clusters of defectors move to nodes with sufficient resources. Cooperators produce resources in deficient nodes, whereas defectors consume resources in sufficient nodes. This local feedback dynamic leads to a dynamic equilibrium throughout the system. As clusters of cooperators and defectors move, the overall density of cooperators remains constant, thereby maintaining a fixed level of average resources of the system. Consequently, when exceeds the critical value, clustered patterns form, and the system reaches the equilibrium state. Our findings also indicate that systems with smaller clusters reach equilibrium faster (see Figs. 2(e) - 2(l) and 5(e) - 5(l)). It is important to note that spiral patterns in the transition stage from the oscillating state to the equilibrium state are not clear in systems with smaller clusters. These spiral patterns are small in size and evolve quickly, making them difficult to recognize. Based on the aforementioned dynamic equilibrium mechanism, local feedback dynamics within smaller clusters occur in a more confined area, accelerating evolutionary dynamics and leading to a quicker attainment of equilibrium. It is important to note that the phase transition described above can only occur in systems with sufficiently large spatial scales (i.e., a sufficient number of nodes). The above conclusions remains robust despite parameter variations including the strength of cooperators in restoring the environment and the initial distributions of cooperators. And we also prove that the above conclusions remains robust when the noise does not significantly affect the system (i.e., around the value used in this work).
Compared to the works of Weitz et al. and Tilman et al.[2, 3], our model exhibits similar oscillating dynamics of the fraction of cooperators and the average resources in the system. The system cycles orderly through the four aforementioned states (see Fig. 1 and Sec. III.1). However, they used replicator dynamics to investigate the coevolutionary game dynamics with environmental feedback and ignored the influence of spatial heterogeneity. The transitions from oscillating states to stable states in their works were directly induced by changes in dynamic stability caused by payoff matrices and other parameters. In contrast, the phase transition from the oscillating state to the equilibrium state in our work is driven by self-organized spatial clustered patterns of cooperators, defectors, and resources in the system. Under specific parameter conditions (see Fig. 6), spatial clustered patterns emerge, and the system evolves to the equilibrium state.
Hassell et al. found that lattice structures, spiral waves, and spatial chaos patterns effectively maintain population persistence in the host-parasitoid system under conditions of spatial heterogeneity and local movement patterns[22]. Although our work does not exhibit identical phenomena, both our findings and theirs illustrate similar self-organized criticality in complex systems with spatial heterogeneity. When their impact on environmental resources is potent enough, individuals can form spatial structures, such as clustered patterns, to counteract the oscillatory tragedy of the commons. Previous studies of real-world ecosystems have indeed demonstrated similar relations between spatial patterns and system stability[4, 23, 24, 25, 26]. However, the stability of ecosystems is affected by many complex factors at the same time. Our model, which did not consider the diffusion of resources or external influences but only the interaction of individuals with resources within a certain range around themselves, focuses on the co-evolution of two strategies and heterogeneous environmental resources, making it a simpler model for studying self-organized criticality. Importantly, we directly prove that sustained spatial patterns contribute to the formation of dynamic equilibrium, which enhances the stability of individual-based complex systems. Moreover, the system parameters affect the size and specific distributions of the persistent clusters, with systems featuring small-sized clusters tending to reach the equilibrium state faster in our results(see Figs. 2 and 5). This further illustrates the significant impact of clustered patterns on stability.

As shown in Fig. 6, the critical value is correlated with . Each critical value is averaged over 50 repetitions. The standard deviations of the critical values are within acceptable limits. In the phase space of and , the region above the blue critical value curve is the equilibrium state region and the region below the curve is the oscillating state region. This figure further verifies the previous conclusion that, by keeping the value of constant while increasing the value of , the system transitions from the oscillating state to the equilibrium state. Within the range of (noting that is meaningless), the critical value initially increases and then decreases as increases. The maximum occurs at , where cooperators produce resources at the same rate that defectors consume them. As increases, the disparity between the rates of resource production by cooperators and consumption by defectors also increases, leading to a decrease in the critical value . Thus, systems more easily enter the equilibrium state when individuals of one strategy have a speed advantage in influencing resources over others.

For further analysis, we observed the average values of the fraction of cooperators and the average resources of the system across different values (see Fig. 7). The fraction of cooperators decreases rapidly as increases, while the average resources of the system remains relatively unchanged. This result suggests that individuals in the system tend to maintain environmental resources at an approximately fixed level, regardless of the proportion of cooperators and defectors, due to the parameter . In our model, defectors consistently consume resources at a constant rate, whereas cooperators produce resources at a rate proportional to . Consequently, the average variation of resources per MC step can be expressed as:
(9) |
Setting yields the fixed point for the fraction of cooperators:
(10) |
This theoretical prediction aligns well with the simulation results. Specifically, all the points representing the fraction of cooperators in the simulations fall on the curve given by (see Fig. 7).

Based on the results in Fig. 7 and Eq. 10, the parameter influences the average fraction of cooperators, with approximately representing the condition for an equal number of cooperators and defectors. Therefore, cooperators are the minority when , and they become the majority when . And the critical value of phase transition is also correlated to . Consequently, the fraction of cooperators is also a potential influencing factor for the critical value . Furthermore, when decreases sufficiently close to or even smaller (i.e., the cooperators are now producing resources at a significantly slower rate than the defectors are consuming them) and is sufficiently large, irregular block clusters form (see Figs. 8(c) and 8(d)), and the transition from the oscillating state to the equilibrium state occurs (see Figs. 8(a) and 8(b)). During the formation of these irregular block clusters, no spiral patterns are observed. Instead, block clusters appear sequentially and gradually occupy the system. This phenomenon further validates the previous conclusions that a significant disparity in the rate of environmental influence between cooperators and defectors directly generates clustered patterns and drives the system to evolve to the equilibrium state. The initial distributions of strategies and resources can indeed impact the critical value, which we will investigate further in the future study.
IV Conclusion
In this study, we investigate the co-evolution of individuals’ strategies and localized environmental resources in the Prisoner’s Dilemma Game model. Cooperators produce resources, while defectors consume them. Individuals update their strategies based on myopic rules[19, 20, 21], which are solely correlated to instantaneous payoffs determined by the resources in their vicinity and the strategies of their neighbors. Oscillations occur when the value of the update rate of resources is sufficiently small, the system cycles orderly through four states:(,), (,), (,), (,). Additionally, a phase transition from the oscillating state, which lacks sustained patterns, to the equilibrium state, which exhibits sustained clustered spatial patterns, occurs when exceeds the critical value . This result indicates that individuals can form spatial clustered patterns to counteract the oscillatory tragedy of the commons when their impact on resources is sufficiently potent. Remarkably, this phenomenon aligns with observations from previous real-world ecosystem studies, where systems with specific spatial structures can avoid the catastrophic outcomes of instability[4, 23, 24, 25, 26]. Importantly, we prove that sustained clustered spatial patterns directly enhance system stability, with clusters of different sizes exerting varying levels of influence. Furthermore, the critical value depends on the speed difference between the influence of cooperators and defectors on resources, governed by the value of . When those with the same strategy exert a more significant influence on resources than others, it becomes easier for all individuals to form spatial structures. The average fraction of cooperators is also influenced by , which makes it a potential factor affecting the critical value . In the future, we intend to further investigate the theoretical frameworks and the influence of initial distributions and other factors not discussed here.
Acknowledgements.
This work was supported by the National Natural Science Foundation of China (Grants Nos. 11475074, 11975111, 12047501 and 12247101) and by the Fundamental Research Funds for the Central Universities (Grant Nos. lzujbky-2024-11 and lzujbky-2019-85).References
- Hardin [1968] G. Hardin, Science 162, 1243 (1968).
- Weitz et al. [2016] J. S. Weitz, C. Eksin, K. Paarporn, S. P. Brown, and W. C. Ratcliff, Proc. Natl. Acad. Sci. U.S.A. 113, 10.1073/pnas.1604096113 (2016).
- Tilman et al. [2020] A. R. Tilman, J. B. Plotkin, and E. Akçay, Nat. Commun. 11, 915 (2020).
- Liu et al. [2014] Q.-X. Liu, P. M. J. Herman, W. M. Mooij, J. Huisman, M. Scheffer, H. Olff, and J. Van De Koppel, Nat. Commun. 5, 5234 (2014).
- Kéfi et al. [2008] S. Kéfi, M. v. Baalen, M. Rietkerk, and M. Loreau, Am. Nat. 172, E1 (2008).
- Kümmerli and Brown [2010] R. Kümmerli and S. P. Brown, Proc. Natl. Acad. Sci. U.S.A. 107, 18921 (2010).
- Halatek and Frey [2018] J. Halatek and E. Frey, Nat. Phys. 14, 507 (2018).
- Hilbe et al. [2018] C. Hilbe, Š. Šimsa, K. Chatterjee, and M. A. Nowak, Nature 559, 246 (2018).
- Su et al. [2019] Q. Su, A. McAvoy, L. Wang, and M. A. Nowak, Proc. Natl. Acad. Sci. U.S.A. 116, 25398 (2019).
- Bull and Rice [1991] J. Bull and W. Rice, J. Theor. Biol. 149, 63 (1991).
- Sachs et al. [2004] J. L. Sachs, U. G. Mueller, T. P. Wilcox, and J. J. Bull, Q Rev Biol 79, 135 (2004).
- Schardl and Clay [1997] C. L. Schardl and K. Clay, in Plant Relationships Part B, edited by G. C. Carroll and P. Tudzynski (Springer Berlin Heidelberg, Berlin, Heidelberg, 1997) pp. 221–238.
- Cheplick and Faeth [2009] G. P. Cheplick and S. Faeth, Ecology and Evolution of the Grass-Endophyte Symbiosis (Oxford University Press, 2009).
- Kleshnina et al. [2023] M. Kleshnina, C. Hilbe, Š. Šimsa, K. Chatterjee, and M. A. Nowak, Nat. Commun. 14, 4153 (2023).
- Huang et al. [2020] F. Huang, M. Cao, and L. Wang, J. R. Soc. Interface. 17, 20200639 (2020).
- Wang et al. [2021] G. Wang, Q. Su, and L. Wang, J. Theor. Biol. 527, 110818 (2021).
- Lin and Weitz [2019] Y.-H. Lin and J. S. Weitz, Phys. Rev. Lett. 122, 148102 (2019).
- Hauert et al. [2019] C. Hauert, C. Saade, and A. McAvoy, J. Theor. Biol. 462, 347 (2019).
- Sysi-Aho et al. [2005] M. Sysi-Aho, J. Saramäki, J. Kertész, and K. Kaski, Eur. Phys. J. B 44, 129 (2005).
- Chen and Wang [2009] X. Chen and L. Wang, Phys. Rev. E 80, 046109 (2009).
- Roca et al. [2009] C. P. Roca, J. A. Cuesta, and A. Sánchez, Eur. Phys. J. B 71, 587 (2009).
- Hassell et al. [1991] M. P. Hassell, H. N. Comins, and R. M. May, Nature 353, 255 (1991).
- Rietkerk et al. [2021] M. Rietkerk, R. Bastiaansen, S. Banerjee, J. Van De Koppel, M. Baudena, and A. Doelman, Science 374, eabj0359 (2021).
- Siteur et al. [2014] K. Siteur, E. Siero, M. B. Eppinga, J. D. Rademacher, A. Doelman, and M. Rietkerk, Ecol. Complex. 20, 81 (2014).
- Bastiaansen et al. [2018] R. Bastiaansen, O. Jaïbi, V. Deblauwe, M. B. Eppinga, K. Siteur, E. Siero, S. Mermoz, A. Bouvet, A. Doelman, and M. Rietkerk, Proc. Natl. Acad. Sci. U.S.A. 115, 11256 (2018).
- Bastiaansen et al. [2020] R. Bastiaansen, A. Doelman, M. B. Eppinga, and M. Rietkerk, Ecol. Lett. 23, 414 (2020).