• Civilization 7 has been announced. For more info please check the forum here .

Tutorial - custom Earth map in Civilization for Windows

Lord_Hill

Prince
Joined
May 10, 2004
Messages
375
Location
London, UK
I thought I'd document how I used @honza.havlicek 's Civilization for Windows mod tools to create a custom Earth map. I wanted to play Earth map on Windows with the changes to the east Asia/Japan region that are present in the PC-98 version. In that version, Japan has been linked directly to the mainland with a few small tweaks to the water and surrounding land as well. This is trivial to pull off in the DOS version thanks to JCivEd's PIC editing capability, and yes, I could easily make those changes in the DOS version, save on the first turn and convert that to a Windows save, but where's the fun in that? Windows players should also be able to click 'Play on EARTH' like first class Civ citizens! :D All this info ultimately comes from the readme that comes with Honza's tools, I'm just mostly making it pretty and adding pictures.
1675711633120.png
1675709391732.png

I want this... To look like this (minus Tokyo)

What you need
A copy of Civilization for Windows (not CivNet, this guide is only applicable to CivWin)
Some graphics editing software (I use GIMP, which is freeware)
Honza's Civilization for Windows mod tools - download them from this thread https://forums.civfanatics.com/threads/dos-tileset-for-civwin.268133/
specifically the attachment named CivWin_File_Format_demonstrator_source.zip in the first post.

What's nice to have
A copy of Civilization for DOS and the JCivEd editor by @darkpanda

1. Extracting the Earth map
Civilization packs all of its resources into five container files named CIVDATA0.RSC through to CIVDATA4.RSC. To extract individual files from an RSC file for editing, we need to use the RSC_Extract tool from Honza's toolset. Unzip the tools then browse to the 'release' subfolder. There are a number of ways to use the tool to extract data (you can drag an RSC file onto the EXE for example), but I recommend you do it from the command line for reasons which will soon become apparent.

Drop a copy of CIVDATA0.RSC into the 'release' folder then fire up a command line instance with 'release' as the working directory (clicking the address bar in windows file explorer and typing in 'cmd' there is a neat way to do that fast), now type in the following
RSC_Extract CIVDATA0.RSC
And hit Enter. It really is that simple. Every file inside CIVDATA0.RSC will now be dumped into the 'release' folder. But also, some interesting information has shown up on the command line.
1675713043683.png

Rather helpfully, the file we're interested in is EARTH.GIF which also happens to be the last file that was processed so we don't need to scroll back to look for it. There's some info here we need to make a note of which will help us when it's time to put our modified file back into the RSC file. The 'section' (labelled Sec) containing EARTH.GIF is 4 in decimal and the Id of EARTH.GIF is 0x0089 in hex (137 in decimal).

As of writing it is not possible to extract individual files, so go ahead and delete all of the other files that have been extracted except for EARTH.GIF.

2. Editing the Earth map
As you probably have guessed, CivWin's GIF format isn't the GIF that's used for animated videos on the internet, it's another custom Microprose format (an 'lzw compressed 8 bit paletted image' according to Honza). We need to use GIF_convertor to convert this custom format to something we can open in an image editor. Get your command line back up and type in the following
GIF_convertor EARTH.GIF EARTH.TGA
This will convert the GIF to an 8 bit paletted TGA file, which lots of image editors can handle, including my preferred editor, GIMP. Open up the image for editing and it'll probably look something like this
1675713829406.png

Now go ahead and make your changes. This is where having JCivEd and a copy of DOS Civ is handy. No editor can currently edit EARTH.GIF directly as a map, but the format is identical to MAP.PIC in the DOS version which JCivEd can modify as a map. So you can edit the map in JCivEd, export as a PIC file then open that PIC file in JCivEd to see what changes need to be made. In my case, this isn't really necessary as I just needed to tweak a few pixels in the Japan region to get what I wanted.

Be careful when you save because you must retain the original file format without any compression or 'under the hood' changes. To achieve this in GIMP, select 'Export As' then choose the TGA file from the file browser. When the 'export as TGA' popup appears you MUST disable RLE compression. CivWin expects an uncompressed TGA and will break if you try and use a compressed one.

3. Getting it back into the game
We now need to run back all of the steps above in reverse to get our modified image into the game. Backup all the files (RSC, GIF and TGA) before attempting this. First we need to use TGA2GIF to convert our TGA back into the CivWin GIF format. On the command line type in
TGA2GIF EARTH.TGA EARTH.GIF
and press Enter.

Next is the tricky bit, we need to get the GIF back into CIVDATA0.RSC in the right place so we don't break anything. We use the RSC_replace tool to achieve this, unlike all the other tools this takes 4 arguments
RSC_replace [RSC file name] [Section in decimal] [file id in decimal] [resource file name]
Now you see why we noted down those two random hex values in part 1, we need them to repack the RSC file correctly. We noted that after converting from hex to decimal, the Section is 4 and the file ID is 137. So type this into the command line
RSC_replace CIVDATA0.RSC 4 137 EARTH.GIF
Hit Enter and hopefully you see something like this. I've scrolled up to the bit where the replacing is logged.
1675715142110.png


If there are no errors, we're all set! Back up your original CIVDATA0.RSC and overwrite it with the version we just created. Now lets start up a new Earth map and see how we get on.
1675715504718.png

Hooray! Yes I edited the save to reveal the map, I needed to show it off somehow!
 
Last edited:
Now go ahead and make your changes. This is where having JCivEd and a copy of DOS Civ is handy. No editor can currently edit EARTH.GIF directly as a map, but the format is identical to MAP.PIC in the DOS version which JCivEd can modify as a map. So you can edit the map in JCivEd, export as a PIC file then open that PIC file in JCivEd to see what changes need to be made. In my case, this isn't really necessary as I just needed to tweak a few pixels in the Japan region to get what I wanted.

Be careful when you save because you must retain the original file format without any compression or 'under the hood' changes. To achieve this in GIMP, select 'Export As' then choose the TGA file from the file browser. When the 'export as TGA' popup appears you MUST disable RLE compression. CivWin expects an uncompressed TGA and will break if you try and use a compressed one.

Excellent tutorial !

For the JCivEd part specifically: you say that EARTH.GIF has the same "format" as MAP.PIC : why don't you edit it directly with JCivEd then, using "Map -> Import Map from file" ?
Also, instead of exporting it as a PIC file, why not export it directly to MAP.PIC format using "Map -> Export Map to Earth format" ?

I confess I don't remember if MAP.PIC is RLE compressed or not, and it's too late to look it up.... Û_Û'
 
Thanks! :) there isn't alot of windows stuff out there, so thought it'd be nice to share how I've been making these things. When I say 'same format', I just mean the map picture itself and the colours it uses to denote the different tiles are the same. I believe the compression is different (although this game has basically been my introduction to modding so I'm not 100% sure about anything really :D ).
 
Yeah, there's a unique port for the PC-9801 series of computers which us Japanese language only. You can see a few posts about my attempts to play it in the 'civ 1 ports comparison' thread
 
Top Bottom