Update README.md
#1
by
weepingdogel
- opened
README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- pygame
|
| 5 |
+
- reinforcement-learning
|
| 6 |
+
- dqn
|
| 7 |
+
- game-ai
|
| 8 |
+
license: mit
|
| 9 |
+
datasets:
|
| 10 |
+
- custom
|
| 11 |
+
metrics:
|
| 12 |
+
- accuracy
|
| 13 |
+
- reward
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Big Ball Game AI
|
| 18 |
+
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
## Model Description
|
| 22 |
+
|
| 23 |
+
- **Input**: Game state vector (69 dimensions) containing:
|
| 24 |
+
- Player position (x,y)
|
| 25 |
+
- Player size
|
| 26 |
+
- Hunger meter
|
| 27 |
+
- Nearest 13 food items' information (position, size, distance, edibility)
|
| 28 |
+
|
| 29 |
+
- **Architecture**:
|
| 30 |
+
- Dueling DQN with Noisy Linear layers
|
| 31 |
+
- Feature extraction: 2 fully connected layers (256 units each)
|
| 32 |
+
- Value stream: 2 noisy linear layers (128 -> 1)
|
| 33 |
+
- Advantage stream: 2 noisy linear layers (128 -> action_space)
|
| 34 |
+
|
| 35 |
+
## Training
|
| 36 |
+
|
| 37 |
+
- **Framework**: PyTorch 2.5.1
|
| 38 |
+
- **Training Data**: Generated through gameplay (~2000 episodes)
|
| 39 |
+
- **Infrastructure**: CUDA-enabled GPU
|
| 40 |
+
- **Training Time**: ~4 hours
|
| 41 |
+
|
| 42 |
+
### Training Parameters
|
| 43 |
+
|
| 44 |
+
```yaml
|
| 45 |
+
episodes: 2000
|
| 46 |
+
max_steps: 1500
|
| 47 |
+
batch_size: 64
|
| 48 |
+
target_update: 100
|
| 49 |
+
gamma: 0.99
|
| 50 |
+
initial_epsilon: 1.0
|
| 51 |
+
final_epsilon: 0.01
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
## Performance
|
| 55 |
+
|
| 56 |
+
The model achieves:
|
| 57 |
+
|
| 58 |
+
* Average score: ~3000 points
|
| 59 |
+
* Win rate: ~40%
|
| 60 |
+
* Average survival time: 800 steps
|
| 61 |
+
|
| 62 |
+
## Limitations
|
| 63 |
+
|
| 64 |
+
* May get stuck in local optima (circular patterns)
|
| 65 |
+
* Performance degrades with very large numbers of food items
|
| 66 |
+
* Can be overly cautious with larger food items
|
| 67 |
+
|
| 68 |
+
## Useage
|
| 69 |
+
|
| 70 |
+
Visit [Github Repo](https://github.com/me0w00f/Big-Ball-Swallows-Small-Ball)
|
| 71 |
+
|
| 72 |
+
# License
|
| 73 |
+
This model is released under the MIT License. See the LICENSE file for details.
|