Welcome.
   My name is Nema Fakei; How may I help you?

The Phak

XAF Editing

Introduction - XAF Format - Infantry - Vehicles - Buildings - Sounds

General:
 Index
 Misc. Downloads

Emperor Modding Tutorials:
 Modding Overview
 INI Editing
 Texturing
 XAF Editing

External:
 Fed2k
 Dune Editing
 Westwood Studios

Contact:
 Nema Fakei

Introduction to XAF files

XAF files are Emperor's 3d model files. They come in two variants, .xaf and .xbf. The .xaf files are static-shape objects, while the .xbf files are animated objecs. The former includes explosions (only the textures change, not the shape, in Emperor explosions), and terrain objects like wrecked buildings; the latter includes structures, vehicles, and infantry - anything selectable and anything targtable. At the time of writing, we can only edit these manually (and not very easily). A viewer and an editor are in the process of being created for xbfs, and possibly xafs.


The XAF Format

The format is a pain. You can edit it with Notepad, althouud it's better to use a hex editor (I use MS C++; I think there is a link to Cygnus somewhere on the Dune Editing forum - look there), and this is why: If you change anything like the files it refers to, you must make sure that you keep the length of the name the same - so you can change HK_decowalls_128.tga to AT_decowalls_128.tga, but NOT HK_decowalls_64.tga. This is because the xaf includes a byte to check the length of any string you care to use; the advantage of a hex editor is that it's easier to see if a length has been disturbed. You will also notice that at the end of each xaf file, there is a extra bit not mentioned in the ArtIni.txt. The accidence of this is thus: An underscore precedes all endings, which is followed by either H, M or L, denoting the detail of the shape and the textures it uses (to be used for model quality preferences. NB: infantry and some vehicles have only H). After that is a digit representing the health status of the object when it uses that model - 0 for perfect health, 1 for slightly damaged; the number of these continues; the last number for each object is the destruction animation. The digit C in this position denotes a construction animation (NB: Units have only 0 here, which incorporates all their animations). Within the XBF, there are a lot of unintelligible symbols. There is a sort of pattern to the occurrence of the useful strings. The animated textures come shortly after the FXData at the top; a little later is the sound effects used - firing, reloading and exploding. Almost immediately after come the main textures of the object.


Retexturing Infantry XBFs

As well as retexturing in the simple way (see Texturing), we can choose to retexture specific model files. I shall take the example of the Corrino Sound Blast Trooper in the Kwisatz Haderach mod. The first thing I did as extrach the =G_Infanty_256.tga file from the 3ddata0001.rfh/rfd file. I then edited all the individual texures so that they were specific to House Corrino - purple for the cloth, gold for the metal - and saved the file as =C_Infantry_256. I then extracted the FRFremen_H0.xbf and renamed it CO_Sonic_H0.xbf. After changing the Artini.txt to reflect this, I started work on the new XBF file. Since I had changed all the textures in the Corrino infantry texture file to suit the new house, what I wanted to do next is make sure that the new xbf used that file rather than the old one. To do this, I opened the XBF with a hex editor and searched for the reference to =G_infantry_256.tga. Having found it, I replaced the G with a C, and saved the file - in the Emperor\DATA\3ddata\Units\directory. That is all that was required; furthermore, I can reuse that Corrino texture for any more Corrino infantry I create.


Retexturing Vehicle XBFs

An almost identical process, however, be aware of the following details: You may need to change all textures within all of the patchwork textures, and change the references to them all... for example, I have an =kh_co_patch_high_0000.tga and so on for the Atreides and Harkonnen models that I want to make Corrino. Also remember the Ordos/Generic/Subhouse/Incidental patchwork textures. Note that you may also wish to change the colours of the spotlights, depending on the house; I have a file !%COSPOTLGT.tga to make the Corrino units look a litle more distinctive. Note that you may wish to change the high, medium and low versions of these files - if using an existing filename, you will have to; if using a new one, that is not necessary.


Retexturing Building XBFs

Again, the idea is similar, but note that you will not necessarily create new textures for each new model - in creating a Harkonnen version of an Atreides building, you need only change the .xbf file's "HK" references to "AT". However, remember to check that all textures you refer to actually exist! In the given example, you may inadvertently ask the model to use a harkonnen Eagle-roof texture instead of an atreides one. You should instead look for something Harkonnen with the same length of filename; if none are found, make a new one, or copy an existing and suitable one.


Sound control

Your units make sounds that you can't control from the inis. This is because the .xbf files contain references to the sounds in the sfx inis. To change them, you need to alter the .xbf files and the inis. For example, I made a plasma trooper, so I wanted it to sound like a Devastator firing. So, I looked for the sounds in the HKTrooper.xbf and found "hkbazookalaunch1". Whenever I found this, I changed it to "PLASMASHOTSOUND1". I then inspected the Devastator's firing sound entry, and thus created the following entry in the HarkonnenSFX.txt file:
[PLASMASHOTSOUND1]
Sounds=hk_devastator_1d
Control=random
Limit = 1
Volume=70
You can also do a similar thing with any sound - reloading, starting to move - just follow the same process.


<|> Nema Fakei

All trademarks acknowledged. Material is not necessarily for public use; any illegal activity is not condoned by the author, even if is implied or supplied by information contained in this site. UK laws apply. The author is not responsible for losses as a result of this website or its contents.  This site may contain information unchecked by the author; again, no responsibility can be accepted for any losses incurred on the use of this site or any sites mentioned here.

Hosted by www.Geocities.ws

1