C&C: How to create new units - a tutorial: The Mutant
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Well, CCEdit v4 is just about finished (it is at Beta 0.99 and available at
my website - mentioned below), so I thought that I'd try and start up a
little discussion about how you can go about creating "new" units for C&C.
After all, we have to do something to fill the wait for RA.

Let me define "new" first:
I do not mean add in additional units to C&C. This is impossible. What I
mean is that you change the characteristics of a currently existing
unit/building so that it takes on the desired properties of the unit that
you wish to create.

There are a couple of programs that you will need first:
1. CCEdit v4. Although officially a Beta, it is 99% finished and is fully
functional. It lets you edit every value of every unit in C&C. It will also
be used to create the patch files that will contain your new unit.
You can obtain this file from:
http://www.geocities.com/TimesSquare/5458
in the C&C section.

2. Mixman v3.1. If you wish to go that extra step and actually change the
*graphics* for the units in C&C, then you will need this program and its
associated files. There are programs here that let you extract the graphics
from the C&C files, convert them to pcx files, and convert pcx files to the
C&C format. You just use any paint (or 3D modelling) program to edit the
pcx files.
You can obtain this file from:
http://www.geocities.com/SiliconValley/8682

Naturally enough, you need C&C :)


I'll go through this process by using an example. This is a little unit
that I thought up called the Mutant.

Background of the mutant: The effects of Tiberium upon humans was usually
fatal, but there were a few cases where the person exposed to tiberium
didn't die but instead underwent strange biological changes. Just like
trees were genetically twisted into becoming blossom trees, so some humans
were mutated. Making the Hulk look like a wimp, their mutation resulted in
incredible strength and endurance. Strangely, this mutation did not provide
protection from the effects of tiberium poisoning.

Note: this unit isn't meant to become a unit that you buy, it is meant to
introduce a little element of surprise into games on maps where there are
civilian units running around. This unit behaves like civilian units, in
that after it has taken a little bit of damage, it begins to run aroudn a
lot. A pair of mutants can easily take out a gun turret, but they will run
around a lot doing so. Being as tough as they are, they just keep on coming
back for more punishment.

Ok, the first thing to do is to start CCEdit. Go to the Infantry screen
and scroll down the list of infantry units until the civilian infantry unit
C2 is selected. You can do this with any unit really, but I chose C2 for a
number of reasons:
1. C1 and C7 are the technician units that you get when you sell silos.
2. the colouring of the C2 character is a rough estimation of the final
colours I'd like to use.

Now, bring up the tab and cause all patch variables to be false (as you
only want a few variables to be changed). Swap sides so that the values list
is current. You want to make the following changes to this unit:
As you make these changes, remember to press the Space bar so that the value
will be stored in the patch file.

* 'Speed' is changed to 12
This makes the mutant the fastest infantry unit around, although it is
still slower than nearly all the vehicles.

* 'Primary weapon' is changed to Dinosaur Bite 1 (chew)
This weapon is used because, while it does excellent damage against
lightly armoured targets, heavily armoured units (tanks etc) don't take
nearly as much damage. Using Dinosaur Bite 2 (gore) is too inbalancing, as
this chews through anything.

* 'visual radius' is set to 2

* change the 'Can be built by' so that JP cannot build the unit (just in
case someone is using the funpark option).

* 'Hit points' is changed to 127
The mutant is a tough nut to crack.

* 'Shots before reload' is changed to Unlimited

* 'Unit can aim' is set to Yes
Please note: I'm not 100% sure that this title is correct - ie this
variable may not be needed to have the unit aim (in fact, I'm pretty sure
that it isn't). I worked this value out a while ago and my notes from then
are pretty pathetic - the unit seems to work fine if this is kept at No.

The changes have been made. As you look along your patch list, you should
see that there are 7 green circles (or 6 if you didn't set the unit can
aim variable). Go to the main screen, bring up the command tab, and select
Make a patch. Name the patch file something like 'mutant', or something
obvious. You have now created a patch file containing the mutant unit. You
can give this patch file to people and have then use CClite (or CCEdit)
to use this, and the only values it will change are the 7 ones you altered
above. If you want, you can save the values to your game.dat file, or not
- you can just use CClite to install the patch when you want to use it.

Now, it is good form to also supply a patch that will get rid of this
alteration. If you haven't saved the changes, then all you need to do is
hit Undo ALL, which will revert the values you changed back to what they
were before. Then just create another patch, calling this one 'unmutant'
or something. The undo command will not work if you have saved the
information to file - in this case, you have to go back and change the
values by hand. Using the undo command will leave the patch variable
unchanged, but will revert those values that have been altered since the
last save (or the start of the program), which makes it perfect for
creating a patch file that undoes the changes.

Now someone can use your mutant patch, then de-install it with ease. These
patches are fully portable between versions of C&C, so there is no problem
with creating it on (say) a version 1.20 of C&C and having it used by a
version 1.07 person.

Nothing to it :)


Now we move on to the advanced stage - changing the graphics.
An important note must be added here: if you are altering the graphics
for a unit and basing your work on the art that comes with C&C (ie simply
recolouring a unit), you should NOT distribute this art. The artwork in
C&C is copyright to Westwood, and it is not a good idea to post their
artwork around the place - they are likely to get annoyed.
However, if you do the graphics from the ground up, there are no problems
with distributing the artwork, as you own it.

Ok, first thing you want to do is extract the graphics for the unit (in
this case the C2 civilian). Get mixman 3.1 out and open the conquer.mix
file with it (copy it to your HDD if it isn't there already). The C2 unit
is at Index 46 (or Position 186), but Vladan has identified it "UNIT:
Civilian #2". Extract it (just accept the offered filename).

Now you want to open the file 'temperat.mix' (again, copy if from your
cdrom if you have to) and extract the palette from it. It is at Index 62
(or Position 42). Accept the default file name. Quit mixman.

Now, you want the program shp2pcx (comes with the distribution). First,
you might want to get some information about the images contained within
the c2.shp file. Type:
shp2pcx -i c2.shp
You should see this on your screen:
SHP2PCX   SHP to PCX converter V1.01  Copyright (C)1996 Vladan Bato

SHP Info :
 -Number of frames : 375
 -Frame Width      : 50
 -Frame Height     : 39
 -Unknown Field 1  : 0066h
 -Unknown Field 2  : 0073h
 -Unknown Field 3  : 000000A7h

From this, you can see that each picture in this file is 50 pixels in
width and 39 in height, and that there are 375 in total.
Now, you want to convert this to a pcx file. Do the following command
(for example):
shp2pcx c2.shp
This will create the file 'c2.pcx' which will contain all the graphics
from this .shp file.
If you want to get a single column of frames, use the command:
shp2pcx -c:1 c2.shp
This can be useful in some cases (ie having all the graphics in a single
column rather than as multiple frames per row).
If you used the command: shp2pcx c2.shp, you should see the information:
SHP2PCX   SHP to PCX converter V1.01  Copyright (C)1996 Vladan Bato

Loading palette : TEMPERAT.PAL
SHP Info :
 -Number of frames : 375
 -Frame Width      : 50
 -Frame Height     : 39
 -Unknown Field 1  : 0066h
 -Unknown Field 2  : 0073h
 -Unknown Field 3  : 000000A7h
PCX Info :
 -Columns : 12
 -Rows    : 32
 -Width   : 600
 -Height  : 1248
You should take a note of all this (write it down), as you will need it
to convert the pcx files back to .shp format.

Now, go away and do whatever you plan to do to the c2.pcx file that you
just created.

To convert your edit pcx file back to the .shp format, use the command
(not all the parameters are necessary, but are a good idea):
pcx2shp -n:375 -w:50 -h:39 -c:12 -u1:0066h -u2:0073h -u3:000000a7h c2.pcx

This will convert the file c2.pcx to the file c2.shp.
Now, you need to replace this new file into your conquer.mix file. Open
it with mixman, scan down to Index 46, and Replace with this new .shp
file. Now, when you play C&C and come across a C2 civilian unit, your
new graphics will be shown.

Cool eh? :)

Now, say that you have done all that, created the patch files and created
some all new graphics, and want to distribute them so that other people
can use them. What you should do is the following:

Create 2 batch files - one to install your new beasty, and one to uninstall
it. I'll give an example using the mutant.

Say I have 3 files: mutant.pat, unmutant.pat and mutant.shp
I would create a zip file containing the following files:
mutant.pat, unmutant.pat, mutant.shp, newunit.bat, oldunit.bat, cclite.exe,
cclite.txt, mmlite.exe, and mmlite.txt.
On my experiment, this resulted in a zip file of just over 40K in size.

You can get as esoteric as you like, but your bat files would look
something like:
newunit.bat:
mmlite conquer.mix -e i46 oldc2.shp
mmlite conquer.mix -r i46 mutant.shp
cclite -u mutant.pat

This will extract the original C2 graphics into the file oldc2.shp (so that
the graphics can be restored to the original), then inserts the new
graphics, then calls cclite to change the values.

oldunit.bat:
mmlite -r i46 oldc2.shp
cclite -u unmutant.pat
del oldc2.shp

This wil replace the C2 graphics with what was extracted during the
installation, and call cclite to change the values with the patch that you
created to undo the mutant changes. It cleans up after itself (no need for
a hundred odd .shp file hanging around).

That's it. You now have all the information you need to go out and create
new units for C&C. Just read the documentation that comes with mixman and
CCEdit, and do it thoroughly. I have absolutely no artistic ability, so
can't produce any new artwork myself, but hope that this will give some of
the C&C fans out there who do have artistic talent an incentive (and the
knowledge) about how to go about doing this.

Some information that may be useful about which theatres the various
civilian buildings appear in:
  There are 3 theatres, desert, winter and temperate, which tells C&C
  which graphics set to use. Those units and structures that appear in
  all theatres are stored in the conquer.mix file. Those that are
  specific to a particular theatre are stored in the appropriate .mix
  file (desert.mix, winter.mix and temperat.mix).

  The civilian building ARCO (the Oil Tanker) appears in all theaters.

  The civilian building V19 (the Oil Pump) appears in all theatres.

  The civilian buildings V01 to V18 appear in both the winter and temperate
  theatres. Please note, the some of the graphics of these structures do 
  change depending on whether you are in the winter or temperate theatres.

  The civilian buildings V20 to V37 appear only in the desert theatre.
  (btw, V37 is supposed to be the Westwood Studios building)


Andrew
(author of CCEdit)
