Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"mcp__enfusion-mcp__wb_stop",
"mcp__enfusion-mcp__wb_cleanup",
"mcp__enfusion-mcp__game_browse",
"mcp__enfusion-mcp__asset_search"
"mcp__enfusion-mcp__asset_search",
"mcp__enfusion-mcp__wiki_search",
"mcp__enfusion-mcp__game_read",
"mcp__enfusion-mcp__wb_reload",
"mcp__enfusion-mcp__script_create"
]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ CHANGELOG.md

# Enfusion files
*.rdb

EMCP_*
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Turret : "{8094D99689ABE241}Prefabs/Weapons/Mortars/M252/Mortar_M252.et" {
ID "5CF87D15B3D0A976"
coords 1511.126 59.987 5799.793
{
GenericEntity : "{E1FD1ACDA98123AE}Prefabs/Props/Military/Arsenal/AmmoBoxes/US/AmmoBoxArsenal_Mortar_US.et" {
ID "68E9081877B677E6"
coords -1.405 0 -1.168
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MetaFileClass {
Name "{7C420F3570791EF7}Prefabs/Compositions/DiD_MortarComposition_US.et.et"
Configurations {
EntityTemplateResourceClass PC {
}
EntityTemplateResourceClass XBOX_ONE : PC {
}
EntityTemplateResourceClass XBOX_SERIES : PC {
}
EntityTemplateResourceClass PS4 : PC {
}
EntityTemplateResourceClass PS5 : PC {
}
EntityTemplateResourceClass HEADLESS : PC {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
AFM_ArtillerySpawnPointEntity {
ID "68E8977F8944C994"
components {
Hierarchy "{68E8977FB8D3EE43}" {
}
}
coords 1595.344 62.209 5842.046
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MetaFileClass {
Name "{1933061551525F98}Prefabs/MP/AFM_ArtillerySpawnPointEntity.et"
Configurations {
EntityTemplateResourceClass PC {
}
EntityTemplateResourceClass XBOX_ONE : PC {
}
EntityTemplateResourceClass XBOX_SERIES : PC {
}
EntityTemplateResourceClass PS4 : PC {
}
EntityTemplateResourceClass PS5 : PC {
}
EntityTemplateResourceClass HEADLESS : PC {
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
AFM_DiDAttackerDirector {
ID "68E743D4FAF810B0"
components {
Hierarchy "{68E8977847AE5892}" {
}
}
coords 1614.726 60.796 5902.434
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MetaFileClass {
Name "{C88B368A8AC21F4E}Prefabs/MP/AFM_DiDAttackerDirector_Default.et"
Configurations {
EntityTemplateResourceClass PC {
}
EntityTemplateResourceClass XBOX_ONE : PC {
}
EntityTemplateResourceClass XBOX_SERIES : PC {
}
EntityTemplateResourceClass PS4 : PC {
}
EntityTemplateResourceClass PS5 : PC {
}
EntityTemplateResourceClass HEADLESS : PC {
}
}
}
18 changes: 18 additions & 0 deletions addons/DefenseInDepth/Prefabs/MP/AFM_DiDZoneArtilleryPrefab.et
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
AFM_DiDZoneArtillery {
ID "68E8977F96335319"
components {
Hierarchy "{68E897785EED2C48}" {
}
}
coords 1603.758 62.301 5838.798
m_sMortarPrefab "{7C420F3570791EF7}Prefabs/Compositions/DiD_MortarComposition_US.et.et"
m_CrewConfig AFM_CrewConfig "{68E8977FD9DC91CF}" {
m_sGunnerPrefab "{EBFB363AC7A5FCE6}Prefabs/Characters/Factions/OPFOR/USSR_Army/Character_USSR_Engineer.et"
m_bSpawnDriver 0
m_bNoTurretDismount 0
}
m_iHECooldownSeconds 90
m_iSmokeCooldownSeconds 60
m_iIllumCooldownSeconds 180
m_fSampleRadius 25
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MetaFileClass {
Name "{2D68BCDEA841A4BC}Prefabs/MP/AFM_DiDZoneArtilleryPrefab.et"
Configurations {
EntityTemplateResourceClass PC {
}
EntityTemplateResourceClass XBOX_ONE : PC {
}
EntityTemplateResourceClass XBOX_SERIES : PC {
}
EntityTemplateResourceClass PS4 : PC {
}
EntityTemplateResourceClass PS5 : PC {
}
EntityTemplateResourceClass HEADLESS : PC {
}
}
}
24 changes: 24 additions & 0 deletions addons/DefenseInDepth/Scripts/Game/DiD/AFM_DiDAttackPhase.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------------------------
//! Attack phase driven by remaining budget ratio.
//! PROBE → ASSAULT → FINAL as the attacker spends down their points pool.
enum EAFMAttackPhase
{
PROBE, //! Budget > 75% — infantry probe, test defender positions
ASSAULT, //! Budget 75%–25% — all options active, peak pressure
FINAL //! Budget < 25% — spend aggressively, bonus to all options
}

//------------------------------------------------------------------------------------------------
//! Snapshot of battlefield conditions built by AFM_DiDAttackerDirector each decision cycle.
//! Passed read-only to AFM_DiDSpawnerComponent.ScoreRequest() and AFM_DiDZoneArtillery scoring.
class AFM_DiDBattlefieldState
{
int m_iDefenderCount; //! Alive defenders (blufor)
int m_iAICountInZone; //! Enemy AI currently inside the zone boundary
int m_iTotalActiveAI; //! Total AI tracked by all spawners (includes outside zone)
float m_fBudgetRatio; //! Remaining budget / total (1.0 when no budget system is active)
float m_fTimeRatio; //! Remaining time / total defense time (1.0 = just started, 0.0 = expired)
float m_fDefenderDensity; //! Alive defender count as a float — used by artillery to decide HE missions
EAFMAttackPhase m_ePhase; //! Attack phase derived from budget ratio
bool m_bIsNight; //! True when TimeAndWeatherManagerEntity.IsSunSet() returns true
}
72 changes: 72 additions & 0 deletions addons/DefenseInDepth/Scripts/Game/DiD/AFM_DiDAttackerBudget.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//------------------------------------------------------------------------------------------------
//! Tracks the attacker's points budget for a zone.
//! Budget is spent when AI is spawned. When exhausted and all AI cleared,
//! the zone transitions to FINISHED_REPELLED (defender victory).
//!
//! Usage:
//! Before spawn: if (!budget.CanAfford(cost)) return;
//! After spawn: budget.Consume(actualAgentCount * costPerUnit);
//------------------------------------------------------------------------------------------------
class AFM_DiDAttackerBudget
{
protected int m_iTotal;
protected int m_iRemaining;

//------------------------------------------------------------------------------------------------
void AFM_DiDAttackerBudget(int total)
{
m_iTotal = total;
m_iRemaining = total;
}

//------------------------------------------------------------------------------------------------
//! Returns true if at least 'cost' points are available
bool CanAfford(int cost)
{
return m_iRemaining >= cost;
}

//------------------------------------------------------------------------------------------------
//! Deduct points. Clamps to zero — never goes negative.
void Consume(int cost)
{
m_iRemaining = Math.Max(0, m_iRemaining - cost);
PrintFormat("AFM_DiDAttackerBudget: Consumed %1 pts — %2/%3 remaining",
cost, m_iRemaining, m_iTotal, level: LogLevel.DEBUG);
}

//------------------------------------------------------------------------------------------------
//! Add bonus points (e.g. rollover from a failed previous zone)
void AddBonus(int bonus)
{
m_iRemaining += bonus;
m_iTotal += bonus;
PrintFormat("AFM_DiDAttackerBudget: +%1 bonus pts — %2/%3 remaining",
bonus, m_iRemaining, m_iTotal);
}

//------------------------------------------------------------------------------------------------
bool IsExhausted()
{
return m_iRemaining <= 0;
}

//------------------------------------------------------------------------------------------------
int GetRemaining()
{
return m_iRemaining;
}

int GetTotal()
{
return m_iTotal;
}

//! 0.0 = exhausted, 1.0 = full budget
float GetRatio()
{
if (m_iTotal == 0)
return 0;
return m_iRemaining / (float)m_iTotal;
}
}
Loading