BATTLE_SCENE_TEST_MODE_GUIDE.md 7.2 KB

Battle Scene Test Mode Guide

This guide explains how to use the test modes for the battle scene to quickly create test characters and enemies for development and testing purposes.

Overview

Two test mode scripts have been created to help with battle scene testing:

  1. BattleTestMode.cs - Basic test mode for simple character creation
  2. EnhancedBattleTestMode.cs - Advanced test mode with full combat data and realistic stats

Basic Test Mode (BattleTestMode)

Features

  • ✅ Creates test player and enemy characters automatically
  • ✅ Configurable character counts and weapon types
  • ✅ Multiple preset battle configurations
  • ✅ Context menu commands for easy testing

Setup Instructions

  1. Add to Battle Scene:

    1. Open your BattleScene
    2. Create an empty GameObject named "BattleTestMode"
    3. Add the BattleTestMode component to it
    4. Configure the settings in the inspector
    
  2. Configuration Options:

    • Enable Test Mode: Master switch to enable/disable test mode
    • Test Player Count: Number of player characters (1-4)
    • Test Enemy Count: Number of enemy characters (1-6)
    • Available Weapons: Array of weapon types to randomly assign
    • Player Names: Array of names for test players
    • Enemy Names: Array of names for test enemies
  3. Automatic Activation:

    • Test mode only activates if no existing battle data is present
    • Characters are created automatically when the scene loads
    • Debug logs show what was created

Context Menu Commands

Right-click on the BattleTestMode component to access these commands:

  • Create Test Battle Data: Manually create test data
  • Clear Test Data: Remove all test battle data
  • Create Random Test Data: Create random character counts and weapons
  • Create 1v1 Test Battle: Quick single combat for testing
  • Create Large Test Battle: 4 players vs 6 enemies for stress testing

Enhanced Test Mode (EnhancedBattleTestMode)

Features

  • ✅ Creates full CombatDataTransfer sessions with realistic stats
  • ✅ Configurable battle context (terrain, weather, time)
  • ✅ Character stats and equipment integration
  • ✅ Support for WeaponItem assets
  • ✅ Backward compatibility with legacy BattleSetupData

Setup Instructions

  1. Add to Battle Scene:

    1. Open your BattleScene
    2. Create an empty GameObject named "EnhancedBattleTestMode"
    3. Add the EnhancedBattleTestMode component to it
    4. Configure the settings in the inspector
    
  2. Configuration Options:

    • Enable Enhanced Test Mode: Master switch
    • Test Player Count: Number of players (1-4)
    • Test Enemy Count: Number of enemies (1-6)
    • Test Terrain: Terrain type for the battle
    • Test Weather: Weather conditions
    • Test Time Of Day: Time in 24-hour format
    • Base Player Health: Starting HP for players
    • Base Enemy Health: Starting HP for enemies
    • Base Armor Class: Base AC value
    • Test Weapons: Array of WeaponItem assets to use
  3. WeaponItem Setup (Optional but Recommended):

    1. Create WeaponItem assets in Project window:
      Right-click → Create → RPG → Items → Weapon
    2. Configure the weapon stats and behavior
    3. Assign them to the Test Weapons array
    4. Test characters will randomly get these weapons
    

Context Menu Commands

Right-click on the EnhancedBattleTestMode component:

  • Create Enhanced Test Data: Manually create full test session
  • Clear All Test Data: Remove both CombatDataTransfer and BattleSetupData
  • Create Balanced Test Battle: 2v2 balanced encounter
  • Create Challenging Test Battle: 2v4 difficult encounter
  • Create Simple Test Battle: 1v1 for quick testing

Using Both Test Modes

Recommended Setup

  1. For Simple Testing: Use BattleTestMode when you just need basic characters for testing placement, movement, or basic combat mechanics.

  2. For Full Testing: Use EnhancedBattleTestMode when you need realistic character stats, equipment, and battle context for testing the complete combat system.

  3. Don't Use Both: Only use one test mode at a time to avoid conflicts.

Integration with Existing Battle System

Both test modes integrate seamlessly with the existing battle setup:

  • BattleSetup.cs will find and use the test characters
  • EnhancedBattleSetup.cs will use the enhanced combat session data
  • GameManager.cs will manage the test characters normally
  • All existing battle mechanics work with test characters

Example Workflows

Quick Combat Test

1. Add EnhancedBattleTestMode to scene
2. Set Test Player Count = 1, Test Enemy Count = 1
3. Right-click component → "Create Simple Test Battle"
4. Press Play to test 1v1 combat

Weapon System Test

1. Create several WeaponItem assets with different stats
2. Add them to the Test Weapons array in EnhancedBattleTestMode
3. Right-click component → "Create Enhanced Test Data"
4. Characters will spawn with random weapons from your array

Stress Test

1. Add BattleTestMode to scene
2. Right-click component → "Create Large Test Battle"
3. Press Play to test 4v6 battle performance

Battle Context Test

1. Add EnhancedBattleTestMode to scene
2. Set Test Terrain = Mountains, Test Weather = Storm, Time = 22
3. Create Enhanced Test Data
4. Test how different environments affect combat

Debug Information

Both test modes provide extensive debug logging:

  • 🧪 Prefix indicates test mode messages
  • Character creation details (names, weapons, stats)
  • Battle context information
  • Data population confirmation

Enable Show Debug Logs in the inspector to see all test mode activity.

Troubleshooting

Test Mode Not Activating

  • Check that Enable Test Mode is checked
  • Ensure no existing battle data is present
  • Clear existing data using context menu commands

Characters Not Spawning

  • Ensure you have playerPrefab and enemyPrefab assigned in BattleSetup
  • Check that PlayerSpawnArea and EnemySpawnArea exist in scene
  • Verify ground layer mask is set correctly

Weapons Not Working

  • For Enhanced mode, ensure WeaponItem assets are properly configured
  • Check that weapon class names match existing weapon classes
  • Verify prefab references in WeaponItem assets

Performance Issues

  • Reduce character counts for stress testing
  • Use Simple Test Battle for basic testing
  • Clear test data between tests to avoid memory buildup

Advanced Usage

Custom Test Characters

You can extend the test modes to create specific character builds:

// In EnhancedBattleTestMode.CreateTestPlayerData()
if (playerName == "TestMage")
{
    playerData.wisdom = 18;  // High wisdom for mage
    playerData.equippedWeapon = "Staff";
}

Dynamic Test Scenarios

Create different test scenarios by modifying the context:

[ContextMenu("Create Night Ambush Test")]
public void CreateNightAmbushTest()
{
    testTerrain = TerrainType.Forest;
    testWeather = Weather.Clear;
    testTimeOfDay = 2f; // 2 AM
    testPlayerCount = 2;
    testEnemyCount = 4;
    CreateEnhancedTestData();
}

This system makes it easy to test any battle scenario quickly without going through the full character creation and travel system.