Train an AI agent to play Noita β the physics-based roguelike β using reinforcement learning (PPO).
π― Goal: Teach an agent to navigate, fight, and survive in Noita's procedurally generated world using only pixel observations and game state data.
- PPO Training β Proximal Policy Optimization with custom reward shaping
- Lua-Python Bridge β Real-time communication between Noita's Lua mod and Python training loop via
pollnet.dll - Custom Environment β Gym-compatible wrapper with pixel observations, health, mana, and inventory state
- Episode Tracking β Automatic logging of rewards, deaths, and progression metrics
- CI/CD β Automated tests on every push
βββββββββββββββββββ pollnet.dll ββββββββββββββββββββ
β Noita Game β βββββββββββββββββββββββββββΊ β Python Trainer β
β (Lua Mod) β TCP / Shared β (PPO Agent) β
β β Memory β β
βββββββββββββββββββ ββββββββββββββββββββ
β β
βΌ βΌ
Game State Neural Network
- Pixel buffer - CNN encoder
- HP / Mana - Policy head
- Inventory - Value head
- Position - Reward shaping
- Python 3.10+
- Noita (Steam) β must be installed and launched at least once
- Windows (for
pollnet.dllintegration)
# Clone the repository
git clone https://github.com/yava-code/noitarl.git
cd noitarl
# Install dependencies
pip install -r requirements.txt
# Copy and configure environment
cp .env.example .env
# Edit .env with your Noita path and training settings# Start training
python train.py
# Evaluate a trained model
python eval.py --checkpoint checkpoints/latest.ptKey settings in config.py:
| Parameter | Default | Description |
|---|---|---|
NOITA_PATH |
Auto-detect | Path to Noita installation |
LEARNING_RATE |
3e-4 | PPO learning rate |
GAMMA |
0.99 | Discount factor |
BATCH_SIZE |
256 | Training batch size |
MAX_STEPS |
10_000_000 | Total training steps |
| Metric | Value |
|---|---|
| Episodes logged | See data/episode_history.csv |
| Best reward | Tracked in training logs |
| Checkpoints | Saved to checkpoints/ |
noitarl/
βββ train.py # Main training script
βββ eval.py # Evaluation script
βββ config.py # Configuration parameters
βββ callbacks.py # Training callbacks & logging
βββ init.lua # Noita Lua mod (game-side)
βββ bin/
β βββ pollnet.dll # Lua-Python communication library
βββ data/
β βββ episode_history.csv # Episode metrics
β βββ schemas/ # Game state XML schemas
βββ docs/
β βββ lua_api_documentation.txt
β βββ component_documentation.txt
β βββ Noita-ModdingAgreement-v100.rtf
βββ .github/workflows/
β βββ tests.yml # CI pipeline
βββ ROADMAP.md # Development roadmap
See ROADMAP.md for the full development plan.
Current priorities:
- Improve reward shaping for exploration
- Add multi-objective training (survival + progression)
- Implement curriculum learning
- Add wandb integration for experiment tracking
Contributions are welcome! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
- Noita by Nolla Games β incredible game with amazing modding support
- Stable Baselines3 β RL framework
- pollnet β Lua-Python communication library
Made with β€οΈ and a lot of dead agents