Game Learning Runtime
Game Learning Runtime (GLR) is a framework-neutral contract between game runtimes and learning systems. A game adapter describes observations, actions, action masks, rewards, events, and episode boundaries once; TorchRL, custom PPO or IMPALA learners, behavior cloning, offline datasets, evaluators, and QA tools can then consume the same interface.
A universal runtime for connecting games to learning systems and AI agents.
GLR is intended for games and test environments you own or are authorized to instrument. It does not include anti-cheat bypasses, stealth injection, or game-specific reverse-engineering code.
Why this boundary
Game / simulator
│
▼
Runtime adapter (C#, C++, Rust, Python, official API, ...)
│
▼
GLR protocol + environment contract
│
├── TorchRL
├── custom PPO / IMPALA
├── BC / DAgger / offline learning
├── recorder / replay
└── evaluation / automated QA
Game adapters never import PPO, IMPALA, BC, or TorchRL. Learning code never needs to know whether the game is Unity, Unreal, Source, native, or a test simulator. The standardized boundary is the data and lifecycle contract, not a single implementation language or transport.
Implemented in v0.1
- Recursive tensor-tree specs for continuous, discrete, multi-discrete, binary, hybrid, parameterized, and hierarchical data.
- A
GameEnvironmentport with reset, step, close, action masks, semantic events, terminated/truncated signals, episode IDs, and monotonic step IDs. - A fail-closed
ContractEnvironmentwrapper that validates every boundary. - Fixed-length actor
Unrollcollection suitable for custom PPO and IMPALA. - Versioned
glr.transition.v1JSONL records for BC, replay, and offline data. - A packaged
glr.v1Protobuf service with unary and bidirectional streaming interaction contracts. - An optional TorchRL
EnvBaseadapter tested against TorchRL 0.13.
Game-specific runtime adapters, generated C#/C++/Rust protocol SDKs, distributed actor transport, and learner implementations are roadmap items—not features claimed by this initial release.
Install
Until PyPI trusted publishing is enabled, pin a GitHub release tag:
uv add "game-learning-runtime @ git+https://github.com/loonghao/GameLearningRuntime@v0.1.0"
Add the TorchRL integration only where training requires it:
uv add "game-learning-runtime[torchrl] @ git+https://github.com/loonghao/GameLearningRuntime@v0.1.0"
Minimal environment
import numpy as np
from game_learning_runtime import ContractEnvironment, SyncCollector
from game_learning_runtime.examples import CounterEnvironment, always_increment
environment = ContractEnvironment(CounterEnvironment(target=3))
collector = SyncCollector(environment, actor_id="local-actor")
unroll = collector.collect(always_increment, steps=16, policy_version=0)
print(len(unroll.transitions), unroll.total_reward)
Run the complete example from a clone:
uv sync --frozen
uv run python -c "from game_learning_runtime import *; from game_learning_runtime.examples import *; print(SyncCollector(ContractEnvironment(make_environment())).collect(always_increment, steps=4).total_reward)"
For TorchRL:
from game_learning_runtime.examples import CounterEnvironment
from game_learning_runtime.integrations.torchrl import TorchRLEnvironment
env = TorchRLEnvironment(CounterEnvironment())
rollout = env.rollout(max_steps=32)
Reuse the CI workflow
Any uv-managed Python repository can call the public reusable workflow:
jobs:
quality:
uses: loonghao/GameLearningRuntime/.github/workflows/reusable-python-ci.yml@v0.1.0
with:
python-versions: '["3.10", "3.12"]'
sync-args: "--frozen --all-groups"
lint-command: "uv run ruff check . && uv run mypy"
test-command: "uv run pytest"
Pin a release tag or commit SHA in production repositories. The workflow never receives deployment secrets and only checks out/tests the calling repository.
Documentation
- Getting started
- Architecture
- Protocol and data flow
- Local development
- Release runbook
- Roadmap
- Architecture decisions
Contributing and security
See CONTRIBUTING.md for the development contract and SECURITY.md for private vulnerability reporting. GLR is licensed under the MIT License.
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 game_learning_runtime-0.1.0.tar.gz.
File metadata
- Download URL: game_learning_runtime-0.1.0.tar.gz
- Upload date:
- Size: 152.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232f67216a4efbac695756650037502973d54835c46dd0f9e1029248302433fa
|
|
| MD5 |
efb13170499616327c28ef5fbb9491cb
|
|
| BLAKE2b-256 |
66129357cb58a0560a301d3f5998ef51232d67245ed817abb27890e3b61dea5e
|
Provenance
The following attestation bundles were made for game_learning_runtime-0.1.0.tar.gz:
Publisher:
release.yml on loonghao/GameLearningRuntime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
game_learning_runtime-0.1.0.tar.gz -
Subject digest:
232f67216a4efbac695756650037502973d54835c46dd0f9e1029248302433fa - Sigstore transparency entry: 2654621690
- Sigstore integration time:
-
Permalink:
loonghao/GameLearningRuntime@3684ceb8459696a73ed95f60746d48246623a4a8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/loonghao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3684ceb8459696a73ed95f60746d48246623a4a8 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file game_learning_runtime-0.1.0-py3-none-any.whl.
File metadata
- Download URL: game_learning_runtime-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2199597a4e49aef7e275a60620069aa0fbbe4f348501e2111f98dd6044edd54b
|
|
| MD5 |
8c450ea1ae5af994c1f908446256d41b
|
|
| BLAKE2b-256 |
5940c378a2c1f43fcca8b04d813b13c2c82f2f166ba46619b05021a0f6534f3f
|
Provenance
The following attestation bundles were made for game_learning_runtime-0.1.0-py3-none-any.whl:
Publisher:
release.yml on loonghao/GameLearningRuntime
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
game_learning_runtime-0.1.0-py3-none-any.whl -
Subject digest:
2199597a4e49aef7e275a60620069aa0fbbe4f348501e2111f98dd6044edd54b - Sigstore transparency entry: 2654621751
- Sigstore integration time:
-
Permalink:
loonghao/GameLearningRuntime@3684ceb8459696a73ed95f60746d48246623a4a8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/loonghao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3684ceb8459696a73ed95f60746d48246623a4a8 -
Trigger Event:
workflow_dispatch
-
Statement type: