|
--- |
|
language: en |
|
tags: |
|
- pygame |
|
- reinforcement-learning |
|
- dqn |
|
- game-ai |
|
license: mit |
|
datasets: |
|
- custom |
|
metrics: |
|
- accuracy |
|
- reward |
|
--- |
|
|
|
![](./screenshot.png) |
|
|
|
# Big Ball Game AI |
|
|
|
This model is a Deep Q-Network (DQN) agent trained to play "Big Ball Swallows Small Ball", a dynamic arcade-style game where the goal is to eat smaller balls while avoiding larger ones. |
|
|
|
## Model Description |
|
|
|
- **Input**: Game state vector (69 dimensions) containing: |
|
- Player position (x,y) |
|
- Player size |
|
- Hunger meter |
|
- Nearest 13 food items' information (position, size, distance, edibility) |
|
|
|
- **Architecture**: |
|
- Dueling DQN with Noisy Linear layers |
|
- Feature extraction: 2 fully connected layers (256 units each) |
|
- Value stream: 2 noisy linear layers (128 -> 1) |
|
- Advantage stream: 2 noisy linear layers (128 -> action_space) |
|
|
|
## Training |
|
|
|
- **Framework**: PyTorch 2.5.1 |
|
- **Training Data**: Generated through gameplay (~2000 episodes) |
|
- **Infrastructure**: CUDA-enabled GPU |
|
- **Training Time**: ~4 hours |
|
|
|
### Training Parameters |
|
|
|
```yaml |
|
episodes: 2000 |
|
max_steps: 1500 |
|
batch_size: 64 |
|
target_update: 100 |
|
gamma: 0.99 |
|
initial_epsilon: 1.0 |
|
final_epsilon: 0.01 |
|
``` |
|
|
|
## Performance |
|
|
|
The model achieves: |
|
|
|
* Average score: ~3000 points |
|
* Win rate: ~40% |
|
* Average survival time: 800 steps |
|
|
|
## Limitations |
|
|
|
* May get stuck in local optima (circular patterns) |
|
* Performance degrades with very large numbers of food items |
|
* Can be overly cautious with larger food items |
|
|
|
## Useage |
|
|
|
Visit [Github Repo](https://github.com/me0w00f/Big-Ball-Swallows-Small-Ball) |
|
|
|
# License |
|
This model is released under the MIT License. See the LICENSE file for details. |
|
|