Skip to content

AI Headless And Performance

rayswaynl edited this page Jun 1, 2026 · 36 revisions

AI, Headless And Performance

AI Delegation

WFBE_C_AI_DELEGATION controls delegation:

  • 0: disabled
  • 1: client-side AI creation/delegation
  • 2: headless client

initJIPCompatible.sqf downgrades headless delegation to disabled when the detected OA version does not support headless clients. Server functions Server_DelegateAITownHeadless, Server_DelegateAIStaticDefenceHeadless and Server_FNC_Delegation are the core delegation hooks. Client handlers Client_DelegateAI, Client_DelegateTownAI and Client_DelegateAIStaticDefence receive delegated work.

Town AI

Town AI is centralized through Server/FSM/server_town_ai.sqf. The server starts it once globally when defenders or occupation are enabled. Server_GetTownGroups, Server_GetTownGroupsDefender, Server_SpawnTownDefense, and Server_ManageTownDefenses support the flow.

Player AI Watchdog

Client_WatchdogPlayerAI.sqf and Client_RecoverPlayerAI.sqf are client-side resilience systems for AI units in player groups. They check locality, alive state, vehicle validity, movement destination quality and recovery cooldowns.

Performance Audit

The mission writes structured [Performance Audit] RPT lines through PerformanceAudit_Record / PerformanceAudit_Run. The analyzer in Tools/PerformanceAuditAnalyzer converts RPT lines into CSV, Markdown, HTML and Word-friendly reports.

Instrumented areas include:

  • client marker loops: updatetownmarkers, updateteamsmarkers, updatesalvage;
  • client RHUD;
  • combat marker blinking;
  • updateavailableactions;
  • AFK update loop;
  • player AI low gear manager;
  • town AI delegation and fallback views in the analyzer;
  • cleanup/restorer focused reporting.

Runtime Optimizations Already Present

  • RHUD caches controls, text and colors to avoid rewriting unchanged UI every second.
  • Team and town marker loops include local caches and audit counters.
  • Volumetric clouds are force-disabled because of FPS/stutter cost with skipTime.
  • Day/night sync uses small client-side skipTime steps, server date broadcasts and hard sync only for excessive drift.
  • Anti-stack loops can be disabled by mission parameter for controlled audits.
  • Server cleaners/restorers split cleanup work into dedicated loops.

Server FPS

Server/GUI/serverFpsGUI.sqf and Server/Module/serverFPS/monitorServerFPS.sqf publish server FPS data used by HUD/status surfaces. Earlier compile lines for WFBE_CO_FNC_monitorServerFPS are commented, but Init_Server.sqf later executes the module directly.

Performance Caveats

  • Do not compare client and server audit rows as if they measured the same impact.
  • Public-variable storms can cause more harm than local scheduled work.
  • Treat long monitoring rows with sleeps/database waits differently from CPU-heavy loops.

Sidebar

Clone this wiki locally