TEST_CHARACTER_MOVEMENT_SPEEDS.md 3.5 KB

Test Character Movement Speeds Guide

Overview

Modified both BattleTestMode.cs and EnhancedBattleTestMode.cs to create two test characters with distinctly different movement speeds when no actual battle data exists.

IMPORTANT: The system uses EnhancedBattleTestMode.cs as the primary test mode, so both files were updated to ensure consistency.

Character Archetypes

Character 0: FastRogue (Very High Speed)

  • Name: FastRogue
  • Dexterity: 30
  • Expected Movement Speed: 50
  • Expected Agent Speed: 17.5
  • Calculation: 30 + (int)(Ceil((30-10)/5.0) * 5) = 30 + 20 = 50
  • Build: Lightning-fast character focused on extreme speed
  • Stats:
    • STR: 12, DEX: 30, CON: 14, WIS: 12, PER: 16
    • Health: 18, AC: 13

Character 1: SlowTank (Low Speed)

  • Name: SlowTank
  • Dexterity: 1
  • Expected Movement Speed: 25
  • Expected Agent Speed: 8.75
  • Calculation: 30 + (int)(Ceil((1-10)/5.0) * 5) = 30 + (-5) = 25
  • Build: Heavy, tanky character focused on durability
  • Stats:
    • STR: 16, DEX: 1, CON: 16, WIS: 14, PER: 10
    • Health: 25, AC: 11

Movement Speed Formula

MovementSpeed = 30 + (int)(Mathf.Ceil((Dexterity - 10) / 5.0f) * 5)

Speed Difference

  • FastRogue: 50 movement speed, 17.5 agent speed
  • SlowTank: 25 movement speed, 8.75 agent speed
  • Difference: 25 movement speed units (100% speed difference)
  • Agent Speed Difference: 2x faster (17.5 vs 8.75)

How to Test

  1. Load a battle scene with test mode enabled
  2. Ensure no existing battle data (BattleSetupData should be empty)
  3. Press 'C' to open character stats panel
  4. Click on each character to see their different movement speeds
  5. Watch the actual movement differences when giving move commands

Technical Details

  • Modified CreateBasicInventoryData() method in BattleTestMode.cs
  • Modified CreateTestPlayerData() method in EnhancedBattleTestMode.cs
  • Modified CreateTestTeam() method in CombatIntegrationTest.cs (likely the active system)
  • Added CreateSpecializedTestCharacters() method for character-specific stat creation
  • Replaced random stat generation with deliberate archetype-based stats
  • Movement speed is automatically calculated by the Character class based on Dexterity

Troubleshooting

If characters still show identical stats:

  1. Check that all three test systems are updated: BattleTestMode, EnhancedBattleTestMode, and CombatIntegrationTest
  2. Most likely cause: CombatIntegrationTest component has runTestOnStart = true and is overriding other test modes
  3. Enable forceClearExistingData in BattleTestMode component
  4. Check console logs for test mode activation messages
  5. Ensure no existing combat session data is overriding test data

Root Cause Analysis

The issue was caused by multiple factors:

  1. CombatIntegrationTest component creating "Test Warrior" and "Test Archer" characters
  2. HumanCharacter.InitializeStats() overriding combat data with hardcoded default values

The Problem Sequence:

  1. BattleTestMode correctly creates specialized characters with DEX:20 and DEX:4
  2. ApplyStatsFromCombatData correctly sets the character stats
  3. Character.Start() calls InitializeStats()
  4. HumanCharacter.InitializeStats() overwrites ALL stats with defaults (STR:10, DEX:3, CON:5, etc.)
  5. UI displays the hardcoded default values instead of the intended test values

The Solution:

Modified HumanCharacter.InitializeStats() to only apply default stats if combat data hasn't already been applied (checking if Strength == 0).