AutoPak-- a tool to automate running PakBuild

Discussion in 'Civ4 - Utility Programs' started by TC01, Aug 17, 2015.

  1. TC01

    TC01 Deity

    Jun 28, 2009
    Irregularly Online
    autopak v0.1

    I was looking for a way to automate parts of "building" Final Frontier Plus, and I realized one of the clumsier parts of the workflow had to be compiling art assets into a FPK file.

    The traditional way to do this is to use PakBuild, a Firaxis tool. PakBuild can be downloaded from this stickied thread, and a tutorial explaining how to use it to generate FPKs (rather than just unpack them) can be found here.

    The advantages of PakBuild are that the FPK'd files load much faster in the Civ 4 engine. The disadvantage is that it's kind of a pain to use, and as you might be able to see from the somewhat... clumsy workflow involving the GUI, it's not very automatable.

    Fortunately though, PakBuild supports command line options that let you run it without using the GUI! Of course, there's still the matter of knowing what command line options to run, so I decided to throw together a script that downloaded PakBuild from CFC and ran it and set the right command line options.

    I opted to use VBScript, a scripting language with which I am not really familiar at all but I know is available on all Windows systems out of the box, instead of something like Python, for maximum ease-of-use. As it happens, VBScript isn't too hard to pick up. The script is pretty simple, though, so at this stage it'd be really easy to port to another language. If this project of writing pakbuild automation gets bigger, I might move to a .NET language or something else that compiles natively on Windows (again, for ease of use).


    You can download AutoPak here from CFC.


    Make a new directory where you'll build your art assets, let's call it "civ4mod-art".

    Copy the Art/ folder for your mod into civ4mod-art, and then copy autopak.vbs into civ4mod-art. Double-click to run it.

    If everything works, PakBuild should be auto-downloaded and invoked, and a AutoPak0.fpk will appear!

    If you run autopak.vbs on the command line as "autopak.vbs name", "name" will replace the default root of AutoPak. So you could run "autopak.vbs FFPak" to get FFPak0.fpk (the default Final Frontier Plus name).

    Possibly, in the future, I'll add support to automatically create the civ4mod-art working directory, so you don't need to create a clean, empty directory for autopak and Art/.

    An "example" can be found here, where I've included autopak in the art repository for Final Frontier Plus.


    This uses, but does not bundle, Firaxis's PakBuild tool.

    You're free to include this in your own mods, to make modifications, etc. You may not hold me liable (or Firaxis) if this does any damage to you or your computer.

Share This Page