Skip to content

Commit f8a5b49

Browse files
committed
docs: add dev env setup to bot-development.md
1 parent 4869ebe commit f8a5b49

File tree

1 file changed

+47
-10
lines changed

1 file changed

+47
-10
lines changed

docs/bot-development.md

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This guide teaches you how to create custom bots for Balatro using the Balatrobo
66

77
Balatrobot allows you to create automated players (bots) that can play Balatro by implementing decision-making logic in Python. Your bot communicates with the game through a socket connection, receiving game state information and sending back actions to perform.
88

9-
A bot is essentially a Python class that inherits from the `Bot` base class and implements specific methods that get called at different points during gameplay. The framework uses a modern **ActionSchema** API that returns structured dictionaries instead of plain lists, making the code more readable and type-safe.
9+
A bot is essentially a Python class that inherits from the `Bot` base class and implements specific methods that get called at different points during gameplay. The framework uses an **ActionSchema** API that returns structured dictionaries, making the code readable and type-safe.
1010

1111
## Key Concepts
1212

@@ -15,6 +15,49 @@ A bot is essentially a Python class that inherits from the `Bot` base class and
1515
- **Actions Enum**: Predefined action types your bot can perform
1616
- **Type Safety**: Modern Python type hints ensure your bot is robust and maintainable
1717

18+
## Development Environment Setup
19+
20+
The Balatrobot project provides a complete development environment with all necessary tools and resources for building bots.
21+
22+
### Bot File Location
23+
24+
When creating new bots, place your files in the `bots/` directory using one of these recommended patterns:
25+
26+
- **Single file bots**: `bots/my_new_bot.py`
27+
- **Complex bots**: `bots/my_new_bot/main.py` (for bots with multiple modules)
28+
29+
Both approaches are considered best practices and allow for easy organization and discovery of your bot implementations.
30+
31+
### Pre-configured Development Environment
32+
33+
The project comes with a fully configured Python development environment:
34+
35+
- **Python Virtual Environment**: Pre-installed with the balatrobot package and all dependencies
36+
- **Code Quality Tools**: Linting, type checking, and formatting configured in `pyproject.toml`
37+
- **Continuous Integration**: Working CI pipeline ensures code quality standards
38+
39+
### Available Documentation and Resources
40+
41+
The repository contains extensive documentation and reference materials:
42+
43+
- **Comprehensive API Documentation**: Complete guides for bot development and API usage
44+
- **Steamodded Wiki**: Included as a git submodule (clone with `--recurse-submodules` for LLM-friendly context)
45+
- **Source Code Access**: Full balatrobot Python source code and Lua implementation for reference
46+
- **Example Implementations**: Working bot examples to learn from and build upon
47+
48+
!!! tip "Enhanced LLM Development Experience"
49+
This rich documentation ecosystem is particularly beneficial when working with Large Language Models (LLMs) for bot development. The complete source code, comprehensive documentation, and Steamodded wiki provide extensive context that helps LLMs understand the framework and generate more accurate, contextually-aware code suggestions.
50+
51+
### Getting Started
52+
53+
To begin developing your bot:
54+
55+
1. Navigate to the `bots/` directory
56+
2. Create your bot file using the recommended naming convention
57+
3. Use the existing Python environment (balatrobot is already installed)
58+
4. Leverage the code quality tools and CI pipeline for professional development
59+
5. Reference the extensive documentation and source code for guidance
60+
1861
## Creating Your First Bot
1962

2063
Let's examine a complete example bot to understand how to implement your own:
@@ -106,7 +149,7 @@ if __name__ == "__main__":
106149

107150
## ActionSchema Format
108151

109-
The new API uses a consistent format for all actions:
152+
The ActionSchema API uses a consistent format for all actions:
110153

111154
```python
112155
# ActionSchema structure
@@ -160,9 +203,6 @@ def __init__(
160203

161204
All bot methods receive an `env` parameter containing the current game state. The game state contains all information about the current situation, including cards in hand, jokers, consumables, blind information, and more.
162205

163-
!!! note
164-
For detailed information about the game state structure, see the [Game State Reference](game-state.md) page.
165-
166206
**skip_or_select_blind(env)**
167207

168208
Called when the bot needs to choose whether to skip or select a blind.
@@ -217,7 +257,7 @@ def select_cards_from_hand(self, env: dict[str, Any]) -> ActionSchema:
217257
- `Actions.PLAY_HAND` - Play specified cards as a poker hand
218258
- `Actions.DISCARD_HAND` - Discard specified cards to draw new ones
219259

220-
!!! tip
260+
!!! warning 1-based indices
221261
Card indices are 1-based (first card is 1, not 0). You can access hand information through `env['hand']` to make intelligent decisions.
222262

223263
**select_shop_action(env)**
@@ -583,9 +623,6 @@ Once you have a basic bot working:
583623
3. **Test Different Scenarios**: Try different decks, stakes, and seeds
584624
4. **Debug and Iterate**: Use the game state cache to analyze decisions
585625

586-
!!! tip
587-
The best way to learn is by experimenting! Start with the basic template and gradually add features as you understand the game better.
588-
589626
---
590627

591-
*Ready to create more advanced bots? Check out the [API Protocol Reference](api-protocol.md) for detailed about Lua socket API.*
628+
*Ready to create more advanced bots? Check out the [API Protocol Reference](api-protocol.md) for detailed about Lua socket API.*

0 commit comments

Comments
 (0)