# maptap/community-patch-dll architecture

> Architecture diagram of the GitHub repository maptap/community-patch-dll, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maptap/community-patch-dll
- Repository: https://github.com/maptap/community-patch-dll

## Overview

This repository is the C++ gameplay core and supporting libraries for a Civilization-style strategy game. The principal user-facing workflow is issuing game actions that update world and player state, with AI making its own decisions during play; the source tree identifies these subsystems, but the supplied excerpts do not show their runtime orchestration. The graph therefore marks those relationships as unverified. The sampled evidence does show connections among the database, localization, world-builder map data, and Lua exposure layers.

Main entry points: [`CvGameCoreDLL/CvGame.cpp`](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvGame.cpp) (Game runtime), [`CvGameCoreDLL/CvPlayerAI.cpp`](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlayerAI.cpp) (Player AI), [`CvGameDatabase/include/Database.h`](https://github.com/maptap/community-patch-dll/blob/master/CvGameDatabase/include/Database.h) (Database access), [`CvWorldBuilderMap/include/CvWorldBuilderMap.h`](https://github.com/maptap/community-patch-dll/blob/master/CvWorldBuilderMap/include/CvWorldBuilderMap.h) (World-builder maps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game state"]
  node_game["Game runtime<br/>[CvGame.cpp]"]
  node_map["World map<br/>[CvMap.cpp]"]
  node_plot["Plot state<br/>[CvPlot.cpp]"]
  node_city["City state<br/>[CvCity.cpp]"]
  node_unit["Unit state<br/>[CvUnit.cpp]"]
  node_playerstate["Player state<br/>[CvPlayer.cpp]"]
end

subgraph group_ai["Game AI"]
  node_turnai["Player AI<br/>[CvPlayerAI.cpp]"]
  node_economicai["Economic AI<br/>[CvEconomicAI.cpp]"]
  node_militaryai["Military AI<br/>[CvMilitaryAI.cpp]"]
  node_tacticalai["Tactical AI<br/>[CvTacticalAI.cpp]"]
  node_diplomacy["Diplomacy AI<br/>[CvDiplomacyAI.cpp]"]
end

subgraph group_integration["Runtime integration"]
  node_dllapi["DLL interfaces<br/>[CvDllInterfaces.h]"]
  node_lua["Lua bindings<br/>[CvLuaGame.cpp]"]
  node_worldbuilder["World-builder maps"]
end

subgraph group_support["Data and utilities"]
  node_database[("Database access<br/>[Database.h]")]
  node_localization["Localization<br/>[CvLocalization.h]"]
  node_dbutility["Game data cache"]
  node_ini["INI settings API<br/>[FIGameIniParser.h]"]
  node_luaexposure["Lua type exposure<br/>[FLuaTypeExposure.h]"]
  node_plotmanager["Plot unit index<br/>[CvPlotManager.h]"]
end

node_player(("Player"))

node_player -.->|"issues actions"| node_game
node_game -.->|"updates state"| node_playerstate
node_game -.->|"updates world"| node_map
node_game -.->|"runs decisions"| node_turnai
node_turnai -.->|"delegates"| node_economicai
node_turnai -.->|"delegates"| node_militaryai
node_turnai -.->|"delegates"| node_diplomacy
node_militaryai -.->|"uses"| node_tacticalai
node_dllapi -.->|"exposes interface"| node_game
node_lua -.->|"exposes actions"| node_game
node_worldbuilder -.->|"stores map data"| node_map
node_localization -->|"initializes from"| node_database
node_database -.->|"supplies cached data"| node_dbutility
node_ini -->|"uses file definitions"| node_database
node_plotmanager -.->|"indexes units"| node_plot
node_worldbuilder -.->|"uses type exposure"| node_luaexposure

click node_game "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvGame.cpp"
click node_map "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvMap.cpp"
click node_plot "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlot.cpp"
click node_city "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvCity.cpp"
click node_unit "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvUnit.cpp"
click node_playerstate "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlayer.cpp"
click node_turnai "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlayerAI.cpp"
click node_economicai "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvEconomicAI.cpp"
click node_militaryai "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvMilitaryAI.cpp"
click node_tacticalai "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvTacticalAI.cpp"
click node_diplomacy "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvDiplomacyAI.cpp"
click node_dllapi "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLLUtil/include/CvDllInterfaces.h"
click node_lua "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/Lua/CvLuaGame.cpp"
click node_worldbuilder "https://github.com/maptap/community-patch-dll/blob/master/CvWorldBuilderMap/include/CvWorldBuilderMap.h"
click node_database "https://github.com/maptap/community-patch-dll/blob/master/CvGameDatabase/include/Database.h"
click node_localization "https://github.com/maptap/community-patch-dll/blob/master/CvLocalization/include/CvLocalization.h"
click node_dbutility "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLLUtil/include/ICvDLLDatabaseUtility.h"
click node_ini "https://github.com/maptap/community-patch-dll/blob/master/FirePlace/include/FireWorks/FIGameIniParser.h"
click node_luaexposure "https://github.com/maptap/community-patch-dll/blob/master/FirePlace/include/FireWorks/Flua/include/FLuaTypeExposure.h"
click node_plotmanager "https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL_Expansion2/CvPlotManager.h"

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_game,node_map,node_plot,node_city,node_unit,node_playerstate toneBlue
class node_turnai,node_economicai,node_militaryai,node_tacticalai,node_diplomacy toneAmber
class node_dllapi,node_lua,node_worldbuilder toneMint
class node_database,node_localization,node_dbutility,node_ini,node_luaexposure,node_plotmanager toneRose
class node_player toneIndigo
```

## Components

### Game state

- [Game runtime](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvGame.cpp): `CvGameCoreDLL/CvGame.cpp`
- [World map](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvMap.cpp): `CvGameCoreDLL/CvMap.cpp`
- [Plot state](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlot.cpp): `CvGameCoreDLL/CvPlot.cpp`
- [City state](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvCity.cpp): `CvGameCoreDLL/CvCity.cpp`
- [Unit state](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvUnit.cpp): `CvGameCoreDLL/CvUnit.cpp`
- [Player state](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlayer.cpp): `CvGameCoreDLL/CvPlayer.cpp`

### Game AI

- [Player AI](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvPlayerAI.cpp): `CvGameCoreDLL/CvPlayerAI.cpp`
- [Economic AI](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvEconomicAI.cpp): `CvGameCoreDLL/CvEconomicAI.cpp`
- [Military AI](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvMilitaryAI.cpp): `CvGameCoreDLL/CvMilitaryAI.cpp`
- [Tactical AI](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvTacticalAI.cpp): `CvGameCoreDLL/CvTacticalAI.cpp`
- [Diplomacy AI](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/CvDiplomacyAI.cpp): `CvGameCoreDLL/CvDiplomacyAI.cpp`

### Runtime integration

- [DLL interfaces](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLLUtil/include/CvDllInterfaces.h): `CvGameCoreDLLUtil/include/CvDllInterfaces.h`
- [Lua bindings](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL/Lua/CvLuaGame.cpp): `CvGameCoreDLL/Lua/CvLuaGame.cpp`
- [World-builder maps](https://github.com/maptap/community-patch-dll/blob/master/CvWorldBuilderMap/include/CvWorldBuilderMap.h): `CvWorldBuilderMap/include/CvWorldBuilderMap.h`

### Data and utilities

- [Database access](https://github.com/maptap/community-patch-dll/blob/master/CvGameDatabase/include/Database.h): `CvGameDatabase/include/Database.h`
- [Localization](https://github.com/maptap/community-patch-dll/blob/master/CvLocalization/include/CvLocalization.h): `CvLocalization/include/CvLocalization.h`
- [Game data cache](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLLUtil/include/ICvDLLDatabaseUtility.h): `CvGameCoreDLLUtil/include/ICvDLLDatabaseUtility.h`
- [INI settings API](https://github.com/maptap/community-patch-dll/blob/master/FirePlace/include/FireWorks/FIGameIniParser.h): `FirePlace/include/FireWorks/FIGameIniParser.h`
- [Lua type exposure](https://github.com/maptap/community-patch-dll/blob/master/FirePlace/include/FireWorks/Flua/include/FLuaTypeExposure.h): `FirePlace/include/FireWorks/Flua/include/FLuaTypeExposure.h`
- [Plot unit index](https://github.com/maptap/community-patch-dll/blob/master/CvGameCoreDLL_Expansion2/CvPlotManager.h): `CvGameCoreDLL_Expansion2/CvPlotManager.h`

### Other components

- **Player**

## Connections

- Player → Game runtime: issues actions
- Game runtime → Player state: updates state
- Game runtime → World map: updates world
- Game runtime → Player AI: runs decisions
- Player AI → Economic AI: delegates
- Player AI → Military AI: delegates
- Player AI → Diplomacy AI: delegates
- Military AI → Tactical AI: uses
- DLL interfaces → Game runtime: exposes interface
- Lua bindings → Game runtime: exposes actions
- World-builder maps → World map: stores map data
- Localization → Database access: initializes from (evidence: `CvLocalization/include/CvLocalization.h`)
- Database access → Game data cache: supplies cached data
- INI settings API → Database access: uses file definitions (evidence: `FirePlace/include/FireWorks/FIGameIniParser.h`)
- Plot unit index → Plot state: indexes units
- World-builder maps → Lua type exposure: uses type exposure
