Page 1 of 21 1234567891011 ... LastLast
Results 1 to 20 of 409

Thread: How to create a custom unit - a complete guide

  1. #1

    Icon1 How to create a custom unit - a complete guide

    How to create a custom unit - a complete guide


    This step-by-step guide was written by various members (see credits in the end) in various threads, I just tried to gather all the important information in one tutorial and added my thoughts as well. There are still some unknown issue regarding unit creation (like changing an unit's 3D model), but you should be able to make your own custom unit if you follow this guide. If you have problems or suggestions, ideas, post them.




    STEP 1. Downloads
    • Download the Pack File Manager (PFM) from here.
    • Download the Sample Mod Pack from here. (I attached the zip file to this thread, because there were some problems with the attachment in the other thread.) Unpack the zip and put user.empire_script.txt in your C:\Documents and Settings\username\Application Data\The Creative Assembly\Empire\scripts (XP) and place the my_pack.pack in your C:\Program Files\Steam\SteamApps\common\empire total war\data folder (XP). Those who have other mods already installed and understand the use of user.empire_script.txt will know they can edit their own script and rename the mod pack to what is suitable for them. To remove the mod simple delete the script and pack file.


    STEP 2. Creating a new unit (Based on The Phenom's excellent guides)
    • Open my_pack.pack with the Pack File Manager (It is in the /data folder of within installation directory).
    • Choose the unit you want to clone (use as a template), f.e. euro_line_infantry_austria.
    • The files you need to edit are:

      building_units_allowed
      unit_stats_land
      unit_to_unit_abilities_junctions
      units
      units_to_exclusive_faction_permissions
      units_to_groupings_military_permissions

    • The first file we are going to edit is "building_units_allowed". In order to do this, select and expand the "building_levels_tables" under the "db" directory. After this select "building_units_allowed". You will see a tab. Find your chosen unit to clone. Copy or clone all the lines of the original unit and rename it accordingly. [Select that row and click "Clone Current Row" button (on the top of the file manager). This will copy the selected row to the end of the tab. Now you need to rename the unit from "euro_line_infantry_austria" (in our example) to something else for example "mycustom_unit". To edit the first column you have to disable "Use first column as row header" in the options.] Now, you will need to make them recruitable in advanced military buildings so that you can recruit them as you upgrade your Army Barracks in the Grand Campaign. In order to do this, clone the line of you new custom unit 3 times, so that you have 4 rows with your new unit, starting with:

      military_academy
      army_board
      army_staff_college
      army_barracks
    • Repeat this process (cloning the row of your chosen unit and renaming it.)with the other files as well:

      unit_stats_land
      unit_to_unit_abilities_junctions
      units
      units_to_exclusive_faction_permissions
      units_to_groupings_military_permissions

      The units_to_exclusive_faction_permissions is especially important as it sets which faction has access to your custom unit.
    • Save the process.
    • For "units_to_gov_type_permissions", open the main.pack using Pack File Manager. Expand the "db" directory under the "main.pack". Then select "units_to_gov_type_permissions_table". After that, right click on it and select "Extract Selected..." Import it in the my_pack.pack.
    • Giving your unit a screen name. Go to the localisation.loc tab in my_pack.pack and make an entry for your new unit

      "units_on_screen_name_my_customunit My Customunit" (for example)

      This will give a screen name for your unit, hurray! It should appear in your game now (the fastest way to test this is to look for it in the custom battle setup page).
      To make sure the screen name will appear in the game, open up the patch_en.pack and implement these screen name changes there too and save the file.
    STEP 3. Create the texture of an unit (also "how to change the texture of an unit")

    1. Note: for advanced photoshop tips try looking in this thread, in this thread, and in this thread.
    2. Decide which unit would you like to retexture. Make some research, use google images or other sources to find out the details.
    3. Check first if the unit you'd like to reskin has been modded and posted here.
    4. If you don't have the nvidia photoshop plugin installed, download it first from here:
      http://developer.nvidia.com/object/p...s_plugins.html
    5. Open up the models.pack file. Go to unitmodels/textures and find the texture(s) you'd like to modify. Select it, right click and choose "Extract selected".
    6. Open the extracted texture file with photoshop. There are usually 3 files for each unit, a normal, a gloss and a diffuse.
      euro_militia_infantry_france_normal.dds
      euro_militia_infantry_france_gloss.dds
      euro_militia_infantry_france_diffuse.dds

      Open the last one (diffuse), don't bother yourself with the other 2 for now. As you can see, each file contains 4 faces and 2 sets of bodies, which the computer randomly generates the units from.
      Spoiler Alert, click show to read: 

      The gloss map tells the game where to splash the factions colour on the texture. Here is the one for light infantry:
      Spoiler Alert, click show to read: 

      If you would like to make changes on the texture covered by the gloss areas, here's what you have to do: rename and use another gloss map which doesnt paint those areas in the faction colour, but has the same tunic layout (for example the euro_artillery_gloss_map.dds). Or paint the whole image black (by switching on the alpha channel first). Or just use a blank picture and save it as the gloss map of that unit.
    7. Repaint/redraw the image as you wish.
    8. Regarding editing the gloss map
      Spoiler Alert, click show to read: 
      Quote Originally Posted by waronmars View Post
      If in photoshop you go to the channels tab on your layer window, you will see a list of channels called RGB, red, green, blue and alpha.

      The green and MAYBE the red channel are to do with the actual gloss map, hence the file name
      The blue and alpha channels are the ones we are interested in, as they are telling the game where to put the uniform colours. The blue channel is going to determine the trim areas of colour, and the alpha channel will determine the main fabric areas.

      This means you pretty much want to leave your red and green channels alone, and play around with the blue and alpha channels. The way these channels are set up is that the blue channel is telling the WHOLE coat, including trim, to be one colour, then the alpha channel is overriding the main areas of the coat to a different colour, and leaving the trim to the blue channel.

      IF you edit the texture with only one channel visible, it should appear black and white, and WAY easier to change around :p

      Until someone works out where we can change what colours are associated with certain factions, you can only play with the colours already on the units. But you can change around the locations of the colours that are already there.

      Regarding changing the stack icons might be a bit hard until editing those pesky data files is more viable.
      http://www.twcenter.net/forums/showthread.php?t=237615

      There is a single gloss map for many diffuse maps... this means any edits to the gloss map is going to affect multiple units. May have to stick with editing diffuse textures labelled with individual factions, again until the scripting side is figured out. Some units have their own, like France's linesmen, but not many.

    9. Save the new dds file on the same name as the original file with the following settings:
      DDS SETTINGS
      DXT5 ARGB 8 bpp | interpolated alpha
      Generate MIP maps checked
    10. Repack the modified file by opening my_pack.pack, selecting "my_pack.pack" --> right click --> add file(s) --> select the modified textures (warning again: they should have the same names as the original files) --> save my_pack.pack.
    STEP 4. Add texture to a newly created custom unit (based on MrThibs detailed tutorial here

    • Open my_pack.pack and go to unit_stats_land_tables, locate the row of your custom unit and change its model name (8th column) to a custom model name.
    • Import warscape_animated_lod_tables from patch.pack to your custom pack.This file looks like this
      Spoiler Alert, click show to read: 
    • The first column is the line ID, a random number. If you make a new row for your custom unit, just add another random number here.
    • The second Column is the path to the 3D mesh (it use the same folder structure path than all the other packed files). Each 3D model comes with four meshes (perhaps not all of them, should be confirmed) that, in my understanding, are relatives to details and graphical options (the weight differences). This is where we’ll be able to add custom 3D meshes when we’ll be able to work with them.
    • The third Column must be affecting graphical settings, it's not entirely known yet. It’s associated with the different meshes. (for now just copying the actual settings of similar models is the safest way to go).
    • The last Column is the model name found in the other db files (the name of your custom unit).
    • So, knowing this, adding my entries is not hard at all (use the filters function to looks through default files to copy what you need):
      Spoiler Alert, click show to read: 
    • Copy the path to the meshes from the default file.
    • Now, you need to link the texture you want to use with your model, this information is located in the warscape_animated_tables. Import it from patch.pack. This tab is quite clear, the first column is the unit name, the second column is the path, the third column (category) should be left as it is. So clone a similar row and fill in the proper data.
    • Now you just have to add your textures to the pack. Be warned that the unit names you gave in the files and the texture file names have to match. For example if your unit name is "bloody_pirates", your texture should be named "bloody_pirates_diffuse.dds". etc.
    • Save your work and enjoy.


    STEP 5. Modify unit specs
    • This is quite easy. Open up my_pack.pack with the PFM.
    • Go to unit_stats_land, find your unit (it should be in the end if you followed my guide). Modify the data. Save the pack.
    • Make sure the box you're editing isn't active anymore when saving (click somewhere else).
    • Look for the rest of the tabs as well, f.e. you can modify the tech abilities of the unit in the unit_to_unit_abilities_junctions tab.
    • For modding weapon range, enter: projectiles_table (import it from patch.pak).


    STEP 6. Creating a custom unit card
    • Modifying an existing card. Go to ui.pack --> units/icons. Find the unit card you want to modify --> select it --> right click --> extract selected --> locate it in the ui/units/icons folder. Modify and save it (its extension should rename .tga). Add the modified file(s) in your custom pack --> save.
    • Creating a new unit card. Create an image of your unit, crop it, resize to 66x88 pixels (extension should be .tga). Put it in the data/ui/units/icons folder. Open up your custom pack file, add the new image(s). Now go to db/units_tables/units tab, go to the line of your custom unit, go to the 12th column and enter the name of the card image file (f.e. if your custom unit card was named bloody_pirates.tga, write bloody_pirates here).


    STEP 7. How to edit the AOR (Area of Recruitment) of an unit

    See the tutorial here.


    Credits:
    [user]LtChambers[/user] - Pack File Manager
    [user]juniroxors[/user] - Sample Mod Pack
    [user]HellFell[/user] - for the unit creating breakthrough
    [user]The Phenom[/user] - for various unit creating tutorials
    [user]MrThib[/user] - adding textures to custom units
    [user]warmachine[/user] - unit texturing info
    [user]waronmars[/user] - unit texturing info
    [user]Tharros[/user] - AOR unit tutorial

    Before you rep me, go around and rep these people please, as they are the main contributors of this guide compilation. If you don't rep them, I will e-slap your face, that's a promise.
    Last edited by Aldgarkalaughskel; May 10, 2009 at 12:01 PM. Reason: updated

  2. #2

    Default Re: [Tutorial] How to change the texture of an unit

    You should sticky this.

    [You're a moderator right?]

  3. #3

    Default Re: [Tutorial] How to change the texture of an unit

    CHEERS!!!
    +rep to you and warmachine!

  4. #4
    danova's Avatar Protector Domesticus
    Join Date
    Aug 2007
    Location
    Hungary / Budapest
    Posts
    4,668

    Default Re: [Tutorial] How to change the texture of an unit

    Good job mate!
    Rep.
    .

  5. #5

    Default Re: [Tutorial] How to change the texture of an unit

    Wow!

    Thanks so much for your effort!!!


  6. #6

    Default Re: [Tutorial] How to change the texture of an unit

    I don't think you need to unpack everything. Just right-click on the file you want to modify from the pack manager and select "Extract Selected."

    Also, it would be safer to create a new patch pack file for your modified textures, except for those modified by the "patch.pack".

  7. #7
    danova's Avatar Protector Domesticus
    Join Date
    Aug 2007
    Location
    Hungary / Budapest
    Posts
    4,668

    Default Re: [Tutorial] How to change the texture of an unit

    And these are very useful:

    Quote Originally Posted by waronmars View Post
    ...
    warmachine- regarding editing the gloss map. If in photoshop you go to the channels tab on your layer window, you will see a list of channels called RGB, red, green, blue and alpha.

    The green and MAYBE the red channel are to do with the actual gloss map, hence the file name
    The blue and alpha channels are the ones we are interested in, as they are telling the game where to put the uniform colours. The blue channel is going to determine the trim areas of colour, and the alpha channel will determine the main fabric areas.

    This means you pretty much want to leave your red and green channels alone, and play around with the blue and alpha channels. The way these channels are set up is that the blue channel is telling the WHOLE coat, including trim, to be one colour, then the alpha channel is overriding the main areas of the coat to a different colour, and leaving the trim to the blue channel.

    IF you edit the texture with only one channel visible, it should appear black and white, and WAY easier to change around :p

    Until someone works out where we can change what colours are associated with certain factions, you can only play with the colours already on the units. But you can change around the locations of the colours that are already there.

    Regarding changing the stack icons might be a bit hard until editing those pesky data files is more viable ;(
    http://www.twcenter.net/forums/showthread.php?t=237615

    DDS SETTINGS
    DXT5 ARGB 8 bpp | interpolated alpha
    Generate MIP maps checked

    ...

    edit:::: I just realised there is a single gloss map for many diffuse maps... this means any edits to the gloss map is going to affect multiple units. May have to stick with editing diffuse textures labelled with individual factions, again until the scripting side is figured out. Some units have their own, like France's linesmen, but not many.
    Quote Originally Posted by warmachine View Post
    Ive actually just found that whilst all generic units have several diffuse dds files, but only one common gloss map file, if you create a custom gloss map file, the game takes it. For instance if I create a new gloss map with a _britain in the file name, the game accepts and applies this file.

    What does this mean? It means you can have full custom texture common units for each faction. So if you wanted spanish line inf units with white coats and orange lapels, whilst keeping the other line inf units the same, or custom, then you can.
    Quote Originally Posted by warmachine View Post
    You can use a gloss_map from a unit that has none or little amount of faction colouring (rogers rangers for example) and rename it to euro_line_infantry_britain_gloss_map.dds, or euro_line_infantry_spain_gloss_map.dds and the game will use it for those line inf units of those factions only. Then you can paint the euro_line_infantry_britain_diffuse.dds however you want. That way it allows you to keep the generic gloss map intact, which is good for people who dont want to custom texture all the units at once.
    Last edited by danova; March 17, 2009 at 05:02 PM.

  8. #8

    Default Re: [Tutorial] How to change the texture of an unit

    Thanks for adding those, danova.

    Quote Originally Posted by GroupofSpearmen View Post
    You should sticky this.

    [You're a moderator right?]
    No, I'm not, but I added this to the stickied mod thread index.
    Last edited by Aldgarkalaughskel; March 17, 2009 at 05:10 PM.

  9. #9
    danova's Avatar Protector Domesticus
    Join Date
    Aug 2007
    Location
    Hungary / Budapest
    Posts
    4,668

    Default Re: [Tutorial] How to change the texture of an unit

    and thanks once more and rep for warmachine and waronmars!
    .

  10. #10

    Default Re: [Tutorial] How to change the texture of an unit

    I'm actually not so sure what the blue channel changes, with my fiddling with Spain's textures it seems that the diffuse maps have the appropriate trim color and only the alpha channel is changing any colours according to faction. I deleted the blue channel on the French linesmen and tested it ingame, with no difference. Curious.

    You can in fact change the faction colour that is used on the battle map by editing the factions.db file, but you need to be willing to mess with some hex

    Oh, and when editing textures you MUST save .DDS files in DXT5 format !
    Last edited by waronmars; March 18, 2009 at 12:53 AM.
    I speak Spanish to God, Italian to women, French to men, and German to my horse. -Charles V

    My Mods- PipMod, LeatherUI, Spain Retexture+flag swap
    My website

  11. #11

    Default Re: [Tutorial] How to change the texture of an unit

    Quote Originally Posted by waronmars View Post
    I'm actually not so sure what the blue channel changes, with my fiddling with Spain's textures it seems that the diffuse maps have the appropriate trim color and only the alpha channel is changing any colours according to faction. I deleted the blue channel on the French linesmen and tested it ingame, with no difference. Curious.

    You can in fact change the faction colour that is used on the battle map by editing the factions.db file, but you need to be willing to mess with some hex

    Oh, and when editing textures you MUST save .DDS files in DXT5 format !
    If you figured out how the gloss map works, please share your experiences.

  12. #12

    Default Re: [Tutorial] How to change the texture of an unit

    I'm having huge troubles with the g'damn gloss maps.
    I tried to recolour the yellow colour on Swedish Line Infantry, just to try it out, with no success...

    I've got tons of plans to change the Swedish army textures! I wish I could execute them x)

  13. #13
    l33tl4m3r's Avatar A Frakkin' Toaster
    Join Date
    Mar 2009
    Location
    Soldier of Fortune
    Posts
    6,330

    Default Re: [Tutorial] How to change the texture of an unit

    Thanks for this Wiz! It's a shame I have no talent with textures at all!

    hahaha!
    [House of Caesars|Under the Patronage of Carl von Döbeln]

  14. #14

    Default Re: [Tutorial] How to change the texture of an unit

    i see the texture format isnt very diferent from medieval II DTX5 .dds gloss map ....

    Thanks +rep

  15. #15
    Senator
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    1,350

    Default Re: [Tutorial] How to change the texture of an unit

    can som1 make a tutorial on how to repaint the textures using photoshop?


  16. #16

    Default Re: [Tutorial] How to change the texture of an unit

    Quote Originally Posted by lesterthenerd View Post
    can som1 make a tutorial on how to repaint the textures using photoshop?
    Try asking here:
    http://www.twcenter.net/forums/forumdisplay.php?f=949

  17. #17
    Miles
    Join Date
    Mar 2009
    Location
    Lille, France
    Posts
    325

    Default Re: [Tutorial] How to change the texture of an unit

    I second that the blue channel isn't affecting the color (by factions) or the luminosity, I think it could be some sort of mask on wich depend some texture effects (usualy found on some belts or hat)...
    The alpha is easily workable: paint it in black and put the colors on the diffuse just work fine.
    To my statement, the green channel work for metal, that could be some reflection map (pricipaly affecting the sun, see in plate armors) while the red is the global illumination map as far as I guess.
    There is some nice tools to play with normal map like the one that was post in the "My experiment with texture" tread which is called crazybump (all the rep go to the original poster).
    this tool work fine importing directly diffuse maps for generating normals with a nice and fast preview feature:



    Have fun texturing

  18. #18

    Default Re: [Tutorial] How to change the texture of an unit

    Great thread. One very effective way of creating detailed normal maps without the use of an external program such as CrazyBump is the "overlay + blur" method. I remember seeing a tutorial about it somewhere, but I can't find it

    Anyway, from memory, the method in Photoshop is basically as follows:

    1. Run the nvidia normal map filter on your texture.
    2. Duplicate the background layer, and set it to "overlay".
    3. Use the Gaussian Blur filter on your new layer, with a strength of about 0.5-2, it depends on the size and your own preference really.
    4. Duplicate the original background layer again, set it to overlay, but this time blur it at about a 0.5-1 higher strength than before.
    5. Rinse and repeat a few times, until the stronger blurred layers become no longer noticeable.
    6. Flatten the image into one layer.
    7. Run the nVidia normal map filter again, but this time with it set to "Normalise only".

    A simple method like this could easily be compressed into an action, but I personally find it easier to do it manually, as different textures need to be fine-tuned to a different amount.
    Anyway, good luck, I hope to see more great community created textures soon!

  19. #19
    Senator
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    1,350

    Default Re: [Tutorial] How to change the texture of an unit

    awesome thanks! pretty soon im gonna give it a go.


  20. #20

    Default Re: [Tutorial] How to change the texture of an unit

    I updated this guide from a texturing guide to a complete, but unfinished how-to-make-your-custom-unit-guide as I find some tutorials obsolete with the new PFM 1.9.9. As you can see, we still need to figure out some things like assigning textures to a custom unit and importing/exporting models.

    Post away your questions, suggestions, ideas.

Page 1 of 21 1234567891011 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •