1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

HOW TO: Get your mod to load faster

Discussion in 'Civ4 - Modding Tutorials & Reference' started by Kael, Sep 29, 2006.

  1. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    HOW TO: Get your mod to load faster

    [tab]This guide is particularly useful for mods that use a lot of art resources. The first version of Fall from Heaven took several minutes to load on most machines. This load time got longer as more art resources were added.

    [tab]Dandrae found a solution that allowed the mod to load in a few second instead of a few minutes. He packed all of the art files into a single fpk file. This article will cover the process of doing that for your mods to decrease the load times.

    1. Download PakBuild.exe.

    2. Copy your 'art' directory into an empty directory. For this process we will assume you create a 'Temp' directory on your desktop and copy your art directory into it.

    3. Run PakBuild.exe.

    4. From within PakBuild select File -> New. PakBuild will allow you to select a directory, select the 'Temp' directory on your desktop.

    Spoiler Why don't we pakbuild directly on the art directory in our mod? :

    [tab]Notice we had to select the parent of the art directory. If we did that in the mod we would be selecting the Assets directory and Pakbuild would pak everything under Assets (so the entire mod). Making the final fpk file much larger than we need.


    5. After you have selected the 'Temp' directory you should see the art directory in the left hand window. Make sure you have 'Store File Paths' checked. See the screenshot for an example of what it should look like.

    Spoiler Why don't we use compression? :

    [tab]I could never get compression to work. Regardless though that might shrink the size of your mod it would probably increase load times and slow down the game as it would have to decompress the data to use it.


    6. Select the 'New PAK File' button.

    7. From the Pak menu select 'Build'. This will create the fpk file.

    Spoiler What should I name my pak file? :

    [tab]It doesn't really matter. Civ4 searches the Assets directory for all files that end with a fpk extension. Just make sure it isn't 'Assets0.fpk', 'Assets1.fpk', 'Assets2.fpk' or 'Assests3.fpk' so it doesn't conflict with any of the Vanilla Civ4 files (you don't need to worry about Warlords, they didn't pak their files).


    8. Copy the newly created fpk file into the Assets directory of your mod.

    9. Delete your art directory.

    [tab]That should be it. Please use this thread to post any questions you may have.


    Bonus section (free of charge)

    [tab]Ploeperpengel came up with some great information about art files and the formats they use. You may want to consider the following formats for your dds files:

    DXT1 (ARGB 1 bit Alpha): This is the smallest format to use. Meaning it will take up less size on the disk and in memory. I use DXT1 for all of the 2d graphics in Fall from Heaven. The disadvantage of DXT1 is that there is no gray on the alpha channel, each pixel is either black or white. That usually means it doesn't work well for skins which want to use greys in the alpha channel to blend the teamcolor or provide partial transparency.

    DXT3 (ARGB Explicit Alpha): This is the format Firaxis uses. Its larger, and therefore takes more memory, than DXT1 but it allows shades of grey on the alpha channel.

    8:8:8:8 (ARGB 32 bit): I haven’t really found a use for this format but I include it since it is a viable format for Civ4. It creates pretty big files and I would recommend against using it.


    Mip Maps

    [tab]Mip Maps are multiple versions of the image at different sizes. Having Mip Maps included in the save file increases the size of the file but saves the application from having to resize it on the fly. So in theory it should cause you to have larger dds files but faster performance.

    [tab]Because 2d art isn't dynamically resized I don’t save it with mip maps. I have noticed that if you do save 2d art with mip maps it can look blurry at certain resolutions.

    [tab]If you use mip maps with your skins is up to you. If you don't include mip maps it should make your mod run slower. But I haven't noticed any speed difference either way and the skins look less blurry to me if mip maps aren't included.
     

    Attached Files:

  2. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Clicking New PAK File button needs to be followed by Pull Down Menu option to Build.

    And this is absolutely awesome....can't wait to test it out on 600 MB of Art in ViSa :)
     
  3. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    I must be missing something because it isn't saving the PAK file anywhere after it is built....any ideas?

    The only save option is for the Layout....
     
  4. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Well I tried just one directory of the Art folder and it saved the FPK file....

    Maybe over 11,000 art files is too many :)
     
  5. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    I had more than 11,000 in FfH and it works.

    Are you sure compression is turned off? I got 0 byte fpk files when I tried to use it.
     
  6. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Compression off....everything identical to your directions and screenshot....except the directories of course :)

    keldath will look at this tomorrow too.

    Strange a small 12MB subdirectory will work and the full 600MB won't.

    I had Norton Internet Worm Protection pop on a couple times but looks like a coincidence....exploring everything except beating it with a hammer :)
     
  7. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    Its definilty easy enough to break you art folder into 2 pieces and put each in a seperate fpk. Vanilla civ breaks it into 4 seperate files.
     
  8. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    I tried breaking it into 6, 100MB files....no luck.

    Got all the subdirectories done but the UNITS folder...this is all quite odd.
     
  9. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Narrowed it down some more...

    I split the UNITS folder in half 90 directories and 90 directories...one half worked and the other didn't. It might be possible that a non-art file is in a directory causing an error in pakbuild...even though no error is reported.

    At least it is only 90 directories to inspect ;)


    FOUND PROBLEM
    Non-english directory and some non-english files....looks like stuff from keldath :)


    Thanks for the great guide Kael...and putting up with the insanity ;)
     
  10. TAfirehawk

    TAfirehawk WoC Team Manager

    Joined:
    Aug 25, 2006
    Messages:
    2,326
    Location:
    Florida
    Any known issues with new wonder movies? The new movies we put in the VISA mod for the new wonders like Hippodrome and Roman Roads are not working...not sure what we have messed up but for now will just leave them out of the FPK file.
     
  11. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    You are probably right. I havent tried movies and I notice that Firaxis left the movies out of their fpk files.
     
  12. lord_graywolfe

    lord_graywolfe Wolfman

    Joined:
    Jun 7, 2005
    Messages:
    717
    Location:
    Washington
    hi i just tried this and it worked great got a 900+ meg art folder all into the fpk, inclucing movies and it loads so much faster now. one thing i have noticed though is that now if i try to enter world builder i get a CTD. think that has anything to do with all the art files being in the fpk?
     
  13. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    I havent seen any issues that have to do with going into the worldbuilder from paking files. Most of the time CTD's entering the worldbuilder are caused by the game attempting to display something that doesn't exist and you can't see outside of the worldbuilder (since the wolrdbuilder displays everything).

    Most of the time it means you have a unit or building that doesn't have an associated button (or the button is associated incorrectly). An AI city is building it so you never see it during normal play, until you enter the worldbuilder. Once you try to enter the worldbuilder the game tries to fill every city bar with what that city is building, is unable to add the picture for that unit or building and boom, CTD.
     
  14. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,603
    Gender:
    Male
    Location:
    MN
    OK i did everything as you said and heres the results??

    All the art files are PINK??
     
  15. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    Most likely you either selected the art directory as the root instead of its parent, you didnt save the file paths or you didnt put the fpk file in the right location.

    Recheck your steps, the process is good Im guessing something got missed.
     
  16. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,603
    Gender:
    Male
    Location:
    MN
    OK i think i have it to the saved spot ok, but then it asks what to be saved as?
    and gives you a 484kb file if saved?? I take the Pak0.FPK file 418,399 or so and place it in my assets area folder and i still get pink icons and blank art files??
    I put it in the next folder area where the ART file used to be?
     
  17. FK2006

    FK2006 Warlord

    Joined:
    Mar 9, 2006
    Messages:
    168
    Hello
    Packbuild doesn'st work with bts? i did like 4 warlords (always worked) but here the units are red or none.....
     
  18. FK2006

    FK2006 Warlord

    Joined:
    Mar 9, 2006
    Messages:
    168
    sorry for post 90 my mistakes it works again
     
  19. deanej

    deanej Deity

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    Does pakbuild work with audio files? I tried to put my sound files into a pak file and I get an error. I need to include both my art and sound into pak files to keep file size down for my mod (I plan to include scenarios on it and they will need to be their own mods, which means that the final mod will be about 3GB in size when done if the art/sound can't be put into customassets.). Railroads will use audio in pak files, so I can't imagine why civ won't.
     
  20. Kael

    Kael Deity

    Joined:
    May 6, 2002
    Messages:
    17,401
    Location:
    Ohio
    Nope, it also doesn't work with movies.
     

Share This Page