Population dynamics from game theory