How pratyushwinorlearn/adaptive-combat-simulation works
Adaptive Combat Simulation is a Unity sword-combat game: player input and an ML-Agents PPO antagonist drive combat against one another, producing damage, reactions, health and episode rewards. The README documents the ONNX inference model, training configs, combat actions, animator states, collider hit detection and arena presentation. With no source excerpts, relationships below are limited to explicit README statements; listed script paths are grounded in the repository tree, but their internal call structure is not verified.
Main entry points: CombatActions.cs Combat actions · AdaptiveCombatAgent.cs Antagonist agent · SampleScene.unity Combat scene · DamageSystem.cs Damage system
Components 30
Combat runtime
- Player input
Assets/Scripts/Player/PlayerInputController.cs - Playable fighter
Assets/Scripts/Player/CharacterCombatController.cs - Combat perception
Assets/Scripts/Combat/CombatPerception.cs - Combat observer
Assets/Scripts/Combat/CombatObserver.cs - Opponent observer
Assets/Scripts/Combat/CombatOpponentObserver.cs - Combat actions
Assets/Scripts/Combat/CombatActions.cs - Attack definitions
Assets/Scripts/Combat/AttackData.cs - Attack assets
Assets/Combat/Attacks/LightAttack.asset - Sword hit detection
Assets/Scripts/Combat/SwordHitbox.cs - Damage system
Assets/Scripts/Combat/DamageSystem.cs - Health state
Assets/Scripts/Combat/Health.cs - Block action
Assets/Scripts/Combat/BlockController.cs - Dodge action
Assets/Scripts/Combat/DodgeController.cs - Hit reaction
Assets/Scripts/Combat/HitStunController.cs - Episode management
Assets/Scripts/Combat/CombatEpisodeManager.cs - Combat events
Assets/Scripts/Combat/CombatEventSignals.cs - Episode statistics
Assets/Scripts/Database/EpisodeStats.cs
Adaptive opponent
- Antagonist agent
Assets/Scripts/AI/AdaptiveCombatAgent.cs - ONNX policy
Models/AdaptiveCombat.onnx - AI action control
Assets/Scripts/AI/AIActionController.cs - Training opponent
Assets/Scripts/AI/TrainingOpponentController.cs - Reward shaping
Assets/Scripts/Combat/CombatRewardController.cs
Game presentation
- Combat scene
Assets/Scenes/SampleScene.unity - Fighter movement
Assets/Scripts/Combat/PlayerMovement.cs - Third-person camera
Assets/Scripts/Camera/ThirdPersonCamera.cs - Health displays
Assets/Scripts/Combat/HealthBarUI.cs - Attack telegraph
Assets/Scripts/Combat/AttackTelegraph.cs - Animation events
Assets/Scripts/Combat/CombatAnimationEvents.cs
Other components
- Player
- Unity ML-Agents
Connections 25
- Player → Player input: provides input
README.md - Player input → Playable fighter: drives combat
README.md - Antagonist agent → ONNX policy: runs inference
README.md - Unity ML-Agents → Antagonist agent: hosts agent
README.md - Antagonist agent → AI action control: selects actions
- Antagonist agent → Combat perception: observes combat
- Playable fighter → Combat actions: performs actions
README.md - AI action control → Combat actions: performs actions
- Combat actions → Attack assets: uses attacks
README.md - Combat actions → Sword hit detection: uses colliders
README.md - Sword hit detection → Damage system: detects hits
README.md - Damage system → Health state: changes health
- Combat actions → Block action: supports blocking
README.md - Combat actions → Dodge action: supports dodging
README.md - Damage system → Hit reaction: triggers reaction
- Antagonist agent → Reward shaping: receives rewards
README.md - Reward shaping → Combat events: uses combat events
README.md - Episode management → Episode statistics: records statistics
- Combat scene → Playable fighter: hosts fighter
- Combat scene → Antagonist agent: hosts antagonist
- Combat scene → Third-person camera: presents scene
- Combat scene → Fighter movement: hosts movement
- Health state → Health displays: displays health
- Combat actions → Attack telegraph: telegraphs attacks
- Training opponent → Unity ML-Agents: supports training