Inspiration

Ever since RL conquered Atari and old 16-bit games, it has been inextricably linked to video games. Moreover, projects like AlphaGo and AlphaStar continued to push the boundaries of what we thought AI was truly capable of.

AlphaGO

In a world where multiplayer games often follow predictable patterns, we sought to create a truly dynamic experience that adapts to player strategies. We were inspired by the concept of AI that learns and evolves, much like players do. The idea of a snake game where the AI grows stronger with each encounter sparked our imagination, leading us to envision a game that not only challenges players but also provides an opportunity for continuous growth and adaptation. Our goal was to create a competitive yet cooperative environment where players could engage in strategic gameplay.

To do this we leverage Proximal Policy Optimization or PPO. This algorithm improves upon traditional policy gradient methods by balancing simplicity, efficiency, and performance. It alternates between sampling data through interaction with the environment and optimizing a "surrogate" objective function using stochastic gradient ascent. PPO introduces a novel objective function that allows multiple epochs of updates while avoiding large, destabilizing policy updates.

PPO

PPO Math

What it does

Recoil is an arcade-style snake game designed for two players. One player controls a snake competing against a Reinforcement Learning AI snake, while the second player only observes the first player and competes against them directly. The AI adapts and retrains itself each time the first player loses a life, creating an evolving challenge. This setup allows for unique gameplay dynamics, as the second player must strategize to outmaneuver the first player, while the first player focuses on overcoming the AI. The blend of competition and observation makes for an engaging gaming experience.

How we built it

React/Next.js, P5.js, TailwindCSS, Flask, Python, Pytorch, Stable Baselines

Challenges we ran into

The primary challenge we faced was integrating the various components developed by each team member while managing the tight time constraints. Additionally, incorporating the reinforcement learning model we created into the arcade game presented its own set of complexities. Because of the various hyperparameters described in the model, much time was spent running and testing the AI before any significant progress was made.

Accomplishments that we're proud of

We are very proud of our pixel art and vibrant arcade themes portrayed in the characters and responsive, animated assets.

What we learned

We gained experience in implementing machine learning concepts within a game framework, which deepened our understanding of both AI and game development. This project reinforced the significance of iterative development and testing, as we continually refined our game mechanics based on feedback and gameplay testing. Ultimately, we came out of this with enhanced technical skills and a stronger appreciation for the complexities of building a multiplayer game.

What's next for Recoil

In the future, it would be nice to add more functionality to the game, such as a leaderboard feature to make it feel more competitive against the AI. We think it would also be cool to implement more variety in the food the snakes eat, such as power-ups.

Built With

Share this project:

Updates