Markov Games
One MDP with many deciders. Next state and each reward depend on the full joint action, so agents must settle on mutual best responses.
Why Does This Exist?
A single agent MDP assumes the world sits still while you learn. Transition and reward depend only on your action. That lets greedy value iteration work.
Teams break the assumption. With agents the next state depends on the joint vector . From one agent view the world shifts as peers update, so old replay no longer matches current dynamics. Greedy max over your own actions is not defined, because payoff depends on simultaneous peer picks.
Markov games fix the math. Shapley named them stochastic games in 1953, Littman brought them to RL in 1994. They keep states, add joint actions, and replace solo max with equilibrium. This page covers the model and the equilibrium idea. Team training methods live in multi-agent RL. Environment types live in cooperative versus competitive environments. Solo baselines that ignore coupling live in independent Q-learning.
The one idea you need first
An MDP has states , actions , transitions , rewards , discount . Value is expected discounted return from . A Markov game keeps all of that and swaps solo for joint , with one reward head per agent.
Think of It Like This
Four cars at a crossing with no lights
You practice alone on a closed track. Turn right 30 degrees at 40 speed and you land in the right lane every time. The track never reacts.
Now put four cars at a crossing with no lights. Your next position depends on all four pedals at once. You go while cross traffic goes and you meet in the middle. You both stop and you wait forever. You go while they wait and all pass.
You cannot solve it by treating cars as rocks. You need a shared rule where no driver gains by swerving alone. That stalemate is the equilibrium the math below defines.
Where it stops: drivers use eyes and horns. Game agents use policies and matrix solvers, not social cues.
How It Actually Works
A Markov game lists agents , shared states , one action set per agent , joint set , joint transitions , one reward function per agent , and discount in .
Each agent holds policy . Joint policy factorizes as product of locals under decentralized choice:
Value for agent is expected discounted sum under the joint policy:
Joint action value follows the team Bellman form:
In words: immediate team reward plus discounted next state value, where next state depends on all actions at once.
Nash replaces max
Joint policy is Nash when no agent gains by leaving alone. For every agent , state , and alternative :
Zero sum pairs have one value solvable by linear programming. Shared reward teams reduce to joint maximization. General sum games can hold many equilibria, and finding one is hard in general, which is why large systems use sampling and centralized critics instead of exact solves.
Worked example
Two agents share start and terminal goal with . Agent 1 picks or . Agent 2 picks or . Discount . Current guess .
Payoffs and moves:
- Pair goes to with reward each.
- Pair stays at with reward each.
- Pair stays at with reward each.
- Pair goes to with reward each.
Joint values for agent 1 by Bellman backup:
Agent 2 shares the same numbers here, so the state holds a symmetric 2 by 2 game:
- pays .
- pays .
- pays .
- pays .
Pure best responses: against , beats because tops . Against , beats for the same reason, so is Nash. Against , beats because tops . Against , beats , so is also Nash. One pays , the other pays .
Mixed mixing makes the peer indifferent. Let agent 1 play with chance . Agent 2 earns from and from . Equalize:
Symmetry gives for . Mixed value is , below both pure points. Coordination on lifts state value from to . That is what the diagram draws.
Code
This snippet rebuilds the four joint values and the mixing chance with plain Python.
def q_value(reward: float, gamma: float, v_next: float) -> float: return reward + gamma * v_next
qs = { "UL": q_value(4.0, 0.90, 0.0), "UR": q_value(0.0, 0.90, 2.0), "DL": q_value(0.0, 0.90, 2.0), "DR": q_value(2.0, 0.90, 0.0),}print([round(qs[k], 2) for k in ["UL", "UR", "DL", "DR"]]) # -> [4.0, 1.8, 1.8, 2.0]
p = 0.20 / 2.40print(round(p, 4)) # -> 0.0833print(round(1.80 + 2.20 * p, 4)) # -> 1.9833Outputs match the hand math: four joint values , mixing chance , mixed value .
Watch Out For
Running solo Q-learning on a team game
Treating peers as fixed noise and learning looks simple and oscillates. Peer policies shift the effective transition every epoch, so old replay misleads the update. Policies chase each other and never settle.
Model the joint action during training. Use a central critic on , or an explicit peer model, or an equilibrium backup for tiny matrix games. Keep solo Q only for truly fixed peers.
Assuming one equilibrium
General sum games often hold several Nash points with different payoffs, here versus versus mixed. An algorithm can lock onto the safe low point while a better joint point exists.
Check which equilibrium your update found. Seed joint exploration toward the high payoff pair, log which pair the team actually plays, and do not report mixed value as if it were the coordinated value.
The Quick Version
- A Markov game swaps solo action for joint vector in transitions and rewards.
- Solo max is invalid because payoff depends on simultaneous peer picks.
- Nash means no agent gains by deviating alone while peers stay fixed.
- In the worked 2 by 2 game, joint values are , , , with pure Nash at and .
- Mixing chance gives mixed value , below coordinated play at .