¶ AI Commanding System
The AI Commanding system allows players to recruit and command AI civilians in Overthrow. This comprehensive system enables players to build their own squad of AI-controlled resistance fighters who can assist in various operations.
The AI Commanding feature is production-ready with all designed functionality implemented and active in the game.
- Type: Singleton Manager Component (1,728 lines)
- Location:
Scripts/Game/GameMode/Managers/OVT_RecruitManagerComponent.c
- Purpose: Central interface for all recruit operations
Key Features:
- Recruit creation, management, and lifecycle
- EPF persistence with automatic save/load
- XP system with leveling and skill tracking
- Group management and AI integration
- Network replication for multiplayer
- Online/offline state management with despawning timers
- Death handling and cleanup
- Equipment and inventory management
- Location:
Scripts/Game/UserActions/OVT_RecruitCivilianAction.c
- Purpose: User action for recruiting civilians
- Features: Cost validation, faction checking, recruitment limits
- Location:
Scripts/Game/Data/OVT_RecruitData.c
- Purpose: Data structure for individual recruit information
- Persistence: Full EPF integration with character entity persistence
- Basic Recruitment: Recruit civilians directly from the street ($1000 default)
- Cost-Based System: Configurable via difficulty settings
- Limit Enforcement: Maximum 16 recruits per player
- Faction Integration: Automatic group assignment with CIV faction
- EPF Integration: Full character persistence using existing framework
- Unique IDs: Format:
recruit_<ownerPersistentId>_<sequence>
- Character Data: Position, inventory, equipment, health automatically saved
- Cross-Session: Recruits persist across game sessions
- Automatic Groups: Players spawn with groups for recruit management
- AI Integration: Full compatibility with Arma Reforger's AI commanding
- Command System: Standard AI waypoints, formations, and orders
- Multiplayer Support: Network-synchronized group operations
- XP and Leveling: Recruits gain experience from combat and activities
- Skill Tracking: Individual skill progression per recruit
- Death Handling: Permanent death with equipment recovery
- Status Tracking: Real-time alive/dead/distance monitoring
- Remote Inventory: Access recruit inventories without proximity
- Manual Equipping: Full control over recruit equipment
- Loadout Integration: Compatible with Loadout Manager system
- Attachment Support: Weapon attachments and modifications
- Connection Handling: Automatic recruit spawning when players connect
- Offline Timers: 10-minute despawn timer when players disconnect
- State Preservation: Recruit state maintained during offline periods
- Performance Optimization: Memory management for offline players
- Player uses
OVT_RecruitCivilianAction
on civilian character
- Civilian entity converted to recruit with EPF persistence
- Unique persistent ID assigned
- Registration with
OVT_RecruitManagerComponent
- Addition to player's group using existing group system
// Player connects
OVT_RecruitManagerComponent.OnPlayerConnected()
→ Cancel offline timer
→ Query EPF database for recruits
→ Async spawn recruit entities
→ Rejoin to player group
// Player disconnects
OVT_RecruitManagerComponent.OnPlayerDisconnected()
→ Start 10-minute offline timer
→ Save all recruit states via EPF
→ Continue tracking in world until timeout
- Quick Reconnection: Recruits remain in world if player returns within 10 minutes
- Timeout Handling: Recruits despawned but database records preserved
- Performance: Only load recruits for online players
- EPF_PersistenceComponent: Added automatically to recruited characters
- Full State Saving: Position, rotation, inventory, equipment, health, stance
- Automatic Management: No manual save/load timing required
- Change Tracking: EPF optimizes database writes
- Manager Component: Stores recruit ownership and progression data
- Separate Storage: Character data and metadata stored independently
- Database Efficiency: Only essential metadata in manager save data
The system includes full multiplayer support:
- Group Replication: AI groups synchronized across clients
- State Updates: Recruit status updates broadcast to players
- Command Propagation: AI orders replicated to all clients
- Connection Events: Player connect/disconnect handled server-side
- AI Commanding: Full compatibility with Arma Reforger's AI command system
- Group Management: Uses existing faction and group infrastructure
- Character System: Leverages CharacterIdentity for names and appearance
- Economy: Recruitment costs integrated with player currency
- Faction System: CIV faction assignment and wanted level inheritance
- Persistence: EPF integration for cross-session recruit survival
- Loadout Manager: Compatible with loadout save/apply functionality
- Recruit List: View all active recruits with status
- Rename System: Custom names with proper CharacterIdentity updates
- Dismiss Function: Remove recruits with confirmation dialogs
- Status Display: Real-time alive/dead/distance information
- Controller Support: Full keyboard/controller navigation
- Remote Access: Manage recruit inventories from any distance
- Equipment Transfer: Move items to/from recruit inventories
- Loadout Application: Apply saved loadouts to recruits
- Attachment Management: Handle weapon modifications and attachments
- Staggered Loading: Async EPF loading prevents server hitches
- Timer Optimization: 1-second resolution for offline processing
- Selective Loading: Only spawn recruits for online players
- Change Tracking: EPF minimizes unnecessary database operations
- Per-Player Limits: Maximum 16 recruits per player
- State Management: Efficient group and AI state replication
- Database Optimization: Individual recruit storage prevents large save files
- Network Efficiency: Minimal RPC traffic for routine operations
- Recruitment Cost: Configurable per difficulty level
- Max Recruits: Server-configurable player limits
- Experience Rates: Adjustable XP gain multipliers
- Death Penalties: Configurable permanent death settings
- EPF Settings: Database location and backup configuration
- Performance Tuning: Offline timer duration and cleanup intervals
- Group Limits: Maximum AI entities per group
- Persistence Options: Save frequency and optimization settings
// Player approaches civilian
// Right-click → "Recruit Civilian" action appears
// Cost validation and limit checking
// Civilian converted to recruit and added to player group
// Access via recruit management UI
// Remote inventory interface opens
// Transfer equipment to/from recruit
// Apply saved loadouts with one click
¶ Command Operations
// Use standard Arma Reforger AI commands
// Recruits respond to waypoints and formations
// Group operations synchronized in multiplayer
// State persists across game sessions
While the core system is complete, potential future additions include:
- Training Centers: Specialized buildings for recruit advancement
- Skill Specialization: Role-based skill trees and specializations
- Squad Operations: Advanced group tactics and automated behaviors
- Logistics Commands: Automated looting and supply operations
The AI Commanding system represents a mature, production-ready feature that significantly enhances the Overthrow gameplay experience with sophisticated AI recruitment and management capabilities.