$ show SMUnlimited/AMAI
AMAI (Advanced Melee Artificial Intelligence) is a comprehensive replacement for Warcraft III's built-in melee AI. It provides a modular, table-driven AI system with a job scheduler, per-race strategies, hero micro, harass logic, and a Commander interface allowing human players to command allied AI opponents via chat or dialogs. The repository includes build tooling (Perl preprocessor, batch scripts) to compile AI scripts for multiple game versions (ROC, TFT, Reforged), an Electron-based desktop installer for injecting AI into maps, and extensive localization in 10 languages. The codebase is primarily JASS (the game's scripting language) with a custom preprocessor (eJASS) that supports conditional compilation and table inclusion. While the core AI logic is tightly coupled to Warcraft III, several patterns (job scheduling, command registration, preprocessor) are reusable in other game modding contexts.
The LLM identified 3 files worth highlighting for reuse:
A standalone Perl script that preprocesses JASS source files, supporting #IFDEF/#ELSE/#ENDIF, #INCLUDE, #INCLUDETABLE, #SEARCHTREE, and #FOR directives. It enables version-specific code generation and table-driven code expansion. This tool is self-contained and could be reused by any JASS modding project to add conditional compilation and template-based code generation.
Defines the core job scheduling system (TQAddJob, TQAddUnitJob, TQAddGroupJob) used across all AI behavior modules. Jobs are registered with a function name, repeat interval, and optional unit/group target. This pattern decouples AI behaviors into independent, time-scheduled tasks and is a clean, reusable architecture for any real-time strategy AI or game loop.
Implements the Commander system: a table-driven command parser and paginated dialog interface for human players to issue orders to allied AI. Commands are registered via RegisterCommand() with keywords, parameters, and translations stored in a hashtable. The dialog builder supports nested menus, player selection, and integer synchronization. This pattern of command registration and dynamic dialog construction is reusable for any game or application needing a chat-command interface with localization.