How jayanad/rl_flappy_bird works
This repository implements a Deep Q-Network agent for Flappy Bird, plus a separate keyboard-controlled game runner. In training, the agent loads a hyperparameter set, interacts with the Gymnasium environment, stores transitions in replay memory, and uses sampled batches to update its policy and target networks. It saves the best policy and a reward log; evaluation loads the saved policy and plays with rendering enabled. The sampled source establishes these connections; no README content was provided.
Main entry points: agent.py DQN agent · game.py Keyboard game runner · dqn.py Q-network · experience_replay.py Replay memory
Components 11
Agent learning
- DQN agent
agent.py - Q-network
dqn.py - Replay memory
experience_replay.py - PyTorch optimizer
Game interaction
- Keyboard game runner
game.py - Flappy Bird environment
- Pygame input/render
Settings and artifacts
- Hyperparameters
parameters.yaml - Saved policy
- Training log
Other components
- User
Connections 14
- User → DQN agent: selects mode
- DQN agent → Hyperparameters: reads settings
- DQN agent → Flappy Bird environment: resets and steps
- Flappy Bird environment → DQN agent: returns observations
- DQN agent → Q-network: evaluates policy
- DQN agent → Replay memory: stores transitions
- DQN agent → Replay memory: samples batches
- DQN agent → Q-network: updates networks
- DQN agent → PyTorch optimizer: optimizes policy
- DQN agent → Saved policy: loads or saves policy
- DQN agent → Training log: writes best reward
- User → Keyboard game runner: starts and controls
- Keyboard game runner → Pygame input/render: reads input and renders
- Keyboard game runner → Flappy Bird environment: resets and steps