# New Team Travel System ## Overview The new travel system provides comprehensive map-based movement with realistic costs, pathfinding, and visual route planning. It integrates seamlessly with the existing MapMaker2 and SimpleTeamPlacement systems. ## Features ### Movement Costs by Terrain - **Plains**: 1.0x (baseline movement cost) - **Forest**: 2.0x (harder to navigate) - **Mountains**: 4.0x (very difficult terrain) - **Roads**: 0.5x (fast travel) - **Towns/Villages**: 0.1x (almost instant travel inside settlements) - **Bridges**: 0.6x (slightly slower than roads) ### Special Travel Options - **Ferry**: 0.7x movement + gold cost (fast water crossing) - **Tunnel (with torch)**: 0.8x movement + torch cost (fast mountain crossing) - **Tunnel (without torch)**: 3.0x movement (slow, dangerous) ### Route Types 1. **Standard Route**: Cheapest path (lowest movement cost) 2. **Road-Preferred Route**: Uses roads when possible, even if slightly more expensive 3. **Special Route**: Utilizes tunnels, ferries when beneficial ## How to Use ### Setup 1. Add `TravelSystemSetup` component to any GameObject in your map scene 2. Configure movement costs and visual settings in the inspector 3. The system will automatically setup all required components ### Controls - **Left Click on Map**: Plan travel to clicked location - **ESC**: Cancel travel planning - **T Key**: Show travel system info - **R Key**: Randomly relocate team - **M Key**: Show team marker info ### Travel Planning Process 1. Click on any tile on the map 2. The system calculates multiple route options 3. Travel UI shows the best route with costs and time 4. Choose to start travel or cancel ### Visual Feedback - **Blue Line**: Standard/cheapest route - **Yellow Line**: Alternative route (road-preferred) - **Red Line**: Expensive route (special travel costs) ## Integration with Existing Systems ### SimpleTeamPlacement - Automatically detects team position - Updates team location during travel - Saves/loads team position ### MapMaker2 - Uses terrain and feature data for pathfinding - Integrates with roads, bridges, tunnels, ferries - Respects impassable terrain (water without bridges) ### UI System - Uses existing travel UI elements - Shows route information, costs, and options - Provides travel confirmation and cancellation ## Technical Details ### Pathfinding - Uses A* algorithm for optimal route finding - Considers terrain costs and feature modifiers - Supports 8-directional movement - Avoids impassable terrain ### Route Calculation - **Cost**: Total movement difficulty - **Distance**: Number of tiles in path - **Time**: Estimated travel duration - **Special Costs**: Gold, torches, or other resources needed ### Performance - Efficient pathfinding with reasonable limits - Path visualization using Unity LineRenderer - Real-time route updates when destination changes ## Configuration Options ### Movement Costs (adjustable in inspector) ```csharp public float plainsMovementCost = 1f; public float forestMovementCost = 2f; public float mountainMovementCost = 4f; public float roadMovementCost = 0.5f; public float townMovementCost = 0.1f; ``` ### Special Travel Costs ```csharp public int ferryBaseCost = 25; // Gold public int tunnelTorchCost = 10; // Torches public float ferryMovementCost = 0.7f; public float tunnelWithTorchCost = 0.8f; ``` ### Visual Settings ```csharp public Color standardPathColor = Color.blue; public Color expensivePathColor = Color.red; public float pathLineWidth = 0.2f; ``` ## Debug Features ### Debug Keys - **C Key**: Show movement cost information (when enabled) - **T Key**: Show travel system status ### Context Menu Options - "Setup Travel System": Manually setup all components - "Show Travel System Status": Check component availability - "Test Travel Planning": Test with random destination ### Debug Logs Enable `showDebugLogs` in components for detailed information: - Route calculation details - Movement cost breakdowns - UI interaction logs - Travel execution progress ## Troubleshooting ### Common Issues 1. **No routes found**: Check if destination is reachable (not surrounded by impassable terrain) 2. **UI not showing**: Verify TravelUIController is attached to UI GameObject 3. **Pathfinding slow**: Reduce map size or add movement cost limits 4. **Visual path not appearing**: Check path material assignment and Z-offset ### Component Dependencies - `TeamTravelSystem`: Core travel logic and pathfinding - `TravelUIController`: UI management and player interaction - `SimpleTeamPlacement`: Team position tracking - `MapMaker2`: Map data and terrain information ## Future Enhancements - Player inventory integration for resource checking - Advanced route options (avoid enemies, prefer certain terrain) - Time-based travel with day/night cycles - Random encounters during travel - Group travel with multiple units - Travel fatigue and rest mechanics