Skip to content

Commit 932db13

Browse files
committed
Update README.md
1 parent fa8ba40 commit 932db13

1 file changed

Lines changed: 19 additions & 13 deletions

File tree

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
## rlbot-flatbuffers
22

3-
A Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers
3+
A Python module implemented in Rust for fast and safe serialization and deserialization of RLBot's flatbuffers
44

55
### The goal of this project
66

7-
To provide a fast, safe, and easy to use Python module for serializing and deserializing RLBot's flatbuffers.
7+
A majority of the code is auto-generated in the `codegen/` upon first compile
8+
using the RLBot's schema as defined by the `flatbuffers-schema` submodule.
89

9-
A majority of the code is generated in the `codegen/` upon first compile and thrown into `src/python`.
10-
11-
This includes the code generated by `flatc` (living in `src/generated`), the Python wrapper binds to the generated Rust code, and the Python type hints (`rlbot_flatbuffers.pyi`).
10+
This includes the code generated by Planus (`src/planus_flat.rs`),
11+
the Python wrapper binds to the generated Rust code (`src/python/`),
12+
and the Python type hints (`rlbot_flatbuffers.pyi`).
1213

1314
### Dev setup
1415

15-
- Ensure Python 3.11+ is installed
16+
- Ensure Python 3.10+ is installed
1617
- Create a virtual Python environment
1718
- `python3 -m venv venv`
1819
- Activate the virtual environment
@@ -23,7 +24,7 @@ This includes the code generated by `flatc` (living in `src/generated`), the Pyt
2324
- Build & install for testing
2425
- `maturin develop --release`
2526

26-
To use in another Python environment, like if testing [python-interface](https://github.com/VirxEC/python-interface/blob/master/README.md?plain=1), you can build the wheel:
27+
To use in another Python environment, like if testing [python-interface](https://github.com/RLBot/python-interface), you can build the wheel:
2728

2829
- `maturin build --release`
2930
- (In another environment) `pip install path/to/file.whl`
@@ -79,9 +80,9 @@ All values are optional when creating a class and have the proper defaults.
7980
import rlbot_flatbuffers as flat
8081

8182
def handle_packet(packet: flat.GamePacket):
82-
if packet.game_info.game_status not in {
83-
flat.GameStatus.Active,
84-
flat.GameStatus.Kickoff,
83+
if packet.match_info.match_phase not in {
84+
flat.MatchPhase.Active,
85+
flat.MatchPhase.Kickoff,
8586
}:
8687
# Return early if the game isn't active
8788
return
@@ -96,10 +97,15 @@ def handle_packet(packet: flat.GamePacket):
9697

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

99-
- All classes (not enums and unions) implement `__match_args__` for easy destructuring via the `match`/`case` pattern.
100+
- Classes implement `__match_args__` for easy destructuring via the `match`/`case` pattern.
100101
- Enums and unions and can still be used to match against the type,
101102
they just can't be destructured.
102-
- Every class implements `__str__`, `__repr__`, and `__hash__` methods.
103-
- All enums also implement `__int__` and `__eq__`.
103+
- Classes, enums, and unions properly implements `__str__` and `__repr__`.
104+
- Enums implement `__hash__`, `__int__` and `__eq__`.
104105
- Lists no longer have `num_x` fields accompanying them,
105106
they are just Python lists of the appropriate length.
107+
- Classes implement `pack` and `unpack`,
108+
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.

0 commit comments

Comments
 (0)