AiController #26

Open
opened 2026-04-16 20:42:18 +00:00 by sebastian · 0 comments
Owner

Problem: Jeder KI-Spieler hat potenziell eigene Einstellungen (Schwierigkeit, Strategie-Bias). Diese sollten pro KI-Instanz konfigurierbar sein.
Lösung:

// game/ai/AiController.h
struct AiConfig {
    float aggressiveness = 0.5f;  // Gewichtung Angriff vs. Aufbau (future)
    float buildBias      = 1.0f;  // Multiplikator auf Build-Utility
    float upgradeBias    = 1.0f;  // Multiplikator auf Upgrade-Utility
    int   thinkDelayMs   = 800;   // künstliche Denkpause für UX
};

class AiController {
public:
    explicit AiController(PlayerID, AiConfig = {});
    void takeTurn(GameMode&, EntityManager&, const TurnState&);

private:
    PlayerID        playerID;
    AiConfig        config;
    AiDecisionMaker decisionMaker;
};

thinkDelayMs sorgt dafür, dass die KI nicht sofort handelt – sonst fühlt sich der Zug unnatürlich schnell an.
Acceptance Criteria:

  • takeTurn() ruft GameWorldView + AiDecisionMaker auf und führt Aktion aus
  • AiConfig beeinflusst Utility-Gewichtung
  • Kein direkter Input-Zugriff (kein InputManager, kein Application::getInstance())
**Problem**: Jeder KI-Spieler hat potenziell eigene Einstellungen (Schwierigkeit, Strategie-Bias). Diese sollten pro KI-Instanz konfigurierbar sein. **Lösung**: ``` // game/ai/AiController.h struct AiConfig { float aggressiveness = 0.5f; // Gewichtung Angriff vs. Aufbau (future) float buildBias = 1.0f; // Multiplikator auf Build-Utility float upgradeBias = 1.0f; // Multiplikator auf Upgrade-Utility int thinkDelayMs = 800; // künstliche Denkpause für UX }; class AiController { public: explicit AiController(PlayerID, AiConfig = {}); void takeTurn(GameMode&, EntityManager&, const TurnState&); private: PlayerID playerID; AiConfig config; AiDecisionMaker decisionMaker; }; ``` thinkDelayMs sorgt dafür, dass die KI nicht sofort handelt – sonst fühlt sich der Zug unnatürlich schnell an. Acceptance Criteria: - takeTurn() ruft GameWorldView + AiDecisionMaker auf und führt Aktion aus - AiConfig beeinflusst Utility-Gewichtung - Kein direkter Input-Zugriff (kein InputManager, kein Application::getInstance())
sebastian added this to the AI-System milestone 2026-04-16 20:42:18 +00:00
sebastian added the
enhancement
engine
labels 2026-04-16 20:42:18 +00:00
sebastian added this to the Dicewars project 2026-04-16 21:03:34 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sebastian/Dicewars-Siedler#26
No description provided.