7 Commits

Author SHA1 Message Date
iTracerFacer
73560bdbf1 Let me examine all the tracking structures to ensure they don't accumulate indefinitely:
Read Moose_DynamicGroundBattle_Plugin.lua, lines 540 to 580

Read Moose_DynamicGroundBattle_Plugin.lua, lines 340 to 380

Read Moose_DynamicGroundBattle_Plugin.lua, lines 380 to 430

Now let me check where garrison data cleanup happens:

Read Moose_DynamicGroundBattle_Plugin.lua, lines 470 to 530

Good - I can see some cleanup is already happening. Now let me add comprehensive cleanup to ensure nothing accumulates. I need to add:

Periodic cleanup of old cooldown entries for groups that no longer exist
Cleanup of garrison data for zones that no longer exist or have been recaptured
Ensure marker cleanup is working properly
Moose_DynamicGroundBattle_Plugin.lua+106-5
Perfect! Now all tracking structures have comprehensive cleanup:

Memory Management Summary:
1. spawnedGroups ✓
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
2. groupGarrisonAssignments ✓
Cleaned when defenders die in CountAliveDefenders()
Cleaned when rotated out in TryDefenderRotation()
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
3. groupAttackCooldown ✓
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
4. zoneGarrisons ✓
Dead defenders removed in CountAliveDefenders() (called frequently)
Dead defenders removed in CleanupStaleData() every 10 minutes
Entire garrison data removed if zone no longer exists
lastPatrolTime sub-table cleaned for dead defenders
5. activeMarkers ✓
All markers removed and table cleared every 5 minutes in updateMarkPoints()
Improved to iterate backwards and properly nil out entries
6. Lua Garbage Collection ✓
Forced collectgarbage("collect") in CleanupStaleData() every 10 minutes
Ensures Lua VM reclaims memory from deleted tables
7. Enhanced Memory Logging ✓
Now tracks: Lua memory, Groups, Cooldowns, Garrisons, Defenders
Runs every 15 minutes
Visible in DCS logs for monitoring
All tracking structures now have multiple layers of cleanup to prevent memory accumulation. The combination of immediate cleanup (when groups die) and periodic comprehensive cleanup (every 10 minutes) ensures nothing builds up over long missions.
2025-11-22 19:45:33 -06:00
iTracerFacer
7eff0ba7b5 Units will only attack enemy zones within 15km
If no zones are in range, they'll stay as defenders or idle
This prevents the "path too long" error that caused the crash
You can adjust MAX_ATTACK_DISTANCE if needed (lower = more stable, higher = longer range attacks)

New Metrics Added:

Tracked Groups - Total number of groups being managed by the plugin (should match or be close to "Total Active Units")
Lua Memory - Current Lua script memory usage in MB
Warnings:
High memory warning if Lua memory > 500MB
High group count warning if > 200 groups
What to watch for:

Lua Memory steadily increasing over time = memory leak (groups not being cleaned up)
Tracked Groups != Total Active Units = dead groups not being removed from tracking table
Group count approaching MAX limits = might hit spawn caps
This will help you identify if memory is building up before it causes a crash. Check the F10 menu → Show System Statistics periodically during long missions to monitor these values.
2025-11-17 17:19:29 -06:00
iTracerFacer
0bdf775feb Fixed routing issues with defenders/attackers. 2025-11-17 12:05:26 -06:00
iTracerFacer
c42bf0451f Changed SpawnInZone(chosenZone, false) to SpawnInZone(chosenZone, true). Units will now spawn at random locations within their zone instead of clustering at the center. 2025-11-17 10:20:50 -06:00
iTracerFacer
827d999137 Expected Behavior Now:
 Units spawn in friendly zones
 Within 15 seconds, get orders to attack nearest enemy zone
 Move toward and engage enemy zones
 Only become defenders if there are no enemies to attack
 Stay focused on attacking unless their home zone is under attack
 Can be reassigned new targets every 600 seconds if they stop moving
2025-11-17 10:14:50 -06:00
iTracerFacer
f22816457c Moved ground battle plugin to dualcoalitioncapture as its' a requirement for plugin to work. 2025-11-17 07:48:33 -06:00
iTracerFacer
65dbf048d7 Initial Commit 2025-11-17 07:32:56 -06:00