Using game theory to explain how institutions arise to manage limited resources