A Pythonic, structured data engine for Twilight Imperium 4th Edition
Project description
TI4 Rules Engine
A Pythonic, structured data engine for Twilight Imperium 4th Edition. Tracks game state, provides rule references, and calculates player options from a live AsyncTI4 Discord bot game.
Analyse a game in one command
No installation required — just uvx:
uvx --from ti4-rules-engine ti4-analyze <game_name>
Replace <game_name> with the name of your AsyncTI4 game (the identifier shown
by the bot, e.g. pbd22295):
uvx --from ti4-rules-engine ti4-analyze pbd22295
The command fetches the live game snapshot from the AsyncTI4 API and prints:
- Current round, phase, and active player
- Per-player summary: faction, VP, resources, planets, technologies, and leaders
- Every legal action available to each player under TI4 rules right now
- Reachable systems for each fleet (movement + anomaly rules applied)
Note:
uvx --from ti4-rules-enginerequires the package to be published on PyPI. Until then, clone the repo and use the local install instead:git clone --recurse-submodules https://github.com/adam133/ti4-rules-engine cd ti4-rules-engine uv tool install . ti4-analyze pbd22295Development note: this repository reads game data from a git submodule (
data/TI4_map_generator_bot), so local development requires cloning with submodules (or runninggit submodule update --init --recursivein an existing clone).
What it shows
============================================================
Game: pbd22295 Round: 3 Phase: action
Active: sargun
============================================================
sargun [ACTIVE]
Faction: Nekro Virus
VP: 5
TG: 3 | Commodities: 0
Tokens: 3 tactical / 5 fleet / 2 strategy
Planets: 8 controlled, 2 exhausted
...
Actions available:
• tactical_action
• component_action
• strategic_action
Further reading
- docs/implementation.md — module reference and API examples (game session setup, modifier system, combat simulation, scoring, movement, opponent public info)
- docs/contributing.md — local dev setup, running tests, and project roadmap
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ti4_rules_engine-0.2.2.tar.gz.
File metadata
- Download URL: ti4_rules_engine-0.2.2.tar.gz
- Upload date:
- Size: 604.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee7375bcfda0daf64bda52190a50b914411a7c862bb05a98e9bdbf60c2dcac22
|
|
| MD5 |
a23729424507280411a88930fc40883f
|
|
| BLAKE2b-256 |
9ce213e79dcfb59625c2990e344e692202f14c014cc8517a62f48ff4a39a3fc8
|
Provenance
The following attestation bundles were made for ti4_rules_engine-0.2.2.tar.gz:
Publisher:
publish.yml on adam133/ti4-rules-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ti4_rules_engine-0.2.2.tar.gz -
Subject digest:
ee7375bcfda0daf64bda52190a50b914411a7c862bb05a98e9bdbf60c2dcac22 - Sigstore transparency entry: 1331480671
- Sigstore integration time:
-
Permalink:
adam133/ti4-rules-engine@9d1bce10ee298dfc1546332ad1aeda91fda02794 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adam133
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d1bce10ee298dfc1546332ad1aeda91fda02794 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file ti4_rules_engine-0.2.2-py3-none-any.whl.
File metadata
- Download URL: ti4_rules_engine-0.2.2-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bcd551a2489403c682c79c59640e1d6f38b5246e70283a45917b794786f2046
|
|
| MD5 |
208ae94bbec2c3190e8c3517c514196a
|
|
| BLAKE2b-256 |
19c415bafbec81e86c553001779f47ea0c6ad818fa19b0ed79070d037272f62a
|
Provenance
The following attestation bundles were made for ti4_rules_engine-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on adam133/ti4-rules-engine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ti4_rules_engine-0.2.2-py3-none-any.whl -
Subject digest:
5bcd551a2489403c682c79c59640e1d6f38b5246e70283a45917b794786f2046 - Sigstore transparency entry: 1331480774
- Sigstore integration time:
-
Permalink:
adam133/ti4-rules-engine@9d1bce10ee298dfc1546332ad1aeda91fda02794 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/adam133
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d1bce10ee298dfc1546332ad1aeda91fda02794 -
Trigger Event:
workflow_dispatch
-
Statement type: