Skip to content

Commit 3e929c4

Browse files
committed
Update README.md
1 parent 4b3c2e0 commit 3e929c4

1 file changed

Lines changed: 33 additions & 18 deletions

File tree

README.md

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,36 @@ A Python module implemented in Rust for fast and safe serialization and deserial
44

55
### The goal of this project
66

7-
A majority of the code is auto-generated in the `codegen/` upon first compile
7+
A majority of the code is auto-generated by `codegen/` upon first compile
88
using the RLBot's schema as defined by the `flatbuffers-schema` submodule.
99

1010
This includes the code generated by Planus (`src/planus_flat.rs`),
1111
the Python wrapper binds to the generated Rust code (`src/python/`),
1212
and the Python type hints (`rlbot_flatbuffers.pyi`).
1313

14+
Usage of this API should not significantly differ from RLBot v4 to reduce developer confusion, while not holding back changes that would make the API easier to work with.
15+
16+
### Minimum support Python version
17+
18+
The crate used to generate Python binds (PyO3) supports all the way back to Python 3.7, however the minimum supported Python version is 3.10 for a few reasons:
19+
20+
1. RLBot v4 currently runs Python 3.11
21+
1. The RLBot v5's [Python interface](https://github.com/RLBot/python-interface) has a minimum Python version of 3.11, but the difference between 3.10 and 3.11 doesn't mean much for these binds specifically.
22+
1. Python 3.10 is the version of Python that added `match`/`case`
23+
1. [Python 3.7 & 3.8 are EOL, with 3.9's EOL date being 2025-10](https://devguide.python.org/versions/)
24+
1425
### Dev setup
1526

1627
- Ensure Python 3.10+ is installed
1728
- Create a virtual Python environment
18-
- `python3 -m venv venv`
29+
- `python3 -m venv venv`
1930
- Activate the virtual environment
20-
- Windows: `venv\Scripts\activate.bat`
21-
- Linux: `source venv/bin/activate`
31+
- Windows: `venv\Scripts\activate.bat`
32+
- Linux: `source venv/bin/activate`
2233
- Install maturin
23-
- `pip install maturin`
34+
- `pip install maturin`
2435
- Build & install for testing
25-
- `maturin develop --release`
36+
- `maturin develop --release`
2637

2738
To use in another Python environment, like if testing [python-interface](https://github.com/RLBot/python-interface), you can build the wheel:
2839

@@ -62,14 +73,14 @@ desired_game_state = flat.DesiredGameState(
6273
In the above code, we:
6374

6475
- Set the ball to:
65-
- Location (0, 0, 200)
66-
- Velocity (1500, 1500, 0)
67-
- Angular velocity of (0, 0, 0)
76+
- Location (0, 0, 200)
77+
- Velocity (1500, 1500, 0)
78+
- Angular velocity of (0, 0, 0)
6879
- Don't set the car states
6980
- Set the game info state:
70-
- World gravity to -100
71-
- Game speed to 2x default
72-
- Don't set end match or paused
81+
- World gravity to -100
82+
- Game speed to 2x default
83+
- Don't set end match or paused
7384
- Don't set any console commands
7485

7586
All values are optional when creating a class and have the proper defaults.
@@ -97,15 +108,19 @@ def handle_packet(packet: flat.GamePacket):
97108

98109
The goal of the above was to feel familiar to RLBot v4 while providing a more Pythonic interface.
99110

111+
- Unions aren't custom types, rather a normal Python variable that can be 1 of a few types.
112+
- For example, previously [`BallInfo.shape` had the separate type `CollisionShape` which contained the union's data](https://github.com/RLBot/RLBot/blob/e34dd4598bc643e2b8e50b77f7ffe4ca38e335de/src/main/python/rlbot/utils/structures/game_data_struct.pyi#L65-L95) but the type is now just `BoxShape | CylinderShape | SphereShape`
113+
100114
- Classes implement `__match_args__` for easy destructuring via the `match`/`case` pattern.
101-
- Enums and unions and can still be used to match against the type,
102-
they just can't be destructured.
103-
- Classes, enums, and unions properly implements `__str__` and `__repr__`.
115+
- Enums can still be used to match against the type,
116+
they just can't be destructured.
117+
- Classes and enums properly implement `__repr__`, with `__str__` being an alias.
104118
- Enums implement `__hash__`, `__int__` and `__eq__`.
105119
- Lists no longer have `num_x` fields accompanying them,
106120
they are just Python lists of the appropriate length.
107121
- Classes implement `pack` and `unpack`,
108122
which are used to serialize and deserialize data.
109-
110-
These are public methods that can be used directly for any purpose,
111-
for example saving `flat.GamePacket` to a file.
123+
- These are public methods that can be used directly for any purpose,
124+
for example saving `flat.GamePacket` to a file.
125+
126+
- Auto-generated python type stub (`.pyi`) generation that includes doc comments from the Flatbuffers schema

0 commit comments

Comments
 (0)