Skinning Chapter Two
: Extracting .DDS Textures

1. Preamble

DISCLAIMER: Because Modding this game is not supported on a technical level, you will be continually overwriting and backing up files. You are modding this game at your own risk. I will take no responsibility if what you do to your game corrupts it or becomes unplayable. However you can always uninstall and reinstall the game to get it back to 'default'. I highly recommend backing up all savegames before you start modding (instructions on this to follow) as uninstalling the game will delete all your savegames.

LEGO Star Wars uses a special archive called a .hgp file to hold all the game data. It is a proprietary archive format created by the game programmers at Traveller's Tales. At this point the model format hasn't been cracked (nor is it likely that the game developers will be allowed to divulge the archive's secrets), but a technique for extracting and inserting the skin image data has been found. By extracting a skin image, editing it, and reinserting it back into the .hgp file we can easily re-skin existing LEGO Star Wars characters.

2. Backing up Savegames

The default location for LEGO Star Wars is

C:\Program Files\Giant\LEGO Star Wars Game\

Use "My Computer" to view the C:\Program Files\Giant\LEGO Star Wars Game\ directory. If you installed it elsewhere, under a \games\ subdirectory for example, that's fine, just find where you put it.

You will see the following (image2.jpg) - maybe with a few more or less savegame directories.

Before we start let's backup all our savegames for safekeeping.

ctrl-click all the
\lsw_?\ directories to select them. Right-click, copy.

Make a new directory somewhere out of the
\LEGO Star Wars Game\ one (as it's totally erased during an unistall) eg. On your desktop

Paste your savegames in there for safekeeping;

Fig 2i. Click for Enlargement Fig 2ii Click for Enlargement Fig 2iii. Click for Enlargement
   

3. Ensuring you can see file extensions in your directories.

There are several similarly named files in each character's directory, so if you haven't done so already, ensure that file name extensions are not hidden. ie. In Windows Explorer a JPEG file named "stormtrooper" would appear as stormtrooper.jpg , not just as stormtrooper

Using the Windows Start-Menu, select "Control Panel". When the Control Panel icons come up, select Folder Options. In the window that pops up, select the "View" tab. Scroll down a little and ensure that  "Hide extensions for known file types" is NOT selected.

Things are also easier to keep tabs on if you view directories as details (my preference) or list rather than thumbnails, tiles or icons.

Fig 3i. Click for Enlargement

 
4.
Exploring the available characters.

Go to

    C:\Program Files\Giant\LEGO Star Wars Game\lego_data\Chars

The directory listing here shows you the characters and objects that we can reskin. Not every character in that list actually made it to the final game. It is possible with varying degrees of success to get some of those unused assets into the game (Zam Wessell, Jawa, Landspeeder) etc.

I will write a new tutorial on how to do utilise these unused assets once the skinning tutorial is complete.

Back to the directory listing, see how several similar characters are grouped together within the directories. eg. In the
\protocol\ directory, you'll see .hgp files for both TC14 and C3PO. Click here for a popup page of all the various characters / objects and in which directory they can be found - note: there may be a few 'extra' items in the list that never actually made it onto the game disc.

 

Fig 1d i. Click for Enlargement

5. Understanding Limitations

Unfortunately at this stage there are some quite big limitations with what can be done, depending on the whim of the programmer who made the UVmaps for the skin wraps over the models. For example the Leia below should have brown arms, but the skinmap uses the same colour block for the torso base and the arms, sadly, and that's the only model with suitable hair to reskin the Padme model to Bespin Leia. Still, plenty of scope to get reasonably close approximations of existing official minifigs, and of course endless possibilities to make custom minifigs all the while working within the limitations of the skin meshes & UVmaps.

Now that permission has been given by the publishers to mod the game there's a slim chance we may be able to get some generic models from the devs to reskin that don't have 'optimised' UVmaps and will allow different coloured torsos, arms, hands, hair, heads, legs, hips. I will work on that soon, but I don't want to annoy the devs too much who are rumoured to be hard at work on an Episode 4-6 LEGO Star Wars game.

And hopefully the opening up of modding the game will lead to more skilled community members coming on board to increase the modding scene for the game as a whole. We could really do with a Mod-manager (like Star Wars: Jedi Knight's "Patch Commander" that allows various mods to be switched on/off with ease)

6. Decide what you intend to create

A very important step this. There's not much point in aimlessly mucking around with a skin hoping that you'll miraculously end up with some amazing new character. While that may work on rare occasions, the best results will come about if you have some sort of idea to begin with. The best way to start is to familiarise yourself with all the models in-game so you can get an understanding of what the limits are. There's no point wanting to make a female skin with long hair and a red arms, white torso and blue legs, when there are no models in game with that hair type that allow different coloured torso / arms / legs.

For assistance with making the designs and patters there are some fine sites online that have custom LEGO Minifig decal images to download for free. While it's not proper to grab other people's work and insert it into your own, you may find some of these decal makers are happy for you to utilise their designs so long as you give proper credit and link back to their websites in the mod's accompanying readme file (more on that towards the end of the tutorial).

For our first attempt at skinning we'll choose a pretty "standard" model. Let's convert the STORMTROOPER to a TIE FIGHTER PILOT. This is good because the two MINIFIGS use the same pieces, just coloured differently.

7. Extracting the .DDS texture file(s) from the .hgp archive

Now to actually do something! If you've installed perl correctly you'll now be able to run perl scripts from the command prompt.

Let's make a working directory on your
C: drive as perl doesn't like spaces in filename paths.

Make a directory
C:\lswmods\

Go to the character directory that houses the character you want to reskin. In this case the stormtrooper is a clonetrooper variant, so you'll find it in;

C:\Program Files\Giant\LEGO Star Wars Game\lego_data\Chars\Clone

IMPORTANT . Your reskinned character will overwrite the existing stormtrooper file. So we need to back up the existing stormTrooper.hgp file so we can restore it later. I will try and figure out a script a script that does this automatically soon, but for now we have to do it the old way;

Make a new subdirectory
\backup\ off

C:\Program Files\Giant\LEGO Star Wars Game\lego_data\Chars\Clone

C:\Program Files\Giant\LEGO Star Wars Game\lego_data\Chars\Clone\backup\

Copy and paste stormTrooper.hgp from \Chars\Clone\ to

C:\Program Files\Giant\LEGO Star Wars Game\lego_data\Chars\Clone\backup\

Now we can restore the original version from this backup directory if necessary at a later date.

Copy and paste
stormTrooper.hgp to

C:\lswmods\

Click 'start' in your windows taskbar. Click 'Run...'

Enter this command into the box (ie. name of script to run 'lswrip.pl' followed by the name and location of the .hgp file you're extracting from

lswrip.pl C:\lswmods\stormTrooper.hgp

Be sure to use the correct capitalisation, this procedure is case-sensitive. Once you hit ENTER, if all went well several new .DDS files will appear your windows default directory and a new text file stormTrooper.hgp.TXT should appear in C:\lswmods\ . The place where your .DDS files should now be is;

C:\Documents and Settings\Owner\ 

Though if you log in to your PC or it has several users, you may not have an \Owner\ subdirectory off \Documents and Settings\

In that case, look in

C:\Documents and Settings\ Your Login Name

You should be able to locate two .DDS files; 77824.DDS & 165376.DDS

Cut and paste 77824.DDS & 165376.DDS to

C:\lswmods\

If you now open up these two images in Paint Shop Pro or Photoshop, you should see these ( Fig 7i. , Fig 7ii. ) - (remember to answer "no" if a box prompts whether or not to display MIPmaps):

     

Fig 7i. 77824.DDS (50%)

 

Fig 7ii. 165376.DDS

Notice that 165376.DDS is just a white blur ( Fig 7ii. ). These are often used as effects (in this case I assume it's a reflection effect on the helmet eyes or something). You generally need not worry about these files - it's pretty obvious which ones relate to the skin of the model ( 77824.DDS ), though some models (especially ones that were not used in the final game) can have more than one .DDS file that are extracted and need edited for the re-skin, it's just that in the optimised models like the stormtrooper above, all the various parts have (usually) been consolidated into one large dds file.

Obviously we only need concern ourselves with 77824.DDS from this point forward.

When you are going to re-skin a character with a human face, often there won't be any mouth (and sometimes eyes) on the face area ( Fig 7iii. ). This is normal, don't go adding your own face features in, as the face features for that character will be added in and animated by the game itself.

Fig 7iii. No Face on Jango


 

>> CLICK HERE FOR CHAPTER THREE: EDITING .DDS IMAGES <<