(a) Although cooperation arose in all environments, it was only maintained at high proportions when resource was abundant. (b) In environments where cooperation was maintained, the average level of public good exceeded the threshold for survival imposed by the environmental disturbance events (3 units, dotted line). (c) These high levels of public good in resource-rich environments enabled populations to survive the majority of environmental disturbances. (d) As a result, populations in resource-rich environments maintained greater densities. When the cooperative task did not produce public good (open grey points), density did not change with resource abundance. For all panels, data shown are the averages among replicate populations at the end of simulations, and disturbance data are from the final 100 updates. Error bars indicate 95% confidence intervals.