- Rated ( votes)
- 6,617 views
- Stronghold 2 Tutorial
- 6 mins
The Stronghold 2 AI editor is a Java application, which is designed to alter the .aic files in the game. It also allows you view and edit how the AI will build their castle in the game. The editor makes it possible to completely create a castle from scratch. Each item in the castle has a priority which determines how soon a specific building will be placed, as well as the location. This tool uses pictures to recreate the layouts of the castle in the editor - here are two screenshots showing what the castle looks like in the game and in the editor.
The AI castle files (.aic) files are stored in the directory 'Stronghold 2/castles'. The program alters the following three major points about how the AI build their castles:
Buildings can be added and removed using the first tab on the right side of the screen. The tab "Info" allows you to click on a building, view its status and edit its featues.
To add a building to the castle, choose it from the drop-down menu, and type in a priority in the text box. The priority is a measure of how early in the game the AI should place the building. This should be a number between 1 and 255, inclusive. The smaller the number, the earlier it will be placed in the game, and larger numbers will not be placed until later in the game. It also depends on exactly what resources the AI has available to place the buildings you have added. After a building has been placed, the priority will be incremented. More than one building can share the same priority, for example, several different farms can share the same priority number - however this is not recommended. The special building option is an on/off property that is editable for all buildings. Currently, the only use seems to be adding hoarding to towers, but further undiscovered uses may exist. If you would like hoarding, tick this, otherwise leave it blank.
Finally, you must choose a rotation for your building. Click the "Add Building" button and move your mouse onto the grass and click to place the building. To place the building more than once, keep left clicking in various locations on the map. Right click or click the "cancel" button to go out of building placement mode. You can remove a building by using the "Remove Building" option and the cursor will become an eraser. From this, select each building you would like to delete and it will be removed from the castle. You can click and drag to delete large portions of buildings, such as wall. You can turn off the delete tool by right clicking.
You can add and remove traps, weapons and rally points by using the "Traps/Rally Points" tab. Select one from the dropdown list, and if you're placing it on a wall or tower, make sure to tick the "elevated" box. The final thing to do is to click the "Add" button and click on the green grass to place it. As before, you can cancel the placement by right clicking or using the cancel button. On the third tab is Priority Slider. This allows you to slide through all the priority numbers, to see the buildings in order or priority. The left and right arrow keys will step through the priorities one at a time. On the bottom right of the screen, you will see a small box. This contains the current building or the trap which your mouse is hovering over. You can hover your mouse over an object and you will be told what it is. Finally, you can tick the 'Toggle grid drawing' to show or hide a grid on the map. You can also move the 'zoom' slider to to zoom in and out of the screen. This is very useful for placing objects and getting a general feel of the castle.
You will also notice that some AI have more than one castle. For example, Edwin has three castles. The computer will choose one of these at random each time you play a map. If you edit his first castle and you rename or delete the others, the computer will only use your edited file every time Edwin plays. If this has been done and the AI still chooses another design, then something is wrong with your design. This could be something as simple as overlapping buildings or invalid placement, or the castle you have build could be too small for the estate which is assigned to them in the game. You are more than welcome to ask for help in our Stronghold 2 forum and one of our members will help you if this is the case.
Note though, that not every building must be placed. Any Castle Structure or Military building you would like must be placed in the editor - the AI do not place their own. For example, if no Barracks is placed in the editor, the AI will not make any Barracks in the game. Buildings such as the Stockpile, Granary and farms will be added automatically in the game, along with many other buildings. As another example - if you place one saw pit, the AI will still place more. Stone quarries and iron mines will only appear if the terrain is suitable for them to be placed. In this instance, it is better for the AI to place them as not every map has the same terrain.
Also make sure to only place one keep. The keep should be placed as priority 1, as all the other AI castles have. It's also probably best to have nothing else as the priority 1 too, to avoid potential confliction. Overlapping buildings can result in being random too, the majority of the time, one building will usually be moved out of the way to the side of the overlapping one. But it can result in the second building never being placed. It's also important to remember that many of the buildings have a small area around their own perimeter that can overlap with other buildings such as weapon workshops.
I recommend you test this while you build your own castles. You can even do this without reloading the game - you can minimise the game through the operating system shortcuts, or go into the map editor, click edit to see a blank map and press shift + tab to play the game in windowed mode. The castle is loaded just as you start a map, so this means you can edit the AIC file, save it, load a new map in the game, quit the map and then alter the AIC file in the editor again. This can increase your design speed significantly.
You can use this to create more challenging AI opponents for Kingmaker battles, or make a completely new AI which uses the terrain around them intelligently in a custom war map. Finally, the "keep" marker placed on the map in the editor symbolises where the first building will be placed on the map (which is the keep). All the other buildings from the editor will be placed relative to this building - but in the same order they appear in the editor.
Now go and build your perfect AI castle, and upload it here so other people can enjoy it as much as you!