# balajikatyan/b-ace architecture

> Architecture diagram of the GitHub repository balajikatyan/b-ace, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/balajikatyan/b-ace
- Repository: https://github.com/balajikatyan/b-ace

## Overview

B-ACE is a Godot-based beyond-visual-range air-combat simulator with a Python PettingZoo interface for single- and multi-agent reinforcement learning. The main workflow is a Python agent or training script configuring and resetting the wrapper, exchanging actions and observations with the Godot simulation, and using the resulting rewards and episode outcomes to train or evaluate policies. The README documents this interaction; sampled Python files confirm the wrapper’s Godot transport and training integration. Some Godot internals and optional example integrations are represented at subsystem level because their implementations were not sampled.

Main entry points: [`b_ace_py/B_ACE_GodotPettingZooWrapper.py`](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/B_ACE_GodotPettingZooWrapper.py) (PettingZoo wrapper), [`Godot_Air_Combat/SimManager.gd`](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/SimManager.gd) (Air-combat simulation), [`run_simple_example.py`](https://github.com/balajikatyan/b-ace/blob/main/run_simple_example.py) (Simple runner), [`train_PPO.py`](https://github.com/balajikatyan/b-ace/blob/main/train_PPO.py) (PPO training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python["Python environment API"]
  node_pettingzoo["PettingZoo wrapper"]
  node_godot_env["Godot transport<br/>[godot_env.py]"]
  node_action_utils["Action conversion<br/>[utils.py]"]
  node_config["Environment config"]
end

subgraph group_godot["Godot simulation"]
  node_sim["Air-combat simulation<br/>[SimManager.gd]"]
  node_aircraft["Aircraft behavior<br/>[B_ACE.gd]"]
  node_fighter["Fighter component<br/>[Fighter.gd]"]
  node_detection["Detection<br/>[Detection.gd]"]
  node_missile["Missile component<br/>[Missile.gd]"]
  node_sensors["Observation sensors"]
  node_rewards["Reward functions"]
  node_visualization["Simulation UI<br/>[CanvasLayer.gd]"]
end

subgraph group_learning["Agent learning"]
  node_simple_example["Simple runner"]
  node_training["PPO training<br/>[train_PPO.py]"]
  node_training_multi["Multi-agent training<br/>[train_PPO_1.py]"]
  node_evaluation["Policy evaluation<br/>[eval.py]"]
  node_experiment["Experiment runner"]
end

subgraph group_inference["Policy inference"]
  node_onnx_inference["ONNX inference<br/>[ONNXInference.cs]"]
  node_session_config["Inference session setup"]
end

node_researcher(("Researcher or agent"))

node_researcher -->|"runs example"| node_simple_example
node_simple_example -->|"creates environment"| node_pettingzoo
node_pettingzoo -->|"delegates transport"| node_godot_env
node_pettingzoo -->|"converts actions"| node_action_utils
node_config -.->|"configures environment"| node_pettingzoo
node_pettingzoo -->|"launches and exchanges data"| node_sim
node_sim -->|"returns observations and outcomes"| node_pettingzoo
node_researcher -.->|"starts training"| node_training
node_training -->|"creates environment"| node_pettingzoo
node_researcher -.->|"starts training"| node_training_multi
node_training_multi -->|"creates environment"| node_pettingzoo
node_researcher -.->|"starts evaluation"| node_evaluation
node_evaluation -.->|"creates environment"| node_pettingzoo
node_researcher -.->|"runs scenarios"| node_experiment
node_onnx_inference -->|"configures session"| node_session_config

click node_simple_example "https://github.com/balajikatyan/b-ace/blob/main/run_simple_example.py"
click node_pettingzoo "https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/B_ACE_GodotPettingZooWrapper.py"
click node_godot_env "https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/godot_env.py"
click node_action_utils "https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/utils.py"
click node_config "https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/Default_B_ACE_config.json"
click node_sim "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/SimManager.gd"
click node_aircraft "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/B_ACE.gd"
click node_fighter "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Fighter.gd"
click node_detection "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Detection.gd"
click node_missile "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Missile.gd"
click node_sensors "https://github.com/balajikatyan/b-ace/tree/main/Godot_Air_Combat/addons/godot_rl_agents/sensors"
click node_rewards "https://github.com/balajikatyan/b-ace/tree/main/Godot_Air_Combat/addons/godot_rl_agents/rewards"
click node_visualization "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/gui/CanvasLayer.gd"
click node_training "https://github.com/balajikatyan/b-ace/blob/main/train_PPO.py"
click node_training_multi "https://github.com/balajikatyan/b-ace/blob/main/train_PPO_1.py"
click node_evaluation "https://github.com/balajikatyan/b-ace/blob/main/eval.py"
click node_experiment "https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/B_ACE_ExperimentWrapper.py"
click node_onnx_inference "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/ONNXInference.cs"
click node_session_config "https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs"

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_pettingzoo,node_godot_env,node_action_utils,node_config toneBlue
class node_sim,node_aircraft,node_fighter,node_detection,node_missile,node_sensors,node_rewards,node_visualization toneAmber
class node_simple_example,node_training,node_training_multi,node_evaluation,node_experiment toneMint
class node_onnx_inference,node_session_config toneRose
class node_researcher toneIndigo
```

## Components

### Python environment API

- [PettingZoo wrapper](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/B_ACE_GodotPettingZooWrapper.py): `b_ace_py/B_ACE_GodotPettingZooWrapper.py`
- [Godot transport](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/godot_env.py): `b_ace_py/godot_env.py`
- [Action conversion](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/utils.py): `b_ace_py/utils.py`
- [Environment config](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/Default_B_ACE_config.json): `b_ace_py/Default_B_ACE_config.json`

### Godot simulation

- [Air-combat simulation](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/SimManager.gd): `Godot_Air_Combat/SimManager.gd`
- [Aircraft behavior](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/B_ACE.gd): `Godot_Air_Combat/B_ACE.gd`
- [Fighter component](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Fighter.gd): `Godot_Air_Combat/components/Fighter.gd`
- [Detection](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Detection.gd): `Godot_Air_Combat/components/Detection.gd`
- [Missile component](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/components/Missile.gd): `Godot_Air_Combat/components/Missile.gd`
- [Observation sensors](https://github.com/balajikatyan/b-ace/tree/main/Godot_Air_Combat/addons/godot_rl_agents/sensors): `Godot_Air_Combat/addons/godot_rl_agents/sensors`
- [Reward functions](https://github.com/balajikatyan/b-ace/tree/main/Godot_Air_Combat/addons/godot_rl_agents/rewards): `Godot_Air_Combat/addons/godot_rl_agents/rewards`
- [Simulation UI](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/gui/CanvasLayer.gd): `Godot_Air_Combat/gui/CanvasLayer.gd`

### Agent learning

- [Simple runner](https://github.com/balajikatyan/b-ace/blob/main/run_simple_example.py): `run_simple_example.py`
- [PPO training](https://github.com/balajikatyan/b-ace/blob/main/train_PPO.py): `train_PPO.py`
- [Multi-agent training](https://github.com/balajikatyan/b-ace/blob/main/train_PPO_1.py): `train_PPO_1.py`
- [Policy evaluation](https://github.com/balajikatyan/b-ace/blob/main/eval.py): `eval.py`
- [Experiment runner](https://github.com/balajikatyan/b-ace/blob/main/b_ace_py/B_ACE_ExperimentWrapper.py): `b_ace_py/B_ACE_ExperimentWrapper.py`

### Policy inference

- [ONNX inference](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/ONNXInference.cs): `Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/ONNXInference.cs`
- [Inference session setup](https://github.com/balajikatyan/b-ace/blob/main/Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs): `Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/SessionConfigurator.cs`

### Other components

- **Researcher or agent**

## Connections

- Researcher or agent → Simple runner: runs example (evidence: `Readme.md`)
- Simple runner → PettingZoo wrapper: creates environment (evidence: `Readme.md`)
- PettingZoo wrapper → Godot transport: delegates transport (evidence: `b_ace_py/B_ACE_GodotPettingZooWrapper.py`)
- PettingZoo wrapper → Action conversion: converts actions (evidence: `b_ace_py/B_ACE_GodotPettingZooWrapper.py`)
- Environment config → PettingZoo wrapper: configures environment
- PettingZoo wrapper → Air-combat simulation: launches and exchanges data (evidence: `Readme.md`)
- Air-combat simulation → PettingZoo wrapper: returns observations and outcomes (evidence: `Readme.md`)
- Researcher or agent → PPO training: starts training
- PPO training → PettingZoo wrapper: creates environment (evidence: `train_PPO.py`)
- Researcher or agent → Multi-agent training: starts training
- Multi-agent training → PettingZoo wrapper: creates environment (evidence: `train_PPO_1.py`)
- Researcher or agent → Policy evaluation: starts evaluation
- Policy evaluation → PettingZoo wrapper: creates environment
- Researcher or agent → Experiment runner: runs scenarios
- ONNX inference → Inference session setup: configures session (evidence: `Godot_Air_Combat/addons/godot_rl_agents/onnx/csharp/ONNXInference.cs`)
