For the purposes of this wiki a lot of images have had to be extracted from the game's data files. Not all images are needed, of course, but every once in a while some need for new ones arise. Here's a little tutorial on how to do that.
First, I will assume you are using Windows. That should be a reasonable assumption, as the game is only out for Windows for now. Users of other operating systems will have to adapt these instructions to their own needs.
Let's begin by downloading some essential programs. Download and install the following:
- Dragon UnPACKer -- for unpacking the game's data files
- DDS Unpacker -- for unpacking the compressed DDS image files into PNGs
- Some good image editor. Photoshop would be great, but there are even online image editors.
Then, find out the folder into which Beyond Earth has been installed. Probably the easiest way to do that is this:
- Open up your Steam library
- Find Sid Meier's Civilization: Beyond Earth from the list
- Right click on it, then select Properties
- Select the Local Files tab, then click on the Browse Local Files... button
That opens a Windows Explorer screen to your Beyond Earth installation folder. Copy the folder name to, say, Notepad, to be used later.
Case 1: No DDS-unpacking needed; cropping required
Let's say you wanted to find the Capital city icon, . First, open up Dragon UnPACKer. There, select Open from the File menu and navigate to your Beyond Earth installation folder. There, navigate further into the Resource/dx11 directory. This should display a bunch of .fpk files -- .fpk apparently stands for Firaxis Package. Open the largest one, UITextures.fpk. You should end up with a screen like this:
Now, there's a lot of files, but I'll let you in on a little secret: many of the small icons like the one we're after are saved into a file called fonticons.dds. Find that one from the list and click it. Notice how a preview image with many small icons appears and looks sensible? Good. Now right click on fonticons.dds and select Extract file to... > PNG - Portable Network Graphics. It asks you where you want to extract it, choose any location you want.
We're almost done! Now we only need to crop the required icon and save it. Open the file in your image editor of choice. You could do the cropping by free hand, but the icons are a bit irregular and packed really close together, so this is not preferred. Instead, you should look at the cursor coordinates and the crop area width and height. In Photoshop it would look like this, you should be able to adapt this to your editor:
Note that the correct coordinates can be found from other game files, in this case from the assets/UI/FontIcons/FontIcons.xml file under your Beyond Earth installation directory. In that file there's this line:
<Icon Name="CAPITAL" Start="88,44" Size="22,22" Advance="22" Baseline="0,4" />
That tells you the coordinates of the upper left hand corner start pixel (x=88, y=44) and the width and height of the icon (22 by 22 pixels).
After successfully cropping the file just save it and you're done!
(Update: see my comment for instructions on how to easily crop all the images at once with Photoshop!)
Case 2: DDS-unpacking needed
Not all files can be extracted with using the Dragon UnPACKer's Extract file to... > PNG - Portable Network Graphics feature. These are the so-called compressed DDS files which actually consist of two separate files: something.dds and something-index.dds. Dragon UnPACKer cannot deal with them alone, so that's why we require DDS Unpacker too.
Suppose you wanted to find this picture of Kavitha Thakur:
The images are usually named in a pretty intuitive way, so the easiest way to find the correct files would be to sort the list of files by name and look for anything that begins with "leader". Sure enough, there's leaderportraits.dds and leaderportraits-index.dds. Select the both, then right-click, then select Extract file to... > Without Convertion and choose some location.
Now, open up the DDS Unpacker program. It's a very simple program: you select the input and output folders, and then click Unpack, at which point the two .dds files are converted into one .png file into the folder you selected. The application looks like this:
Good image editors will have a Trim command somewhere so that you can just crudely crop each one of the images and then trim the empty pixels from around it. If you are more interested in the image file structure, then you need to look into the assets/Gameplay/XML/GameInfo/CivBEIconTextureAtlases.xml file, where it describes that the IconSize of the leader atlas file is 256 pixels and that there are 8 IconsPerRow. The different images are then referred to in assets/Gameplay/XML/Leaders/*.xml files. For example, Rejinaldo's file says his image is at <PortraitIndex>2</PortraitIndex>, i.e. it's the third image (since the image numbering starts from zero).
Conclusion and final tips
In this post I've shown you how to find and extract images from the data files of Beyond Earth. It's pretty complicated at first but not that difficult after all. The most difficult part may be to figure out which file holds the images that you are interested in. You may want to install some application that can find text from inside many XML files at once. Personally, I like NoteTab Pro and have been using it for years, but I'm sure NotePad++ or any decent Notepad replacement application would do.
Searching the XML files for, say, "Fielding" would bring up a bunch of them, but when you patiently browse through them you eventually come across CivBELeader_Fielding.xml and see that it refers to something called LEADER_ATLAS. Then searching for "LEADER_ATLAS" would bring up the CivBEIconTextureAtlases.xml file which refers to .dds files, at which point you would be very close to actually being able to extract Suzanne Fielding's image.