Messages : 2166 Quality Points : 843 Registration Date : 2014-12-12 Age : 32 Location : Turkey
Subject: Adding New Creatures 2015-07-20, 18:52
(This as a cross-post from the Project Ironfist wiki, see link)
( This post has an associated video tutorial: )
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.
After installing the game (see Running the Game), a file called creatures.xml will appear in your Heroes II DATA folder. Open creatures.xml. At time of writing, the last entry has an ID of 72, so we'll use 73 for the ID of our Farmer. The last line should read "". Immediately before that line, enter the following:
Save the file. You are done; creature number 73 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:
1) Create its art 2) Set the frame info to control its animation 3) Select sounds 4) Package the resources 5) Select its stats and metainformation
Making the Art
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.)
If you wish to see your creatures outside of combat, you'll need to create two or three other versions of your creatures. First is the creature portrait, and will be seen when you view a hero with that creature or enter a town. Create this as a single image within MONH<4-digit creature ID>.ICN -- for example, the Farmer example from above will need a portrait in MONH0073.ICN. Next is a 32x32 pixel image seen when you right-click on a hero, when heroes swap creatures, and when tallying losses at the end of combat. Add this as an image in MONS32.ICN. Finally, if you want to view the creature on the adventure map, you'll need to add images for it to MINIMON.ICN. Each creature has 9 frames in MINIMON.ICN, so a creature with ID 73 will have frames 657-665. The first seven frames are its animation on the adventure map; the last two are used when a hero enters battle with it.
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".
See Adding New Sounds for instructions on how to add sounds to 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 link if you are unfamiliar with XML. Entries look like this:
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".
For more information, see Setting Creature Stats.
Adding to Maps
Once you have added your creature to creatures.xml, you can create maps with it! Load up the Ironfist map editor (not the normal one!) and edit a town. Your new creature will be available for placing in a custom garrison.
Limitations
At time of writing, the new map editor will let you place your new creatures in a town, but the map editor will not let you place them directly on the map without a programmer manually changing the editor. You will also not be able to directly put them in a hero's army. 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.