Browser-Based Multiplayer Game with AI-Powered Opponents

#Svelte#Golang#Python#Tailwind#Canvas

Reinforcement Learning in Action: A Snake Game with AI Opponents

Thesis Paper

My high school thesis project took me deep into the world of reinforcement learning (RL). I set out to build a multiplayer snake game where AI bots would learn to compete against human players. This ambitious undertaking allowed me to combine my programming skills in Python, Golang, and Svelte with the exciting field of AI development.

The core of the project involved creating a fully functional snake game accessible through a user-friendly web interface built with Svelte, HTML, CSS, and TypeScript. At its heart, a robust server written in Golang handled all the game logic and communication between players.

But the real challenge lay in training the AI bots. I turned to Python and the Stable Baselines 3 library to implement deep reinforcement learning algorithms. These algorithms allowed the AI agents to learn strategies for navigating the game and outsmarting human opponents through trial and error, ultimately becoming capable competitors within the virtual snake arena.

Game Architecture

Game Architecture of the Snake Game

Game Starting Page

Starting Page of the Snake Game

Solo Gameplay

Solo Gameplay of the Snake Game

The project culminated in a platform where human players could directly engage with AI opponents trained through RL, creating a truly interactive and engaging experience.

The project aimed to develop AI bots that can play a multiplayer game with minimal training time. The project consisted of three primary components: a web client, a game server, and a training script. These components worked together to provide a seamless gaming experience for players while also enabling the training of AI bots.

Recognition

This work earned recognition with an award from Endress+Hauser and a Maturarbeitsprämierung, underscoring its academic merit and practical application. Looking back, this thesis project served as a crucial stepping stone in my journey towards mastering AI development.