diff --git a/src/engine/core/Game.ts b/src/engine/core/Game.ts index 05c81054..9b055c20 100644 --- a/src/engine/core/Game.ts +++ b/src/engine/core/Game.ts @@ -652,33 +652,6 @@ export class Game extends GameCore { } } - /** - * Issue an AI command. In multiplayer, AI commands execute at current tick - * since AI logic is deterministic and runs identically on all clients. - * Commands are recorded for desync detection but not broadcast (both clients compute same AI). - */ - public issueAICommand(command: GameCommand): void { - // Ensure command tick is set to current tick for deterministic execution - command.tick = this.currentTick; - - if (this.config.isMultiplayer) { - // In multiplayer, record the command for desync detection - // Both clients compute identical AI decisions, so no network broadcast needed - this.recordExecutedCommand(command); - } - - // Execute command via parent class (bypasses multiplayer validation since AI is local) - super.processCommand(command); - } - - /** - * Check if this client is in multiplayer mode. - * Used by AI systems to disable non-deterministic features. - */ - public isInMultiplayerMode(): boolean { - return this.config.isMultiplayer; - } - private queueCommandWithReceipt(command: GameCommand): void { this.queueCommand(command); diff --git a/src/engine/core/GameCore.ts b/src/engine/core/GameCore.ts index dbd686c6..918a3ec9 100644 --- a/src/engine/core/GameCore.ts +++ b/src/engine/core/GameCore.ts @@ -510,6 +510,21 @@ export abstract class GameCore { // COMMAND PROCESSING (shared implementation) // ============================================================================ + /** + * Issue an AI command for immediate execution at current tick. + * AI commands bypass multiplayer validation since AI logic is deterministic + * and runs identically on all clients. + * + * Subclasses (Game) may override to add multiplayer-specific behavior + * like command recording for desync detection. + */ + public issueAICommand(command: GameCommand): void { + // Set command tick to current tick for deterministic execution + command.tick = this.currentTick; + // Execute command directly + this.processCommand(command); + } + /** * Queue a command for execution at a specific tick (lockstep multiplayer) */