Use this guide to balance enemy behavior and how often units spawn along paths from source buildings (Tower/Factory), plus enemy AI strength tiers:|
- building field "_strength" (EnemyStrengthTier)
- GameConfig "EnemyBuildingAI" delays
- GameConfig "UnitSpawnIntervals"
What "_strength" Means
- "_strength" is a field on BuildingView (EnemyStrengthTier).
- Available tiers:
- Weak
- Medium
- Strong
- This tier is used by EnemyBuildingAIModule to select AI delay values from GameConfig "EnemyBuildingAI".
Where "_strength" Is Visible in Inspector
- "_strength" is shown in BuildingView inspector only when "_teamID" is an enemy team.
- If "_teamID" is Player or Neutral, "_strength" is hidden by the custom editor.
- To edit it:
- Open level prefab
- Select the building object (Tower, Factory, or Artillery)
- Set "_teamID" to enemy team (Red/Yellow/Green/Violet/Magenta/Cyan)
- Edit "_strength" field that appears under team settings
Important Scope Rules
- Enemy AI logic runs only for teams that are not Player and not Neutral.
- So "_strength" affects AI behavior only when a building is on an enemy team.
- For Neutral or Player buildings, this tier does not drive enemy AI timers.
How Tier Affects Enemy AI
- Tower/Factory enemy buildings:
- Use "_strength" to choose "PathDelaySeconds" in "EnemyBuildingAI"
- Lower delay = more frequent path creation attempts
- Artillery enemy buildings:
- Use "_strength" to choose "ArtilleryAimDelaySeconds" in "EnemyBuildingAI"
- Lower delay = more frequent target re-aim updates
Where to Configure Tier Delays
- Open GameConfig asset: Assets/GorodiskiGames/TowerClash/Resources/GameConfig.asset
- Configure:
- "EnemyBuildingAI.Weak.PathDelaySeconds"
- "EnemyBuildingAI.Weak.ArtilleryAimDelaySeconds"
- "EnemyBuildingAI.Medium.PathDelaySeconds"
- "EnemyBuildingAI.Medium.ArtilleryAimDelaySeconds"
- "EnemyBuildingAI.Strong.PathDelaySeconds"
- "EnemyBuildingAI.Strong.ArtilleryAimDelaySeconds"
How Unit Spawn Rate Works
- Unit spawning along active paths is handled by UnitsModule.
- Spawn interval is selected by source building level from GameConfig "UnitSpawnIntervals".
- Mapping:
- level 1 uses "UnitSpawnIntervals"[0]
- level 2 uses "UnitSpawnIntervals"[1]
- level 3 uses "UnitSpawnIntervals"[2]
- if level is higher than array length, last array value is used
- Safety behavior:
- if array is missing/empty, fallback interval is 1 second
- interval is clamped to minimum 0.01 seconds
Where to Configure Spawn Rate
- Open GameConfig asset: Assets/GorodiskiGames/TowerClash/Resources/GameConfig.asset
- Edit "UnitSpawnIntervals" values.
- Lower value = faster spawning.
Main Procedure: Balance Enemy Pressure
Step 1: Set Building Tier in Level Prefab
- Open your level prefab.
- Select enemy Tower, Factory, or Artillery buildings.
- Set BuildingView "_strength" to Weak, Medium, or Strong.
Step 2: Tune Tier Delays
- Open GameConfig "EnemyBuildingAI".
- Start with Medium as baseline.
- Set Weak delays higher than Medium.
- Set Strong delays lower than Medium.