Skip to content

Commit fb7db5d

Browse files
Add Python Bot API package configuration: build tooling, PyPi metadata, and updated documentation.
1 parent f7122ce commit fb7db5d

File tree

7 files changed

+191
-3
lines changed

7 files changed

+191
-3
lines changed

bot-api/python/MANIFEST.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
include VERSION requirements.txt
1+
include VERSION
2+
include PyPi-ReadMe.md
3+
include requirements.txt
4+
recursive-include generated/robocode_tank_royale/tank_royale/schema *.py

bot-api/python/PyPi-ReadMe.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Robocode Tank Royale - Python Bot API
2+
3+
<img src="https://github.com/robocode-dev/tank-royale/raw/master/gfx/Logo/Robocode-logo.svg" width="220" alt="Robocode logo">
4+
5+
**Build the best - destroy the rest!**
6+
7+
The **Python Bot API** for [Robocode Tank Royale](https://robocode-dev.github.io/tank-royale/) - the next evolution of the classic Robocode programming game where you code virtual tanks to battle against each other in a virtual arena.
8+
9+
## About Robocode Tank Royale
10+
11+
Robocode is a programming game where the goal is to code a bot in the form of a virtual tank to compete against other bots in a virtual battle arena. The player is the programmer of a bot, who will have no direct influence on the game. Instead, you must write a program with the logic for the brain of the bot containing instructions about how it should behave during battles.
12+
13+
**Tank Royale** is the next generation of Robocode that supports:
14+
- Network-based battles via WebSocket connections
15+
- Multiple programming languages and platforms
16+
- Modern architecture and improved performance
17+
- Real-time multiplayer battles
18+
19+
## Installation
20+
21+
Install the Python Bot API using pip:
22+
23+
```shell
24+
pip install robocode-tank-royale
25+
```
26+
27+
### Requirements
28+
- **Python 3.10 or higher**
29+
- WebSocket support (automatically handled by dependencies)
30+
31+
## Quick Start
32+
33+
Check out the complete **MyFirstBot** example on GitHub:
34+
35+
**📁 [MyFirstBot.py](https://github.com/robocode-dev/tank-royale/blob/master/sample-bots/python/MyFirstBot/MyFirstBot.py)**
36+
37+
This sample bot demonstrates:
38+
- Basic movement (forward/backward)
39+
- Gun rotation and targeting
40+
- Event handling (scanned bot, hit by bullet)
41+
- Async/await programming pattern
42+
43+
The bot moves in a seesaw motion, spins its gun to scan for enemies, and fires when it spots another bot.
44+
45+
## Features
46+
47+
The Python Bot API provides:
48+
49+
- **Full Bot Control**: Move your tank, rotate gun and radar, fire bullets
50+
- **Event Handling**: Respond to hits, bot scanned, bullet impacts, and more
51+
- **Battle Information**: Access to battle state, opponent positions, and game rules
52+
- **Debugging Support**: Built-in debugging and logging capabilities
53+
- **Modern Python**: Type hints and modern Python features supported
54+
55+
## Getting Started
56+
57+
1. **Install the package**: `pip install robocode-tank-royale`
58+
59+
2. **Download Robocode Tank Royale**: Get the game GUI and server from the [official releases](https://github.com/robocode-dev/tank-royale/releases)
60+
61+
3. **Create your bot**: Download and study [MyFirstBot.py](https://github.com/robocode-dev/tank-royale/blob/master/sample-bots/python/MyFirstBot/MyFirstBot.py) or check the documentation
62+
63+
4. **Run battles**: Start the GUI, add your bot, and watch the battles unfold!
64+
65+
## Documentation & Resources
66+
67+
- **📖 Official Documentation**: [robocode-dev.github.io/tank-royale](https://robocode-dev.github.io/tank-royale/)
68+
- **🚀 Getting Started Guide**: [Getting Started Tutorial](https://robocode-dev.github.io/tank-royale/tutorial/getting-started)
69+
- **🤖 My First Bot Tutorial**: [Create Your First Bot](https://robocode-dev.github.io/tank-royale/tutorial/my-first-bot.html)
70+
- **📚 API Reference**: [Python API Documentation](https://robocode-dev.github.io/tank-royale/api/apis.html)
71+
- **🤖 Sample Bots**: [Python Examples](https://github.com/robocode-dev/tank-royale/tree/master/sample-bots/python)
72+
- **💾 Source Code**: [GitHub Repository](https://github.com/robocode-dev/tank-royale/tree/main/bot-api/python)
73+
74+
## Supported Platforms
75+
76+
Robocode Tank Royale runs on:
77+
- **Windows**
78+
- **macOS**
79+
- **Linux**
80+
81+
The Python Bot API works with **Python 3.10+** on all supported platforms.
82+
83+
## Community & Support
84+
85+
- **GitHub Issues**: [Report bugs and request features](https://github.com/robocode-dev/tank-royale/issues)
86+
- **Discussions**: [Community discussions and help](https://github.com/robocode-dev/tank-royale/discussions)
87+
- **Contributing**: Check out our [Contributing Guide](https://github.com/robocode-dev/tank-royale/blob/master/CONTRIBUTING.md)
88+
89+
## Development Status
90+
91+
🚧 **Work in Progress**: The Python Bot API is currently under active development. Features and APIs may change before the stable release.
92+
93+
## License
94+
95+
Licensed under the [Apache License 2.0](https://github.com/robocode-dev/tank-royale/blob/master/LICENSE)
96+
97+
## Copyright
98+
99+
Copyright © 2022 [Flemming N. Larsen](https://github.com/flemming-n-larsen)
100+
101+
---
102+
103+
**Ready to build the best tank and destroy the rest?** Start coding your bot today! 🚀🎯

bot-api/python/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Python Bot API for Robocode Tank Royale
22

3+
Note: This README is for developers—not PyPi. The README for PyPi is [here](PyPi-ReadMe.md)
4+
35
This directory contains the Bot API for developing bots for Robocode Tank Royale with Python.
46

57
The Bot API is provided via a pip package.
@@ -8,7 +10,7 @@ The Bot API is provided via a pip package.
810

911
### From the current directory:
1012

11-
First generate schemas into a tank_royale.schema package:
13+
First, generate schemas into a tank_royale.schema package:
1214

1315
```shell
1416
python scripts/schema_to_python.py -d ../../schema/schemas -o generated/robocode_tank_royale/tank_royale/schema

bot-api/python/build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,25 @@ tasks {
6363
dependsOn(test)
6464
}
6565

66+
// Install Python build tooling (build + wheel)
67+
val `install-build-tools` by registering(Exec::class) {
68+
group = "build"
69+
description = "Installs Python build tooling"
70+
commandLine("python", "-m", "pip", "install", "build", "wheel")
71+
}
72+
73+
// Build distributable artifacts (wheel + sdist)
74+
val `build-dist` by registering(Exec::class) {
75+
group = "build"
76+
description = "Builds wheel and sdist into dist/ using PEP 517"
77+
dependsOn(`generate-schema`)
78+
dependsOn(`generate-version`)
79+
dependsOn(`install-build-tools`)
80+
commandLine("python", "-m", "build")
81+
}
82+
6683
named("build") {
6784
dependsOn(`pip-install`)
85+
dependsOn(`build-dist`)
6886
}
6987
}

bot-api/python/pyproject.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[build-system]
2+
requires = ["setuptools>=69"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "robocode-tank-royale"
7+
description = "Python Bot API for Robocode Tank Royale"
8+
readme = "PyPi-ReadMe.md"
9+
license = {text = "Apache-2.0"}
10+
requires-python = ">=3.10"
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Intended Audience :: Developers",
14+
"Intended Audience :: Education",
15+
"License :: OSI Approved :: Apache Software License",
16+
"Programming Language :: Python :: 3.10",
17+
"Topic :: Games/Entertainment",
18+
"Topic :: Education",
19+
"Topic :: Software Development :: Libraries :: Python Modules",
20+
"Operating System :: OS Independent",
21+
"Environment :: Console"
22+
]
23+
24+
# Using setup.py to supply dependencies and version dynamically
25+
dynamic = ["version", "dependencies"]
26+
27+
[tool.setuptools.packages.find]
28+
where = ["src", "generated/robocode_tank_royale/tank_royale"]
29+
30+
maintainers = [
31+
{name = "Yang Li", url = "https://github.com/yangli2"},
32+
{name = "Maintainer Two", url = "https://github.com/flemming-n-larsen"}
33+
]
34+
35+
[project.urls]
36+
Homepage = "https://robocode-dev.github.io/tank-royale"

bot-api/python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
name="robocode-tank-royale",
88
version=version,
99
description="The Python Bot API for Robocode Tank Royale",
10-
long_description=open("README.md").read(),
10+
long_description=open("PyPi-ReadMe.md").read(),
1111
long_description_content_type="text/markdown",
1212
url="https://robocode-dev.github.io/tank-royale",
1313
package_dir={

publish.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,32 @@ Publish to staging, close, and release:
1818

1919
## .Net archives (Nuget)
2020

21+
## Python package (pip)
22+
23+
From repository root, build the Python Bot API package (wheel + sdist):
24+
25+
```
26+
./gradlew :bot-api:python:build-dist
27+
```
28+
29+
This will:
30+
- Generate schema sources into bot-api/python/generated
31+
- Generate the VERSION file from gradle.properties
32+
- Build dist/*.whl and dist/*.tar.gz inside bot-api/python/dist
33+
34+
Install the built wheel from anywhere on your system:
35+
36+
```
37+
pip install path\to\tank-royale\bot-api\python\dist\robocode_tank_royale-<version>-py3-none-any.whl
38+
```
39+
40+
Alternatively, to install directly from the project folder without building first (editable for development):
41+
42+
```
43+
cd bot-api\python
44+
pip install -e .
45+
```
46+
2147
Enter the release folder:
2248

2349
```shell

0 commit comments

Comments
 (0)