Evolution of altruistic punishment in heterogeneous populations

The script below (open script in separate tab) shows the effect of heterogeneity in the ability to punish on the ability of altruistic behaviour to stabilize in a voluntary public goods game with punishment. These effects are shown for two different types of populations in the form of a simplex. Each dot in the simplex represents a simulation with a different initial situation. The location of the dot shows the initial proportions of strategies in the population. The closer the dot is to one of the corners, the higher the initial proportion of loners (L), altruistic non-punishers (AN), selfish non-punisher (SN) or altruistic punishers (AP) in the population. For example, the dot closest to the L corner represents the simulation in which almost the entire population consisted of loners, which refuse to play the game. The color and brightness of each dot indicates the fate of the population as a whole.
The JavaScript on this website makes use of HTML5.

To show the effects of heterogeneity, the population is divided into two classes that can differ in the cost they pay to punish others for their selfish behaviour, as well as the effectiveness of their punishment (i.e. the cost selfish individuals pay for being punished). In a population of homogeneous classes, individuals pay the same cost to punish, and punishing has the same effectiveness for each individual. Heterogeneous effectiveness indicates that while all individuals pay the same cost to punish, one class of individuals inflicts more punishment on the punished individuals. Heterogeneous cost indicates the exact opposite case, in which all individuals inflict the same cost upon punished individuals, but one class of individuals pays a lower cost to do so.

A population can show heterogeneity in both cost and effectiveness in two different ways. For example, the population may have a subclass that is better suited to administer punishment. Such a class would pay a low cost for high effectiveness, while other individuals would pay a higher cost for a less effective punishment. On the other hand, classes may differ in the intensity of the punishment. That is, while some individuals would pay a low cost for low effectiveness, others would pay a higher cost, but also inflict more effective punishment. The results in this script show how these differences affect what individuals end up inflicting punishment and second-order freeriding.

Infinite and well-mixed population

In the infinite and well-mixed population, individuals play each public goods game with randomly selected co-players. After the game, these players will never each other again. In particular, this means that altuistic punishers would never see the benefits of their own punishing behavior. Bright dots indicate that for a particular initial configuration, the entire population eventually is altruistic. That is, at some point the entire population contributes to the public good. Dark gray dots, on the other hand, indicate that selfish behaviour persists in the population.

Light gray dots indicate that the entire population eventually turns out to be altristic, but also that only those individuals who pay a low cost to punish actually punish. Everyone contributes to the public good, and only individuals that can punish cheaply make sure that selfishness is appropriately punished. It is important to note here that these individuals do not know in which class they are.

Lattice-based population

In the lattice-based population, individuals only play the public goods game in specific groups. Each individual is part of five different groups, and only plays the game with the members of those groups. In this scenario, the brightness of the dots indicates how much of the population eventually becomes altruistic. Bright white dots show that the entire population contributes to the public good, while black dots indicate that everybody refuses to play the game.

The color of a dot indicates how punishers are distributed across the classes. When a dot is red, this means that punishers are mostly those individuals that pay the least for punishing. Blue dots, on the other hand, show that punishment is done mostly by the individuals that inflict the most effective punishment. The brighter the color of a dot, the higher the difference: a gray dot shows that on average, punishers are uniformly distributed across classes. In the homogeneous classes case, all individuals pay the same cost to punish, and punishment is equally effective for all individuals. In this case, red and blue indicate different classes.


Since the results are shown in a three-dimensional figure, the full extent of the results are not immediately visible. Also, the combination of brightness and color may make some of the results harder to determine. The following controls are available:

  • Up arrow or left arrow: Move the slice plane backwards.
  • Down arrow or right arrow: Move the slice plane forwards.
  • Page up: Move the slice plane backwards ten steps.
  • Page down: Move the slice plane forwards ten steps.
  • C or S: Toggle the display of color.
  • B or V: Toggle the display of brightness.

An older version of the script on this page is available as a Java applet. However, for security reasons, many browsers no longer allow Java applets to be run from a web browser. The applet can be still be downloaded for offline use.