Back to projects
Jun 05, 2026
2 min read

Flappy Bird AI Agent using Deep Reinforcement Learning

PyTorch-based Deep Q-Network (DQN) agent trained with a 12-dimensional game-state representation and experience replay.

An autonomous reinforcement learning agent developed in PyTorch that masters the game of Flappy Bird through Deep Q-Networks (DQN), reward engineering, and continuous exploration-exploitation tuning.

Key Highlights & Features

  • State Representation & Action Space: Designed a 12-dimensional continuous state vector capturing critical kinematic metrics (player velocity, vertical distance to pipes, gap distances, next pipe coordinates) paired with a 2-action discrete action space (Flap or Do Nothing).
  • Deep Q-Network Architecture: Implemented a multi-layer deep neural network with target-network synchronization to stabilize Q-value estimation and prevent policy divergence.
  • Experience Replay & Exploration: Utilized prioritized experience replay buffer to break correlation between sequential frames and applied an epsilon-greedy decay strategy for effective exploration.
  • Training Pipeline & Observability: Integrated reward tracking, loss monitoring, model checkpointing, and customizable hyperparameters via configuration files for iterative experimentation.

Tech Stack

  • Frameworks & Libraries: PyTorch, Gymnasium, NumPy, Matplotlib
  • RL Techniques: Deep Q-Networks (DQN), Experience Replay, Target Networks, Epsilon-Greedy Exploration