Home▸Board Games & Game Mathematics▸Public Goods Game & Cooperation (2D)

🤝 Public Goods Game & Cooperation (2D)

Run N players through repeated public-goods rounds on a live 2D chart: set the multiplier and endowment, switch strategy modes, and watch contributions, payoffs and cooperation evolve round by round.

Board Games & Game Mathematics2DEasy60 FPS📱 Mobile-adapted⇄ 3D version
2d-public-goods-game ↗ Open standalone

How it Works

In the public goods game, each of N players receives an endowment E and privately chooses a contribution ci ∈ [0, E]. Total contributions are multiplied by r and divided equally: every player receives r·ΣC/N regardless of their own contribution.

Payoff for player i is: πi = (E − ci) + r·Σjcj/N. The dominant strategy is ci = 0 (free-ride), giving Nash equilibrium payoff = E. If everyone cooperates fully (c = E), each gets r·E — more than E whenever r > 1. The social optimum needs r > 1, but individual rationality pulls toward 0.

Payoff: pi_i = (E - c_i) + r * Sum_j c_j / N Nash equilibrium: c_i* = 0 for all i (when r < N) Nash payoff: pi_NE = E Social optimum: c_i = E, pi_SO = r*E Price of anarchy: r*E / E = r With punishment (cost 0.3 to reduce a free-rider by 1.0): Punisher payoff loses 0.3 per non-cooperator punished Free-rider payoff loses 1.0 per punisher acting on them Cooperation is stable when the punishment ratio outweighs (N-1)

In Evolutionary mode, each round every player observes one random peer and imitates their contribution level if that peer earned more — a simple replicator-dynamics rule. In Punishment mode, a subset of cooperators pay a personal cost to dock free-riders, which can flip enough of them into cooperating that the population average climbs over time.

⚙ Under the hood

Run N players through repeated public-goods rounds on a live 2D chart: set the multiplier and endowment, switch between rational free-riding, mixed, full cooperation, costly punishment and evolutionary imitation, and watch contributions, payoffs and the cooperator share evolve round by round.

game theorypublic goods gamecooperationfree riderNash equilibrium

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)