{"id":26128990,"url":"https://github.com/virxec/rlbot_flatbuffers_py","last_synced_at":"2025-03-10T19:29:47.142Z","repository":{"id":219541595,"uuid":"749299930","full_name":"VirxEC/rlbot_flatbuffers_py","owner":"VirxEC","description":"A Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers","archived":false,"fork":false,"pushed_at":"2024-10-24T03:13:14.000Z","size":127,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-24T15:52:52.221Z","etag":null,"topics":["flatbuffers","rlbot","rust-lang"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/rlbot-flatbuffers/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirxEC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-28T06:45:35.000Z","updated_at":"2024-10-24T03:13:05.000Z","dependencies_parsed_at":"2024-03-26T17:29:37.240Z","dependency_job_id":"3556b567-cd31-488d-911c-8d610755f62f","html_url":"https://github.com/VirxEC/rlbot_flatbuffers_py","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"e4b964ec65cdfe7a9bb4143c831ee972dade029c"},"previous_names":["virxec/rlbot_flatbuffers_py"],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirxEC%2Frlbot_flatbuffers_py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirxEC%2Frlbot_flatbuffers_py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirxEC%2Frlbot_flatbuffers_py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirxEC%2Frlbot_flatbuffers_py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirxEC","download_url":"https://codeload.github.com/VirxEC/rlbot_flatbuffers_py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242784757,"owners_count":20184772,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flatbuffers","rlbot","rust-lang"],"created_at":"2025-03-10T19:29:46.465Z","updated_at":"2025-03-10T19:29:47.125Z","avatar_url":"https://github.com/VirxEC.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## rlbot-flatbuffers\n\nA Python module implemented in Rust for serializing and deserializing RLBot's flatbuffers\n\n### The goal of this project\n\nTo provide a fast, safe, and easy to use Python module for serializing and deserializing RLBot's flatbuffers.\n\nA majority of the code is generated in the `codegen/` upon first compile and thrown into `src/python`.\n\nThis 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`).\n\n### Dev setup\n\n- Ensure Python 3.11+ is installed\n- Create a virtual Python environment\n  - `python3 -m venv venv`\n- Activate the virtual environment\n  - Windows: `venv\\Scripts\\activate.bat`\n  - Linux: `source venv/bin/activate`\n- Install maturin\n  - `pip install maturin`\n- Build \u0026 install for testing\n  - `maturin develop --release`\n\nTo 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:\n\n- `maturin build --release`\n- (In another environment) `pip install path/to/file.whl`\n\nThe exact path of the wheel will be printed by maturin, just copy+paste it.\n\n### Basic usage\n\nAll classes and methods should have types hints readable by your IDE, removing the guesswork of common operations.\n\n#### Creating\n\n```python\nimport rlbot_flatbuffers as flat\n\ndesired_ball = flat.DesiredBallState(\n    physics=flat.Physics(\n        location=flat.Vector3Partial(z=200),\n        velocity=flat.Vector3Partial(x=1500, y=1500),\n        angular_velocity=flat.Vector3Partial(),\n    ),\n)\n\ndesired_game_info = flat.DesiredGameInfoState(\n    world_gravity_z=-100,\n    game_speed=2,\n)\n\ndesired_game_state = flat.DesiredGameState(\n    ball_state=desired_ball,\n    game_info_state=desired_game_info,\n)\n```\n\nIn the above code, we:\n\n- Set the ball to:\n  - Location (0, 0, 200)\n  - Velocity (1500, 1500, 0)\n  - Angular velocity of (0, 0, 0)\n- Don't set the car states\n- Set the game info state:\n  - World gravity to -100\n  - Game speed to 2x default\n  - Don't set end match or paused\n- Don't set any console commands\n\nAll values are optional when creating a class and have the proper defaults.\n\n#### Reading values\n\n```python\nimport rlbot_flatbuffers as flat\n\ndef handle_packet(packet: flat.GamePacket):\n    if packet.game_info.game_status not in {\n        flat.GameStatus.Active,\n        flat.GameStatus.Kickoff,\n    }:\n        # Return early if the game isn't active\n        return\n\n    # Print the ball's location\n    print(packet.ball.physics.location)\n\n    for car in packet.players:\n        # Print the every car's location\n        print(car.physics.location)\n```\n\nThe goal of the above was to feel familiar to RLBot v4 while providing a more Pythonic interface.\n\n- All classes (not enums and unions) implement `__match_args__` for easy destructuring via the `match`/`case` pattern.\n  - Enums and unions and can still be used to match against the type,\n    they just can't be destructured.\n- Every class implements `__str__`, `__repr__`, and `__hash__` methods.\n  - All enums also implement `__int__` and `__eq__`.\n- Lists no longer have `num_x` fields accompanying them,\n  they are just Python lists of the appropriate length.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirxec%2Frlbot_flatbuffers_py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirxec%2Frlbot_flatbuffers_py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirxec%2Frlbot_flatbuffers_py/lists"}