Fruit Ninja AI Bot - YOLOv8
An automated computer vision bot capable of playing the classic game Fruit Ninja in real-time, utilizing a custom-trained YOLOv8 object detection model to slice fruits and avoid bombs.
This project demonstrates a fun and practical application of real-time computer vision by creating an AI bot capable of autonomously playing the classic game "Fruit Ninja". The core intelligence of the system relies on the state-of-the-art YOLOv8 object detection model. The model was custom-trained using a tailored dataset of in-game fruits and bombs sourced from Roboflow to ensure high accuracy within the game's specific visual environment. The bot operates through a continuous, high-speed loop: it captures the game screen in real-time using mss, passes these frames through the trained YOLOv8 model to identify coordinates, and executes a smart filtering algorithm. This algorithm ensures the bot targets safe fruits while strictly calculating paths to avoid slicing bombs. Finally, PyAutoGUI is utilized to simulate rapid, precise mouse movements and clicks, effectively executing the "slicing" action on the screen.
Technologies Used
Key Features
- Real-Time Object Detection: Rapidly identifies objects on the screen using the highly optimized YOLOv8 architecture.
- Custom Trained Model: Utilizes a specifically curated dataset from Roboflow for accurate in-game asset recognition.
- Smart Bomb Avoidance: Implements logic to filter out dangerous coordinates, ensuring the bot doesn't hit bombs.
- Automated Input Simulation: Translates detection coordinates into precise mouse drag events via PyAutoGUI.
- Custom Trained Model: Utilizes a specifically curated dataset from Roboflow for accurate in-game asset recognition.