Copyright 2024 @eforce67/neonshark
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This Brawl Stars AI project aims to develop a continuous-time recurrent neural network made using neuroevolution to create a model that can efficiently play the popular FPS game, Brawl Stars. This project leverages various libraries and technologies to achieve its goal. Learn more about the project via the wiki
To run the project, ensure you have the following libraries installed:
pip install graphviz matplotlib neat-python numpy opencv-python pillow pywin32 pynput ultralytics pyyaml
To start the program, I suggest you run train.py first to start training your first neural network. If you already have a model from a generation that you want to load from, in settings.yaml set load_training to your model path folder location. Learning more here:
The input nodes consist of the following information that will be given to the model:
0
: Victory status 0 = None 1 = True1
: Defeat status 0 = None 1 = True2
: Draw status 0 = None 1 = True3
: Respawn status 0 = None 1 = True4
: Shot success 0 = None 1 = True5
: Damage taken 0 = None 1 = True6
: Nearest visible enemy 0 = None 1 = enemy distance7
: Super ability status 0 = None 1 = True8
: Hypercharge status 0 = None 1 = True9
: Gadget status 0 = None 1 = True10-17
: Closest 8 walls to the player (These inputs might be removed in the future due to frequent changes by Supercell. Ideally, the AI model should learn the map even without computer vision capabilities.)Here's a demo representing objects near the player:
The script currently draws a line from the player to objects like enemies, gems, and walls. In special cases like the enemy and gem, if a line drawn from the player straight to the enemy intersects a rectangle/square-shaped wall, the intersect function will return false true, meaning we shouldn't shoot or walk straight towards the wall.
The output nodes represent possible actions the AI agent can take:
The project utilizes YOLOv8, a state-of-the-art object detection model by Ultralytics, to detect objects in the Brawl Stars environment. The fine-tuned YOLOv8 model supports the following objects: