We are pleased to announce a major
breakthrough in technology and innovation. Through the combined efforts
of numerous members at Stronghold-Knights.com, with much of the
programming load coming from HicRic, the new 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!
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.
[img_assist|nid=159|title=From
Editor|desc=|link=popup|align=left|width=640|height=622][img_assist|nid=158|title=In
Game|desc=|link=popup|align=left|width=640|height=480]
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.
[img_assist|nid=157|title=|desc=|link=popup|align=right|width=266|height=640]
[img_assist|nid=156|title=|desc=|link=popup|align=right|width=265|height=640]
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.
[img_assist|nid=161|title=|desc=|link=popup|align=left|width=265|height=640][img_assist|nid=160|title=|desc=|link=popup|align=left|width=264|height=640]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!
[img_assist|nid=155|title=SH2 AI Editor 1|desc=|link=popup|align=left|width=640|height=472]
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???
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
NOTE: This press release was originally published at Stronghold-Knights.com, Oct, 2005. Reprinted with permission.