-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Purpose
Create a modular AI Controller that owns decision-making for non-player forces. It should integrate ScenarioData.tasks (TaskDefend/Move/Patrol/SetBehaviour/SetCombatMode/Wait) and unit behaviour (careless/safe/aware/combat/stealth) + combatmode (hold_fire/fire_when_fired_upon/open_fire) so AI agents execute authored task chains deterministically.
Scope
- Task ingestion & queues
- On mission start, build a per-unit TaskQueue from
ScenarioData.tasks(usingunit_index,prev_index/next_index). - One active task per unit; supports pause/resume/cancel/advance.
- On mission start, build a per-unit TaskQueue from
- Task semantics (minimal, deterministic)
TaskMove→ path to point; uses behaviour for caution/speed multipliers.TaskDefend→ hold within radius, prefer cover, set observation arc.TaskPatrol→ cycle or ping-pong; dwell usesTaskWait.TaskSetBehaviour→ set unit behaviour immediately (see mapping below).TaskSetCombatMode→ set ROE immediately.TaskWait→ block until timer elapses or contact seen (if flag set).
- Behaviour → AI/Movement/LOS mapping (placeholder)
careless: fast transit, low cover weighting, long regroup timer, high noise.safe: normal speed, moderate cover weighting, standard regroup.aware: slower speed, high cover weighting, quicker reaction.combat: bounding movement (stub), very high cover weighting, shortest reaction.stealth: slowest speed, maximal concealment bias, limited fire (pairs well withhold_fire).
- CombatMode (ROE) → CombatAdapter
- hold_fire: never initiate; only engage if explicit fire order (not in this issue).
- fire_when_fired_upon: return fire only (threat in LOS and hostile shot observed).
- open_fire: engage viable targets per profile.
- Overrides & precedence
- ScenarioUnit’s initial behaviour/ROE applied at spawn.
TaskSetBehaviour/TaskSetCombatModeoverride current state.
- AI Controller integration
- AIAgent consumes TaskQueue → emits intents to Movement/Combat adapters.
Deliverables
ai/tasks/ScenarioTaskRunner.gd- per-unit runner; processes the chain and raises events.ai/AIController.gd(update) - register TaskRunners and tick them in fixed-step.ai/AIAgent.gd(update) - apply behaviour/ROE, expose setters, and translate tasks to intents.adapters/MovementAdapter.gd(update) - accept behaviour-derived speed/caution multipliers & cover bias.adapters/CombatAdapter.gd(update) - enforce ROE.adapters/LOSAdapter.gd(update) - support until_contact wait checks.- Signals (documented in GDScript)
task_started(unit_id, task_type: StringName)task_completed(unit_id, task_type: StringName)task_failed(unit_id, task_type: StringName, reason: StringName)behaviour_changed(unit_id, behaviour: int)combat_mode_changed(unit_id, mode: int)
- Acceptance
- Units with chained tasks execute in order: Move → Defend → Wait → Patrol, etc.
- Behaviour changes affect path choice/speed; ROE changes affect when units fire (hold/return/open).
- TaskWait respects duration and until_contact via LOS; TaskPatrol loops correctly.
Reactions are currently unavailable