The AI in Stronghold Crusader 2 is generic for all 16 characters, as their behaviour is hard-coded into the game and cannot be altered. There are no known utilities that allow modding, however existing files can be modified if extracted through third-party programs and replaced by the user.
- Hard-coded behaviour: the AI's decision making, unit management, etc. is programmed in the game and its code cannot be extracted nor modified, therefore it is not possible to be edited.
- Castle templates: the Crusader AI uses external files for castle building and creating a base. These files are stored deep in .v files and use compressed .xml files.
- Media files: Bink videos are used for interacting with the player. These media are exclusive for RAD Tools Inc. and they sell a video converter program. Bink files are possible to create by many free utilities found throughout the Internet.
The AI in Crusader 2 seems not to use stances like its predecessor. Instead, the AI does multitasking inherently differently, using simple conditions that must be fulfilled in order to trigger a response. The reactions are preset and thus it is really predictable what the AI can do next, yet it provides a challenge with its fast execution time. Below are found the core aspects of decision making:
- Economy: the AI spends its resources as they come in, as well as it may buy in food and goods in case of shortage. The AI manipulates popularity really well through taxes and rations to optimize gold income (this is a possible reason why the AI has a massive gold advantage over time). The AI also halts production facilities, where the workers are under attack and thus impossible to operate.
- Defense: the AI builds its settlements as designed in a castle template, possibly by the use of ticks. Defensive garrisons are recruited as their assembly points become available, until a certain limit. Castle walls are built in small batches instead of tiles and they are built as stone is available (resembled by stone growing from the ground gradually, even from multiple places). Most AI build their castles gradually, often starting in a small enclosure and extending it with additional defenses, towers, etc.
- Patrols: the AI uses patrols to defend and guard its buildings, forming up several squads that roam the area. Patrols are very responsive and they are often sent from very far to deal with outside threats. They respond heavily upon the presence of siege camps and peasants.
- Offense: the AI uses 2-3 different composition of groups to send out harassments, as well as featuring a siege force with limited numbers. Raiders are often sent towards one random building, however they are very aggressive towards counterattackers and are prone to target them fiercely (such as defenders in a tower). They will work their way through defenses if they have no access to other buildings. Siege forces often assemble and then prepare a siege camp with engines rolling out before commencing the attack. They target the Lord as they march in and attempt to clear the way as much as possible.
- Rapid task force: this is a "cheat" which the AI can use whenever in trouble. In case of heavy attacking, a free squad of units (albeit small in size) can emerge from the keep and help fend off any defenders. When a human calls an allied AI for help, a rapid task force is sent immediately to the player's keep if the AI agrees to defend.
AI lords normally do not interact with their AI allies (they seem to coordinate their attacks, however). With human allies, they are much more interactive, just like in the original Crusader. The player can select from: requesting an attack, requesting defense, requesting goods, sending goods. While the AI used to fulfill these commands as it saw possible, this is no longer the case with the addition of mood.
Mood represents the likeliness of the character fulfilling a command. Generally, obeying the AI raises mood, while declining their requests, as well us requiring their aid lowers it. Each character also has an average mood, which is slowly converged to. Recent events seem to also affect overall mood. People like the Wolf have a general low mood (~10-15%), while the Shah has the highest mood (100%).