# marcos2221/dcs_tpe architecture

> Architecture diagram of the GitHub repository marcos2221/dcs_tpe, 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/marcos2221/dcs_tpe
- Repository: https://github.com/marcos2221/dcs_tpe

## Overview

DCS_TPE is a DCS mission-persistence system for single- and multiplayer missions. A mission designer loads MIST, CTLD, and CSAR in timed mission triggers, then runs the persistence loader; TPE saves mission progress to files and uses those files to restore correctly named groups on later loads. The README also documents a TPE hook, a network-side script, JSON, and a generated configuration file. Source excerpts were unavailable, so the internal call paths and several integrations remain undocumented.

Main entry points: [`Scripts/net/TPE/mainPersitentEgineNet.lua`](https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/net/TPE/mainPersitentEgineNet.lua) (Network engine), [`PersistentMissionFileLoad.lua`](https://github.com/marcos2221/dcs_tpe/blob/master/PersistentMissionFileLoad.lua) (Mission loader), [`Scripts/Hooks/TPE.lua`](https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/Hooks/TPE.lua) (TPE hook), [`JSON.lua`](https://github.com/marcos2221/dcs_tpe/blob/master/JSON.lua) (JSON support)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mission["Mission runtime"]
  node_triggers["Timed triggers"]
  node_mist["MIST<br/>[mist_4_3_74.lua]"]
  node_ctld["CTLD<br/>[CTLD.lua]"]
  node_csar["CSAR<br/>[CSAR.lua]"]
  node_loader["Mission loader"]
end

subgraph group_tpe["TPE runtime"]
  node_hook["TPE hook<br/>[TPE.lua]"]
  node_netengine["Network engine"]
  node_json["JSON support<br/>[JSON.lua]"]
  node_scripting["Mission scripting setup"]
end

subgraph group_state["Persistence state"]
  node_savedir[("TPE save directory")]
  node_missionfile["Mission state file"]
  node_config["TPE config"]
end

node_designer(("Mission designer"))
node_dcs["DCS runtime"]

node_designer -->|"configures"| node_triggers
node_triggers -->|"loads first"| node_mist
node_triggers -->|"loads second"| node_ctld
node_triggers -->|"loads third"| node_csar
node_triggers -->|"runs afterward"| node_loader
node_dcs -->|"hosts"| node_hook
node_dcs -->|"hosts"| node_netengine
node_hook -.->|"creates"| node_savedir
node_netengine -.->|"uses"| node_savedir
node_savedir -->|"holds"| node_missionfile
node_savedir -->|"holds"| node_config
node_loader -.->|"restores from"| node_missionfile
node_json -.->|"supports"| node_netengine
node_scripting -.->|"configures"| node_dcs

click node_mist "https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/mist_4_3_74.lua"
click node_ctld "https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/CTLD.lua"
click node_csar "https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/CSAR.lua"
click node_loader "https://github.com/marcos2221/dcs_tpe/blob/master/PersistentMissionFileLoad.lua"
click node_hook "https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/Hooks/TPE.lua"
click node_netengine "https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/net/TPE/mainPersitentEgineNet.lua"
click node_json "https://github.com/marcos2221/dcs_tpe/blob/master/JSON.lua"
click node_scripting "https://github.com/marcos2221/dcs_tpe/blob/master/SlmodMissionScripting.lua"

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_triggers,node_mist,node_ctld,node_csar,node_loader toneBlue
class node_hook,node_netengine,node_json,node_scripting toneAmber
class node_savedir,node_missionfile,node_config toneMint
class node_designer,node_dcs toneIndigo
```

## Components

### Mission runtime

- **Timed triggers**
- [MIST](https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/mist_4_3_74.lua): `CTLD_CSAR/mist_4_3_74.lua`
- [CTLD](https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/CTLD.lua): `CTLD_CSAR/CTLD.lua`
- [CSAR](https://github.com/marcos2221/dcs_tpe/blob/master/CTLD_CSAR/CSAR.lua): `CTLD_CSAR/CSAR.lua`
- [Mission loader](https://github.com/marcos2221/dcs_tpe/blob/master/PersistentMissionFileLoad.lua): `PersistentMissionFileLoad.lua`

### TPE runtime

- [TPE hook](https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/Hooks/TPE.lua): `Scripts/Hooks/TPE.lua`
- [Network engine](https://github.com/marcos2221/dcs_tpe/blob/master/Scripts/net/TPE/mainPersitentEgineNet.lua): `Scripts/net/TPE/mainPersitentEgineNet.lua`
- [JSON support](https://github.com/marcos2221/dcs_tpe/blob/master/JSON.lua): `JSON.lua`
- [Mission scripting setup](https://github.com/marcos2221/dcs_tpe/blob/master/SlmodMissionScripting.lua): `SlmodMissionScripting.lua`

### Persistence state

- **TPE save directory**
- **Mission state file**
- **TPE config**

### Other components

- **Mission designer**
- **DCS runtime**

## Connections

- Mission designer → Timed triggers: configures (evidence: `README.md`)
- Timed triggers → MIST: loads first (evidence: `README.md`)
- Timed triggers → CTLD: loads second (evidence: `README.md`)
- Timed triggers → CSAR: loads third (evidence: `README.md`)
- Timed triggers → Mission loader: runs afterward (evidence: `README.md`)
- DCS runtime → TPE hook: hosts (evidence: `README.md`)
- DCS runtime → Network engine: hosts (evidence: `README.md`)
- TPE hook → TPE save directory: creates
- Network engine → TPE save directory: uses
- TPE save directory → Mission state file: holds (evidence: `README.md`)
- TPE save directory → TPE config: holds (evidence: `README.md`)
- Mission loader → Mission state file: restores from
- JSON support → Network engine: supports
- Mission scripting setup → DCS runtime: configures
