Guest Menu

The Keep
Site Rules
Legal Info
Join Us...

Forums Index

Walkthroughs
Design Corner

Game Versions

Stronghold 2 (SH2)
Forums
Multiplayer
Gallery
Tutorials

Stronghold Crusader (SHC)
Forums
Multiplayer
Gallery
Tutorials

Stronghold 1 (SH1)
Forums
Multiplayer
Gallery
Tutorials

Multiplayer
Forums
{SHK} Clan

Other Places
FAQ's
Galleries
Links

About SHK
Your Hosts
Website History


News On...
Announcements
1. Introduction
2. Landscape
3. Nature
4. Resources
5. Buildings
6. Castle
7. Units
8. Scripting
9. Distribution
10 Game Mods
Glossary

Stronghold 2 AI Editor
Wednesday, November 02, 2005 - 04:39 PM
10. Game Mods

English Language

Compatible with Stronghold 2

Stronghold-Knights.com is pleased to announce a major breakthrough in technology and innovation. Through the combined efforts of numerous members at SHK, with much of the programming load coming from HicRic, the new Stronghold-Knights Stronghold 2 AI CASTLE EDITOR has been released!

No more complaining about how the AIs do not finish their castles, or that their castles are too easy to breach. Edit the AI to be tougher, or even create a completely custom AI to your liking. Read on to see how!

Submitted by HicRic, Aubergine and LordBritian



Introduction

The SH2 AI Editor (download here) is a Java application designed to alter the .aic files that are found in Stronghold 2. It allows you to view how each AI opponent will build their castle, to add new buildings to their layout, or to remove them. You can even start a castle from scratch to overwrite an existing AI castle. Each item has a priority value that determines when it will be built and location entries. All of these characteristics are made at the time of placement, but you can also change any of them at any time!

This tool is easy to use, and easy to look at. In games pictures have been used to recreate the layouts, from stone walls, to apple farms, you will think you are looking at the game while you use this editor. Here at two pics, one from the game and one from the editor.

From the game:



From the new SHK Stronghold 2 AI Editor:

Instructions for Use

The first thing you should do is find your Stronghold 2 directory and make a copy of the "Castles" folder. This is so you can get the original AI castles back easily, should you want them. Otherwise, you would have to reinstall the game.

In this program, you're altering the .aic files found in the castles directory. These files define how each AI player will build his or her castle. The file defines three major things:

- The position, rotation and priority of buildings
- The position of weapons and traps such as the tower ballista or rolling logs
- Gathering positions (rally points) for troops, e.g. a group of archers on a wall

Adding Buildings

Buildings can be added and removed using the first tab on the right-hand side of the screen, "Add/Remove". The tab "Info" will allow you to click on a building and view it's status, and also edit it's features.

To add a building, choose it from the drop-down list. Then, type a priority in the text box. "Priority" is a measure of how soon the AI should build the building. It is a number between 1 and 255 inclusive. A small number indicates it will be built early, while a large number will not be built for some time. This also depends on available resources, since you need enough wood, stone, gold etc. to build everything. After placing the building, the priority will increment by one. Buildings can share the same priority, e.g. you can have several different farms all at priority '12', though this is not recommended.

The "special building option" is an on/off property that all buildings have. So far, it seems the only use is to add hoarding to towers, but it may have other undiscovered uses. Tick it to add hoarding to the tower you're placing, or leave it empty if you don't want hoarding.

Finally, choose a rotation direction for the building. Then, click the "Add Building" button and then move your mouse onto the green grass on the left. Click to place the building. You can keep clicking to place it more than once. Right-click to exit out of building placement mode, or click the "cancel" button.

To remove a building, click the "Remove building" button and the cursor will become an eraser. Then click on each building you wish to delete, and it will be removed. Also, a 'click-and-drag' option is available for the delete tool to quickly remove large portions of walls. A right-click will turn off the delete tool.

Adding Traps

To add or remove traps, weapons and rally points, click the Traps/Rally Points tab. Select one from the drop-down list, and if you're placing it on a wall or tower, tick the "elevated" box. Finally, click the 'Add' button and then click on the green grass on the left to place it. Cancel placement mode by right clicking or clicking on the cancel button.

On the third tab, a 'Priority Slider' is displayed. Here you can slide through the priority numbers and see the buildings that have the priority or less. A nice way to see how the castle develops through time. The left and right arrow keys on the keyboard will step through the priority one at a time.

In the bottom-right of the screen, you'll see a small box. This will display the current building and/or trap your mouse is over. Hover the mouse over an object on the display and you'll get a tooltip telling you what it is. Tick the 'toggle grid drawing' to turn the grid overlay on and off. Move the 'zoom' slider to zoom in and out of the screen. Zooming in is good for placeing objects, whereas zooming out is good for getting a general feel of the castle.

Tips and Tricks

Now that you understand the program, here are a few final pointers to making a successful castle:

You will notice some AI opponents have more than one AIC file. Edwin has three, for example. The computer chooses one of these to use randomly each time you play a map with him in. If you edit his first castle, and rename or delete the other two, the computer will use your edited file every time. If you do this, and the AI still uses another castle design, it means there's something wrong with your castle. Either you have tried to do something a bit crazy or odd with it, such as overlapping buildings or invalid placements, or castle estate is too small for the castle layout.

Every building does not have to be placed! But that all Castle Structure and Military buildings must be placed in the editor. If the Barracks is not placed in this file, the AI will never place one. Things like the stockpile, farms and granary though, are added automatically. Many other buildings are also added automatically by the AI. If you (for example) place one woodcutter, the AI will still automatically add more.

Buildings such as the iron mine and stone quarry won't appear unless placed on the correct terrain. It's often better not to place them and just let the AI add them automatically.

Only place one keep! You should probably place the keep as "1" priority, and have nothing else as "1". That's what the normal AI castles do it.

Overlapping buildings has random results. Most of the time one building will simply be moved out of the way, just to the side of where the overlapping building is. Otherwise, the second building causing the conflict will just never be placed. However, don't forget that many buildings have a small area around their perimeter that can overlap other perimeters.

If you want to test the layout, there is no need to keep reloading the game. Either minimize the game using your operating system shortcuts, or go into the map editor, click "edit" (so you see a large blank map) and press "tab" on your keyboard. SH2 will now runs in windowed mode. The AIC file is only loaded just as the map starts, so feel free to edit the AIC file, save, load the map, test, quit the map, and then alter the AIC file again. This will greatly increase your design speed.

You can use this program to create more challenging AI opponents in Kingmaker, or make an AI which uses terrain intelligently in a Custom War map. Imagine a long valley with an AI castle in-you could make the AI build a castle which just walls off the end of the valley, instead of all four sides of a castle. Be creative!

Lastly, the "keep flag" placed on the map in the map editor in-game shows where the first building in the AIC file will be placed. (normally the keep...) All other buildings will be placed relative to this flag, but in the same way they appear in the editor.

Once again, just so you can appreciate the look and feel of the editor, here is another look using the new William AI that was added with patch 1.3.1. Hmmm, maybe those tower stairs need to point to the inside of the castle???



From the New Stronghold-Knights.com SH2 AI Editor:

Now go make that perfect AI, and then offer it to be loaded into our database so others can enjoy it as well.

Credits

Many people have spent countless hours researching and recording information that went towards making this program become a reality. Without them, this would not have been possible.

HicRic - because he wrote program!!!

LordBritian - who fiddled with little hex numbers, and unlocked the code to start this project.

Darron, Mehmet, Lord_Nick, and WitchHazel - for the information in the building tutorials that massively helped the creation of buildings.txt.

Aubergine - for endless ideas and a ton of images used in the editor.

Sir Knight - who also obtained many images for the program

Beta Testers - a huge thank you to all of you: Aubergine, Brave Sir Robin, Lord Aussie, Lord Nick, Sir Knight, X29


 
Login
 



 


 Log in Problems?
 New User? Sign Up!
Related links
· SH1 / SHC Game Mods
· SH2 Game Mods
· More about 10. Game Mods
· News by LordBritian


Most-read story in 10. Game Mods:
Making Crusader look like Stronghold