Project Ironfist distinguishes itself by the ability to add new content, and new creatures are the most important type. When we added our first creature, we needed to modify data tables in assembly, . Now, it can be done using little more than a text editor and a paint program. There's still a lot that goes into making a polished creature -- sound, animation, and game design -- but it is now possible to get a rough version up and moving in minutes.
Adding New Creatures: The Quickest Way Possible
It is possible to add a new creature to the game in under a minute. The catch is that it will look and sound exactly like an existing creature. We'll show you the example of adding a new creature called the "Farmer" which looks and sounds exactly like a peasant.
First make sure you can run the game (see Running the Game). In doing so, you'll need to copy creatures.xml to the Heroes II DATA folder. Open creatures.xml. Its last line should read "</creatures>". Immediately before that line, enter the following:
<creature id="100" name-singular="farmer" name-plural="farmers" icn="peasant.icn" frm="peas_frm.bin"
cost="100" fight-value="50" fight-value-aux="20" growth="8" hp="10" faction="6"
speed="4" attack="5" defense="5" shots="0" short-name="psnt">
<range name="damage" min="4" max="5"/>
<range name="random-spawn" min="20" max="40"/>
</creature>
Save the file. You are done; creature number 100 is now a Farmer.
Adding entries to creatures.xml is the key step in adding new creatures. The rest of this tutorial is about how to make your new creature not look and sound the same as an existing one.
Adding New Creatures: The Full Way
It is recommended you already have the Project Ironfist repository set up, which you learn how to do in the Setting up the Repository tutorial.
To add a new creature, you will need to do the following:
- Create its art
- Set the frame info to control its animation
- Select sounds
- Package the resources
- Select its stats and metainformation
Unfortunately, putting creatures into a map still requires either getting your hands dirty with a hex editor, or removing an existing creature from the game. We're currently working on a new map editor to fix this problem.
Also, at time of writing, we are unable to add new shooters, as we have not yet made it possible to set the graphics for a creature's projectile.
Making the Sprite
A creature starts off as a set of BMP images, one for each frame. This is mostly outside the scope of this tutorial. You can find spriting tutorials elsewhere, but there is no substitute for the hard work and critical eye needed to make good art. More detail on how to put art in the game is given in the Adding Artwork tutorial.
One issue specific to creature art is that, for the walking animation, the creature should be moving forward within the frame. However, for flying animations, the creature should be stationary; the game will smoothly move them to their destination. (This has the unfortunate consequence that, when flyers walk [because they are slowed], they will jerk from one hex to the next.)
Setting the Frame Info
Once you've packaged the creature art into an ICN file, you will need do instruct the game how to piece the frames together into animations, as well as set other information about how the creature is animated, such as its walking speed. Full details on how to do this are in the Controlling Creature Animation tutorial.
Adding Sounds
You'll need to give your creature a short name, a four-letter abbreviation. For example, we use "kbld" for kobolds. This should be four letters, even if your creature full name is shorter -- "roc_" is the short name for rocs.
Every creature needs four sounds, for attacking, moving, taking damage, and dying. For kobolds, these must be named "kbldattk.82M", "kbldmove.82M", "kbldwnce.82M", and "kbldkill.82M", and similarly for other creatures, depending on the short name. Shooters need an additional fifth sound for shooting. If kobolds could shoot, this would be called "kbldshot.82M".
An "82M" file is a raw WAV file with playback rate 22050 Hz. Various standard tools such as Audacity are capable of dealing with raw WAV files. At some point, we'll write a tutorial on how to package sounds for the game. You can always skip the sound design by copying and renaming sounds from a different creature.
Packing Resources
The artwork, creature form, and sounds together give everything the game needs to display your creature. The final step in getting the data into the game is to package them together with the other game resources. Add the graphics, frame information, and sounds from the previous section to a folder, along with all other game resources, and then use the H2AggPack utility. Full details on how to do this are in the Packaging Resources tutorial.
Setting Creature Data
Finally, you will need to add an entry for your creature in the creatures.xml file. creatures.xml is stored in the ironfist/data directory in the repository. This is an XML file; see http://en.wikipedia.org/wiki/XML if you are unfamiliar with XML. Entries look like this:
<creature id="42" name-singular="roc" name-plural="rocs" icn="roc.icn" frm="roc__frm.bin"
cost="400" fight-value="1739" fight-value-aux="43" growth="3" hp="40" faction="4"
speed="4" attack="7" defense="7" shots="0" short-name="roc_">
<range name="damage" min="4" max="8"/>
<creature-flag name="two-hex"/>
<creature-flag name="flies"/>
<range name="random-spawn" min="10" max="16"/>
</creature>
Every creature needs a unique ID between 0 and 255; take the next available ID. The fight-value and fight-value-aux control the value of the creature to the AI. icn and frm are where you specify the names of the graphics and frame-info files you created earlier. random-spawn controls how many of that creature will appear whenever a stack of that creature randomly appears on the map (due to e.g.: "Month of the Roc" events). Most creature abilities are currently hardcoded, though a few can be specified here using the creature-flag tag -- they are "flies", "two-hex", "shoots", "two-hex-attack", and "undead".
Adding to Maps
We have not yet modded the map editor, so we really don't have a proper way of putting creatures into maps. Still, if you want to see your creature moving, you can manually hex-edit a map to add it in. You can also set its ID to be the same as an existing creature, so that all instances of that creature will be replaced with yours in all maps.
In the normal Heroes 2 map editor, create a neutral town, and put 1337 Water Elementals in the garrison. Save the map. Open the map file in a hex editor, and search for the number "1337." This should bring you to the part of the map that specifies that the garrison has 1337 Water Elementals. You should see the number 65, the ID of Water Elementals, adjacent to the 1337. Change the ID to the ID of your creature, and change the quantity to whatever you want. Load the map in the game. Congratulations! You've fully added a creature.
Why are we adding them to the garrison of a neutral town? There are still a few things we have not put work into figuring out how to do: primarily adding in the portraits that display when you view a creature in your own army. We do know that the biggest challenges will be legal ones though: To do this, we will either need to substantially modify the code, or put your artwork in the same file as original artwork from the game.
Comments (0)
You don't have permission to comment on this page.