Inspiration

This project was inspired by classic arcade games where players navigate spaceships through asteroid fields. We wanted to see if an AI agent could learn to survive and dodge obstacles autonomously, using reinforcement learning to adapt its behavior in real time.

What it does

Asteroid AI is a reinforcement learning agent trained to navigate an asteroid field, avoiding collisions as it moves through dynamic obstacles. The agent learns through trial and error, improving its survival skills over hundreds of episodes. Once trained, it plays the game in real time, with a visual simulation showing its actions.

How we built it

  1. Environment: We created a custom asteroid environment using OpenAI Gym, defining a simple state and action space for the agent.
  2. Training: Implemented a Proximal Policy Optimization (PPO) agent using PyTorch, training it with a reward structure that encourages survival and penalizes collisions.
  3. Visualization: Used PyGame to render the agent’s actions and asteroid movement, allowing us to watch the trained agent dodge obstacles in real time.

Challenges we ran into

Balancing the training time with limited computational resources was challenging, as PPO can be resource-intensive. We also needed to fine-tune the reward structure to encourage effective learning, and integrating PyGame for smooth real-time visualization required careful handling of events and rendering.

Accomplishments that we're proud of

We're proud to have built an AI agent that can autonomously navigate a dynamic environment, learning to avoid obstacles effectively. Watching the trained agent perform well in the visual simulation was a rewarding accomplishment, demonstrating the power of reinforcement learning.

What we learned

We deepened our understanding of reinforcement learning concepts, specifically PPO, and learned how to design effective environments and reward structures to guide AI behavior. Additionally, we gained hands-on experience integrating PyGame for interactive visualization, adding a real-time, visual component to the project.

What's next for Asteroid AI

Future improvements include:

  • More complex environments with varied asteroid speeds and behaviors.
  • Additional actions like shooting asteroids to add strategy.
  • Enhanced visuals and smoother gameplay using PyGame, making the simulation more engaging.
  • Further tuning of the reward structure to refine agent behavior, potentially using more advanced RL techniques.

Built With

  • custom-gym-compatible-environments-**development-tools**:-jupyter-notebook-(for-prototyping-and-testing)
  • openai-gym-for-environment-setup
  • openaigym
  • ppo
  • pygame
  • pygame-for-visual-rendering-and-simulation-**technologies**:-reinforcement-learning-(proximal-policy-optimization)
  • python
  • pytorch
  • rl
  • vscode
Share this project:

Updates