I'll go ahead and cover the basic elements of editing a unit via INI files here, to eliminate any confusion at early stages.
First off, a very basic principle to understand - forget everything you learned in TS and/or RA2. Generals' engine is almost entirely
object orientated. In plain terms, that means that theres no such thing as a 'building' or an 'aircraft' or a 'vehicle' or an 'infantry' or even a 'tree'. Everything in Generals is simply an 'object'.
In TS or RA2, you defined the behavioural characteristics of things with 'tags' or 'statements'. In Generals, all objects are defined by 'modules' instead. Each module does a specific job. So instead of using Primary=A_WEAPON, in Generals theres a module to define an objects weapons. Theres another module for armor and so on.
What this means is that there is enormous flexiblity in the engine as most modules can be used on any object although there are some logical restrictions where certain modules cant be used in conjunction with others. In plainer terms, imagine being able to make a VehicleType work with Carryall=yes set insetad of it being restricted to an AircraftType and you have some idea of what can be done.
Take a look at at any unit in FactionUnit.INI and you'll see they are made up of a section that all follow the same convention;-
Code:
Object [objectname]
...
End
Simple enough isnt it? Well yes, but theres all kinds of stuff that has to go in there. Its important to understand that every module you stick in this section gets nested properly - in other words, every module has to be opened (by using the name of the module) and closed (by using the End statement).
First things first, we'll use the Marauder Tank (I kinda like that unit hehe) so we need to tell the game how our unit gets displayed. This is done by the Art Parameters, which effectively are like the ART.INI settings from TS and RA2 except better.
You can first define the basic art stuff like its cameo. Every object needs 2 cameos specifying - a large one for when it is selected (this one appears on the right of the control bar) and a small one to use for building it etc (i.e. your traditional cameo). As a tip, you only really need to make the large one - the game will auto-resize it to be small if necessary. However, I dont recommend doing this as the code that resizes it is primitive and exists only as a debug tool to prevent the old 'Missing Cameo' problem. The result is usually a poorer quality scaled down version of the larger one, so do it yourself for better results. Specify your cameos like this;-
Code:
SelectPortrait = SUMarauder_L
ButtonImage = SUMarauder
SelectPortrait= is the one used when its selected (duh) and is the bigger image, and the small one is its button (or true cameo). If you set
both of those images to SUMarauder_L, the big one will get resized and used for the small image. Nice. The game even turns them into black & white and highlights them automatically so you dont even need to make different versions. Nicer.
Where do those names come from? Simple. Every single 2D image in the game, no matter how/where its used, comes from a Mapped Image. Mapped Images are ones which are taken from a 'texture page'. A texture page in Generals is a 512x512 24-bit color TrueVision Targa image with no alpha (if you use alpha you get weird effects when cameos are drawn). Each texture page contains one or more seperate images, including cameos, menu images etc etc. Each time you want to use a cameo, you have to tell the game which image you want, and then from which Mapped Image to fetch it. All of these texture pages can be found in Textures.big, so you can extract and edit them in your decent image editing program.
To specify the cameo, and whereabouts to get it from, you need a Mapped Image INI file. Every mapped image has a corrosponding INI file, and that file tells the game (i) which mapped image it defines and (ii) which images are contained in it as well as whereabouts they are.
Going back to our Marauder example, we need to find SUMarauder_L and SUMarauder, so its worth talking about Generals naming convention here.
Like TS and RA2, theres a global file naming convention that makes life easier for us. The convention applies to all 2D images for all objects and works like this;-
SYname_E
'Y' can be;-
A = America
N = China
U= GLA
C = abilities (like fire weapon etc)
S = science (like super weapons etc)
_E = optional and is usually _L for the larger image. _D, _H and _P are no longer needed as the game creates the effects for Disabled, Highlighted and Pushed automatically.
So, SUMarauder_L is a GLA image called Marauder_L. That will appear therefore in the SUUserInterface512.INI file - got it? Keep the naming convention consistent. In that file, you will find the SUMarauder_L entry;-
Code:
MappedImage SUMarauder_L
Texture = SUUserInterface512_002.tga
TextureWidth = 512
TextureHeight = 512
Coords = Left:1 Top:1 Right:121 Bottom:97
Status = NONE
End
Logically, it specifies the SUUserInterface512_n.tga file - as this is the SUUserInterface512.INI file. Remember, one INI file controlling all the images for one thing. This one controls all the SUUserInterface ones.
Open SUUserInterface512_002.tga in your image editing program and youll see all the cameos. Move the mouse about, and keep an eye on the co-ordinates on screen. The Coords= tag above tells the game whereabouts in that image the cameo is located (in this case wheres SUMarauder_L). Together, the coords specify the top-left and bottom-right of the image (so it can use that info to pull the image and also to resize it if nesc).
You can copy that bit of the mapped image out, edit it, and put it back in if you like to change the cameo. Just keep the size and location the same. Its much easier to make your own though, so make a new .tga format image, 512x512 pixels in size with 24-bit color, and stick your cameo somewhere on it. Make a note of the top-left and bottom-right coords of your cameo, and use them to define its location. You can then make a new mapped image INI file that tells the game all about your cameo.
Save your .tga file, and make sure to specify no compression and no alpha. Call it SXUserInterface512_001.tga for simplicty sake. Then make a new INI file called SXUserInterface512.INI and put this entry in for your cameo (Im calling the cameo SUGLATank_L);-
Code:
MappedImage SUGLATank_L
Texture = SXUserInterface512_001.tga
TextureWidth = 512
TextureHeight = 512
Coords = Left:x Top:y Right:x Bottom:y
Status = NONE
End
Remember to put the coords in - i.e. whereabouts the cameo is in the mapped image itself otherwise the game wont be able to find it! Finally, you put your new mapped image .tga file in Art\Textures and your new INI file in Data\INI\MappedImages\TextureSize_512.
To recap;-
- make sure you specify which cameo to use in your units definition in FactionUnit.INI (or for your building, in FactionBuilding.INI);
- make sure you have made the cameo in a new .tga image file which is 512x512 in size and 24-bit color depth, with no alpha and no compression;
- make sure that .tga file has a corrosponding INI file which tells the game where your cameo is in that .tga mapped image file;
- make sure that INI file has the appropriate entry thats called for by your unit/building.
There you have it - the very very basics of cameo editing. Not half as simple as RA2 but a lot better and a lot more flexible.
EDIT: my housemate just followed that, heres his result, and if he can do it then anybody can
