tutorial area todo

Guide for tutorial area todo

Agent Work Split - Tutorial Area Development

Agent 1 (Current) - Editor & Spawn System

Focus: Wire up spawn point placement and persistence

Todo

  • Spawn Point Input Handling (editor/input.rs)
    • Add click handler for EditorTool::Spawn
    • Spawn marker entity at click position with SpawnPoint component
    • Use colored sphere mesh for visualization:
      • 🟢 Green for NPC
      • 🔴 Red for Enemy
      • 🔵 Blue for TriggerZone
      • 🟡 Yellow for Waypoint
  • Spawn Point Persistence (map.rs)
    • Add spawn_points: Vec<SavedSpawnPoint> to MapData
    • Create SavedSpawnPoint struct matching SpawnPoint fields + position
    • Update save/load to include spawn points
  • Spawn Point Visualization
    • Add text label above spawn marker showing entity_id
    • Make markers selectable with Select tool
    • Delete functionality for spawn points

Agent 2 - NPC AI with big-brain

Focus: Integrate utility AI for tutorial NPCs

Setup

cd loh-game
cargo add big-brain

Todo

  • Add big-brain to Cargo.toml
    big-brain = "0.21"  # Check latest version
  • Create AI Module (src/systems/ai/behavior.rs)
    • Define TutorialGuideAI scorer/action components
    • Implement GreetPlayer action (triggers dialogue)
    • Implement Patrol action (move between waypoints)
    • Implement WaitIdle action
  • NPC Behavior Trees
    // Example structure
    Thinker::build()
       .picker(FirstToScore { threshold: 0.5 })
       .when(PlayerNearby::new(5.0), GreetPlayer)
       .when(Always, Patrol)
  • Tutorial NPC Entity (src/systems/world/npcs.rs)
    • Create spawn_tutorial_npc function
    • Attach Thinker component
    • Use entity_id from SpawnPoint to determine which NPC to spawn

Shared Data Contracts

SpawnPoint Component (Already Created)

// src/systems/editor/state.rs
pub struct SpawnPoint {
    pub spawn_type: SpawnPointType,  // Npc, Enemy, TriggerZone, Waypoint
    pub entity_id: String,           // e.g., "tutorial_guide"
    pub level: i32,                  // For enemies
}

Files Agent 1 Will Modify

  • src/systems/editor/input.rs
  • src/systems/map.rs
  • src/systems/editor/ui.rs (minor)

Files Agent 2 Will Create/Modify

  • src/systems/ai/behavior.rs (NEW)
  • src/systems/ai/mod.rs
  • src/systems/world/npcs.rs (NEW or existing)

Testing

  1. Agent 1: Open editor (F1), use Spawn tool, place markers, save/load map
  2. Agent 2: Run game, verify NPC spawns at spawn point, test patrol behavior
  3. Both: Combine work, verify spawn points + AI integration