# zealanl/gigalearncpp-leak architecture

> Architecture diagram of the GitHub repository zealanl/gigalearncpp-leak, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zealanl/gigalearncpp-leak
- Repository: https://github.com/zealanl/gigalearncpp-leak

## Overview

1. **High-level shape**
   This repo is a C++ reinforcement-learning stack for Rocket League bots. The architecture is split into three major boundaries: the **learning framework** (`GigaLearnCPP`), the **simulation/environment layer** (`RLGymCPP` + `RocketSim`), and the **game integration layer** (`RLBotCPP` plus the root `src/` example/client code).

2. **Public vs internal learning framework**
   `GigaLearnCPP/src/public` is the API surface other code is meant to use: `Learner`, `LearnerConfig`, PPO configs, skill tracking config, and utilities like metric/report/render helpers. `GigaLearnCPP/src/private` contains the implementation details: PPO training (`PPOLearner`, `GAE`, `ExperienceBuffer`), policy version management, model definitions, and optimizer/statistics utilities. That boundary is important for the diagram because the public layer is thin and the private layer owns the training runtime.

3. **Environment / RL interface layer**
   `RLGymCPP` is the environment abstraction that sits between learning code and physics. It defines game-state types (`GameState`, `Player`, `Action`), observation builders, reward functions, state setters, and terminal conditions. The readme’s state changes reflect this API design: rewards and observations operate on `Player`/`GameState`, with access to previous state/action data and event state baked into the model.

4. **Simulation core**
   `RocketSim` is the physics-backed simulation engine used for environment creation and state-setting. It owns arena setup, car/ball/boost pad entities, collision masks, mutator configuration, event tracking, and ball prediction. The state-setting flow is explicit in the readme: the learner/environment is given an arena instance and can initialize or mutate the sim state directly.

5. **Physics dependency boundary**
   `RocketSim/libsrc/bullet3-3.24` vendors Bullet Physics directly into the repo. So the simulation stack is not a black box; it is a C++ physics engine embedded under RocketSim. In an architecture diagram, Bullet should appear as the low-level physics dependency under RocketSim, not as a separate service.

6. **PPO training pipeline**
   The learning pipeline is PPO-centric: experience collection feeds `ExperienceBuffer`, advantages are computed with `GAE`, and `PPOLearner` performs policy/critic updates. The readme also notes configurable layer sizes, activation functions, optimizer choice, layer norm, return/obs standardization, and built-in action masking. This means the model/training subsystem is tightly coupled to environment semantics and policy versioning.

7. **Policy versioning and skill tracking**
   `PolicyVersionManager` and the skill tracker configs indicate a second training-control loop beyond basic PPO: policies are versioned, and ELO-style skill tracking can use those versions for evaluation or matchmaking-style logic. This is a distinct subsystem because it introduces metadata flow around model checkpoints, not just gradients and weights.

8. **Inference and telemetry utilities**
   The public utilities in `GigaLearnCPP/src/public/GigaLearnCPP/Util` handle runtime integration: `InferUnit` for inference, `MetricSender`/`RenderSender` for outgoing telemetry, `Report` for aggregating stats, `KeyPressDetector` for local control, and timer/helpers. The readme’s “single-process inference model” and built-in visualization/metrics imply the learner emits both action decisions and diagnostic streams.

9. **Game integration via RLBot**
   `RLBotCPP` is the Rocket League bot interface layer. It includes bot/process/server/socket abstractions, match settings, renderers, and platform-specific implementations for Linux and Windows. This is the boundary that connects a running bot executable to the RLBot ecosystem and the Rocket League game process. The `rlbot/` folder contains the runtime configs and Python-side launch wrapper (`CppPythonAgent.py`).

10. **Top-level application glue**
   The root `src/` directory contains `ExampleMain.cpp` and `RLBotClient.*`, which likely wire the framework into a concrete executable. This is the place where the learned policy, RLBot connection, and runtime config are assembled into a runnable agent.

11. **Python-side support scripts**
   `python_scripts/metric_receiver.py` and `python_scripts/render_receiver.py` are sidecar consumers for the telemetry streams produced by the C++ side. They are not central to training, but they are part of the observability path: C++ emits metrics/render data, Python receives and displays or processes it.

12. **Supporting tooling and format boundaries**
   The repo is CMake-driven and includes vendored third-party dependencies such as `nlohmann/json`, `pybind11`, `flatbuffers` inside RLBotCPP, and a small thread-pool library. `tools/checkpoint_converter.py` suggests checkpoint format conversion is part of the model lifecycle. These are infrastructure dependencies rather than separate services, but they affect how data moves between training, serialization, and runtime loading.

Main entry points: [`GigaLearnCPP/src/private/GigaLearnCPP/PPO`](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO) (PPO Runtime), [`GigaLearnCPP/RLGymCPP/src/RLGymCPP`](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP) (RLGymCPP), [`GigaLearnCPP/src/public/GigaLearnCPP`](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/public/GigaLearnCPP) (Learner API), [`RLBotCPP/inc/rlbot`](https://github.com/zealanl/gigalearncpp-leak/tree/main/RLBotCPP/inc/rlbot) (RLBotCPP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning"]
  node_learn_api["Learner API<br/>public api"]
  node_learner["Learner<br/>entrypoint<br/>[Learner.h]"]
  node_learn_config["Learn Config<br/>[LearnerConfig.h]"]
  node_ppo_config["PPO Config<br/>[PPOLearnerConfig.h]"]
  node_skill_config["Skill Config"]
  node_infer_telemetry["Infer + Telemetry<br/>runtime utils"]
  node_ppo_runtime["PPO Runtime<br/>training core"]
  node_exp_buffer[("Experience<br/>rollout buffer<br/>[ExperienceBuffer.h]")]
  node_gae["GAE<br/>advantage calc<br/>[GAE.h]"]
  node_ppo_learner["PPOLearner<br/>trainer<br/>[PPOLearner.h]"]
  node_policy_mgr["Policy Versions<br/>versioning"]
  node_models["Models<br/>net defs<br/>[Models.h]"]
end

subgraph group_envsim["Env + Sim"]
  node_rgym["RLGymCPP<br/>env interface"]
  node_game_state[("Game State<br/>state types<br/>[GameState.h]")]
  node_obs_reward["Obs + Reward<br/>env logic"]
  node_state_term["State + Termination<br/>env logic"]
  node_rocket_sim["RocketSim<br/>physics sim<br/>[RocketSim.h]"]
  node_sim_entities["Sim Entities<br/>simulation model"]
  node_bullet["Bullet Physics<br/>vendor physics<br/>[bullet3-3.24]"]
end

subgraph group_integration["RLBot"]
  node_rlbotcpp["RLBotCPP<br/>game bridge"]
  node_bot_io["Bot IO<br/>process + sockets"]
  node_render_match["Render + Match<br/>ui + config<br/>[renderer.h]"]
end

subgraph group_runtime["Runtime"]
  node_app_glue["App Glue<br/>executable<br/>[ExampleMain.cpp]"]
  node_python_sidecars["Python Sidecars<br/>telemetry consumers"]
  node_checkpoint_tool["Checkpoint Tool"]
end

node_learn_api -->|"exports"| node_learner
node_learn_api -->|"uses"| node_learn_config
node_learn_api -->|"uses"| node_ppo_config
node_learn_api -->|"uses"| node_skill_config
node_learner -->|"drives"| node_ppo_runtime
node_ppo_runtime -->|"collects"| node_exp_buffer
node_ppo_runtime -->|"computes"| node_gae
node_ppo_runtime -->|"optimizes"| node_ppo_learner
node_ppo_runtime -->|"versions"| node_policy_mgr
node_ppo_runtime -->|"updates"| node_models
node_ppo_runtime -->|"interacts"| node_rgym
node_rgym -->|"defines"| node_game_state
node_rgym -->|"builds"| node_obs_reward
node_rgym -->|"resets"| node_state_term
node_rgym -->|"drives"| node_rocket_sim
node_rocket_sim -->|"contains"| node_sim_entities
node_rocket_sim -->|"depends on"| node_bullet
node_app_glue -->|"connects"| node_rlbotcpp
node_rlbotcpp -->|"implements"| node_bot_io
node_rlbotcpp -->|"provides"| node_render_match
node_app_glue -->|"uses"| node_learn_api
node_app_glue -->|"uses"| node_rlbotcpp
node_infer_telemetry -->|"emits"| node_python_sidecars
node_ppo_runtime -->|"reports"| node_infer_telemetry
node_checkpoint_tool -->|"converts"| node_policy_mgr

click node_learn_api "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/public/GigaLearnCPP"
click node_learner "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/Learner.h"
click node_learn_config "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/LearnerConfig.h"
click node_ppo_config "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/PPO/PPOLearnerConfig.h"
click node_skill_config "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/SkillTrackerConfig.h"
click node_infer_telemetry "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/public/GigaLearnCPP/Util"
click node_ppo_runtime "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO"
click node_exp_buffer "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/ExperienceBuffer.h"
click node_gae "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/GAE.h"
click node_ppo_learner "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/PPOLearner.h"
click node_policy_mgr "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PolicyVersionManager.h"
click node_models "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/Util/Models.h"
click node_rgym "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP"
click node_game_state "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/Gamestates/GameState.h"
click node_obs_reward "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/ObsBuilders"
click node_state_term "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/StateSetters"
click node_rocket_sim "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/RocketSim/src/RocketSim.h"
click node_sim_entities "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/RocketSim/src/Sim"
click node_bullet "https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/RocketSim/libsrc/bullet3-3.24"
click node_rlbotcpp "https://github.com/zealanl/gigalearncpp-leak/tree/main/RLBotCPP/inc/rlbot"
click node_bot_io "https://github.com/zealanl/gigalearncpp-leak/tree/main/RLBotCPP/src"
click node_render_match "https://github.com/zealanl/gigalearncpp-leak/blob/main/RLBotCPP/inc/rlbot/renderer.h"
click node_app_glue "https://github.com/zealanl/gigalearncpp-leak/blob/main/src/ExampleMain.cpp"
click node_python_sidecars "https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/python_scripts"
click node_checkpoint_tool "https://github.com/zealanl/gigalearncpp-leak/blob/main/tools/checkpoint_converter.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_learn_api,node_learner,node_learn_config,node_ppo_config,node_skill_config,node_infer_telemetry,node_ppo_runtime,node_exp_buffer,node_gae,node_ppo_learner,node_policy_mgr,node_models toneBlue
class node_rgym,node_game_state,node_obs_reward,node_state_term,node_rocket_sim,node_sim_entities,node_bullet toneAmber
class node_rlbotcpp,node_bot_io,node_render_match toneMint
class node_app_glue,node_python_sidecars,node_checkpoint_tool toneRose
```

## Components

### Learning

Public API, PPO runtime, and policy control.

- [Learner API](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/public/GigaLearnCPP): public api · Thin public surface for training and inference setup. · `GigaLearnCPP/src/public/GigaLearnCPP`
- [Learner](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/Learner.h): entrypoint · Main learning orchestrator used by client code. · `GigaLearnCPP/src/public/GigaLearnCPP/Learner.h`
- [Learn Config](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/LearnerConfig.h): config · Learner and PPO configuration types. · `GigaLearnCPP/src/public/GigaLearnCPP/LearnerConfig.h`
- [PPO Config](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/PPO/PPOLearnerConfig.h): config · PPO and transfer-learning settings. · `GigaLearnCPP/src/public/GigaLearnCPP/PPO/PPOLearnerConfig.h`
- [Skill Config](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/public/GigaLearnCPP/SkillTrackerConfig.h): config · Skill-tracking and evaluation settings. · `GigaLearnCPP/src/public/GigaLearnCPP/SkillTrackerConfig.h`
- [Infer + Telemetry](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/public/GigaLearnCPP/Util): runtime utils · Inference, reporting, metrics, render, and local control helpers. · `GigaLearnCPP/src/public/GigaLearnCPP/Util`
- [PPO Runtime](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO): training core · Policy optimization loop and rollout processing. · `GigaLearnCPP/src/private/GigaLearnCPP/PPO`
- [Experience](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/ExperienceBuffer.h): rollout buffer · Stores collected trajectories for training. · `GigaLearnCPP/src/private/GigaLearnCPP/PPO/ExperienceBuffer.h`
- [GAE](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/GAE.h): advantage calc · Advantage and return computation. · `GigaLearnCPP/src/private/GigaLearnCPP/PPO/GAE.h`
- [PPOLearner](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PPO/PPOLearner.h): trainer · Performs PPO policy and critic updates. · `GigaLearnCPP/src/private/GigaLearnCPP/PPO/PPOLearner.h`
- [Policy Versions](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/PolicyVersionManager.h): versioning · Tracks policy versions and checkpoint lineage. · `GigaLearnCPP/src/private/GigaLearnCPP/PolicyVersionManager.h`
- [Models](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/src/private/GigaLearnCPP/Util/Models.h): net defs · Policy and model definitions plus optimizer utilities. · `GigaLearnCPP/src/private/GigaLearnCPP/Util/Models.h`

### Env + Sim

RLGym environment boundary and RocketSim physics stack.

- [RLGymCPP](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP): env interface · Environment abstraction between learning and simulation. · `GigaLearnCPP/RLGymCPP/src/RLGymCPP`
- [Game State](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/Gamestates/GameState.h): state types · Core game-state and player representations. · `GigaLearnCPP/RLGymCPP/src/RLGymCPP/Gamestates/GameState.h`
- [Obs + Reward](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/ObsBuilders): env logic · Observation builders and reward functions. · `GigaLearnCPP/RLGymCPP/src/RLGymCPP/ObsBuilders`
- [State + Termination](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/src/RLGymCPP/StateSetters): env logic · State setters and terminal conditions. · `GigaLearnCPP/RLGymCPP/src/RLGymCPP/StateSetters`
- [RocketSim](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/RocketSim/src/RocketSim.h): physics sim · Physics-backed Rocket League simulation core. · `GigaLearnCPP/RLGymCPP/RocketSim/src/RocketSim.h`
- [Sim Entities](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/RLGymCPP/RocketSim/src/Sim): simulation model · Arena, car, ball, boost, events, and prediction. · `GigaLearnCPP/RLGymCPP/RocketSim/src/Sim`
- [Bullet Physics](https://github.com/zealanl/gigalearncpp-leak/blob/main/GigaLearnCPP/RLGymCPP/RocketSim/libsrc/bullet3-3.24): vendor physics · Embedded Bullet dynamics and collision engine. · `GigaLearnCPP/RLGymCPP/RocketSim/libsrc/bullet3-3.24`

### RLBot

Bot process, sockets, rendering, and game integration.

- [RLBotCPP](https://github.com/zealanl/gigalearncpp-leak/tree/main/RLBotCPP/inc/rlbot): game bridge · C++ interface to the RLBot ecosystem and game process. · `RLBotCPP/inc/rlbot`
- [Bot IO](https://github.com/zealanl/gigalearncpp-leak/tree/main/RLBotCPP/src): process + sockets · Bot process, server, controller, and socket plumbing. · `RLBotCPP/src`
- [Render + Match](https://github.com/zealanl/gigalearncpp-leak/blob/main/RLBotCPP/inc/rlbot/renderer.h): ui + config · Rendering and match settings for runtime control. · `RLBotCPP/inc/rlbot/renderer.h`

### Runtime

Root executable, telemetry sidecars, and tooling.

- [App Glue](https://github.com/zealanl/gigalearncpp-leak/blob/main/src/ExampleMain.cpp): executable · Root executable and client wiring. · `src/ExampleMain.cpp`
- [Python Sidecars](https://github.com/zealanl/gigalearncpp-leak/tree/main/GigaLearnCPP/python_scripts): telemetry consumers · Receives metrics and render streams from C++. · `GigaLearnCPP/python_scripts`
- [Checkpoint Tool](https://github.com/zealanl/gigalearncpp-leak/blob/main/tools/checkpoint_converter.py): utility · Checkpoint conversion and format handling. · `tools/checkpoint_converter.py`

## Connections

- Learner API → Learner: exports · Public API surface exposes the learner entrypoint.
- Learner API → Learn Config: uses · Learner is configured through public config types.
- Learner API → PPO Config: uses · PPO-specific training settings flow through the public API.
- Learner API → Skill Config: uses · Skill-tracking metadata is configured alongside learning.
- Learner → PPO Runtime: drives · Learner orchestrates the private PPO training runtime.
- PPO Runtime → Experience: collects · Training consumes buffered rollout experience.
- PPO Runtime → GAE: computes · Advantages and returns are derived before optimization.
- PPO Runtime → PPOLearner: optimizes · PPOLearner applies policy and value updates.
- PPO Runtime → Policy Versions: versions · Training checkpoints and policy lineage are tracked.
- PPO Runtime → Models: updates · Model definitions and optimizer utilities back the trainer.
- PPO Runtime → RLGymCPP: interacts · Rollouts and actions pass through the environment boundary.
- RLGymCPP → Game State: defines · Environment state is represented by game-state and player types.
- RLGymCPP → Obs + Reward: builds · Observations and rewards are derived from state.
- RLGymCPP → State + Termination: resets · State setters and terminal conditions shape episodes.
- RLGymCPP → RocketSim: drives · Environment creation and state mutation use the simulator.
- RocketSim → Sim Entities: contains · Arena, vehicle, ball, boost, and event subsystems.
- RocketSim → Bullet Physics: depends on · Simulation uses embedded Bullet physics internals.
- App Glue → RLBotCPP: connects · Executable wiring bridges to the RLBot runtime.
- RLBotCPP → Bot IO: implements · Bot process and socket layers move data to the game.
- RLBotCPP → Render + Match: provides · Rendering and match configuration are exposed here.
- App Glue → Learner API: uses · Root client code can invoke the learning framework.
- App Glue → RLBotCPP: uses · The executable also hosts the game integration boundary.
- Infer + Telemetry → Python Sidecars: emits · Metrics and render streams are consumed by Python helpers.
- PPO Runtime → Infer + Telemetry: reports · Training runtime publishes metrics and inference helpers.
- Checkpoint Tool → Policy Versions: converts · Checkpoint conversion supports versioned model lifecycle.
