This project explores emergent cooperation and competition in a multi-agent setting using Deep Q-Networks (DQNs) in the Atari Space Invaders environment, implemented via the PettingZoo library. It compares two architectures:
- Independent DQN (IDQN): Each agent has its own neural network and replay buffer.
- Shared DQN (SDQN): A single shared network governs the behavior of both agents.
space_invaders_independent_dqn.ipynbโ Main implementation and training using Independent DQNsspace_invaders_shared_dqn.ipynbโ Baseline using a shared DQN across both agents- Recorded gameplay videos
- Generated visualizations of agent behavior and cooperation metrics
To run this project, install the following Python packages:
pip install pettingzoo[atari] supersuit pygame imageio matplotlib torchFor training and video generation, we recommend using Google Colab with GPU enabled.
PettingZoo requires installation of Atari ROMs. Run this once to install:
AutoROM --accept-licenseThis will install ROMs for all Atari environments, including Space Invaders.
-
Colab Setup
Upload the desired notebook (independent_dqnorshared_dqn) to Google Colab. -
Enable GPU
Runtime โ Change runtime type โ Select GPU -
Install Dependencies (first cell)
Run the setup cell to install required packages. -
Train Agents
Execute all cells. Training will take ~30 minutes depending on the number of episodes. -
View Results
The notebook logs reward scores, cooperation index, sabotage events, and produces:- Learning curve plots
- Cooperation vs. competition metrics
- Recorded gameplay videos (MP4)
- Reward per episode (per agent)
- Cooperation Index: measures score similarity
- Bonus Events: counts +200 sabotage bonuses
- Shots Fired / Kills / Coexistence Time
agent_play.mp4โ Sample of trained agents playing- Visual comparison of strategies
- Trained for 35 episodes due to compute constraints.
- For longer training, increase
NUM_EPISODESand reduceRENDER_INTERVAL.
Based on:
- [Tampuu et al., 2017] Multiagent Cooperation and Competition with Deep RL (PLoS One)
- Mnih et al., 2015 (Nature) โ Original DQN paper
- PettingZoo & Supersuit documentation
For questions, refer to our full paper or reach out to the authors.
Team: Khushboo Patel, Uday Pothuri, Chanakya Nagareddy
Drexel University โ Spring 2025