EMPEROR OF THE FADING SUNS

NOVA

The New Start

Last updated: August 10, 1999

Hacking the Graphics and Text Files

A few people have asked me how I made the changes to graphics and text which can be seen in my Escape From Earth scenario. Here are the answers I've given them.

NOTE: Hacking these files is difficult and time-consuming. If you're creating your own EFS scenario, I recommend you concentrate on making the scenario interesting and balanced, and don't waste a lot of time fiddling with the graphics. If you choose to ignore this warning, you're on your own. Please do not ask me for any help!

 

How did you get the version number in Nova 2.21 to appear?

This was fairly simple. It was just a matter of editing file Starmap3.pcx in the PCX folder. As I didn't have a program that would edit a PCX file, I used MS Photo Editor to convert the file to BMP format, MS Paint to edit the BMP file, and then MS Photo Editor again to convert it back to PCX. Both of these programs come as standard with Win95.

 

How did you change the house images?

The house banners, portraits, unit icons and various other items of graphics are stored in the BIN folder. The house banners are in House1.bin...House5.bin.

 

What did you use to edit the BIN files?

The BIN files are not stored in any standard format (as far as I know), so I had to edit them with a hex editor, which is very awkward. I eventually found a way of using MS Paint as part of the process, but it was still difficult. Each BIN file is a 2, 3 or 4 dimensional array of pixels, with no header, and each pixel is stored as 1 byte of data. For example, House1.bin is a 100x100 pixel array, so the file is exactly 10,000 bytes long.

Here are the dimensions of some other BIN files:

To graphically view the images in BIN files, I used a hex editor called AXE. This is a freeware program that you can download from http://www.kahei.com. To view images, load the file into AXE, set the Bytes Per Row to the image width (e.g. 250 for Portrait.bin) and switch to Graphical mode by clicking on the blue G near the bottom left corner of the screen. Unfortunately, the colours won't look right, and you can't edit the file in this mode, but it's a start.

 

Is there any way to create BIN files using a graphics program?

To create my Sect banners in Escape, I used the following steps:

  1. Created the banner as a 100x100 pixel image in MS Paint (using the Image|Attributes option to set the image size).
  2. Flipped the image vertically (using Image|Flip/Rotate).
  3. Saved it as file type "256 Color Bitmap".
  4. Used a hex editor to delete the file header (the first 1078 bytes of the file).
  5. Saved it as House1.bin (or whatever).

Important points to note:

1. This may not work for other sized bin files. The number of bytes in the header may be different. And I noticed that with portraits (250x200) the BMP file had some extra bytes inserted at the end (start?) of each row. If you want to convert between BIN and BMP files of any other size, you'll have to examine them with AXE to see exactly what their structure is.

2. To convert a BIN file to a BMP file, you can use the reverse of the above procedure, inserting the first 1078 bytes from another BMP file. (Obviously, that BMP file must also be 100x100, 256 colour.)

3. The BIN files and BMP files use different colour coding, so your colours will all come out different. To get the right colours, edit the BIN file with WinVi32 and use the Replace feature to change the colours to the ones you want.

4. Changing the house banners won't change the mini-banners that are displayed in the House and Diplomacy screens. These banners are fixed in the corresponding PCX files (House.pcx, Diploma.pcx, Diploleg.pcx, Diplochu.pcx), so you need to edit those files, which you can do in MS Photo Editor.

5. In general, the EFS program reads the BIN and PCX files from disk each time it needs them (unlike the DAT and RES files, which it only reads when you start running the program). So, if you want to experiment with changing these files, you don't need to quit and re-run the EFS program to see the effects of your changes. You can just exit the appropriate screen and re-enter it. However, there are exceptions: the banners in the bottom left corner of the stack screen stay fixed until you re-run the program.

 

Can you explain the colour mapping of BIN files?

Any graphics format has a system for mapping data values to colours. I don't know whether the system used for BIN files is the same as that of any other graphics format, but it's certainly different from BMP format.

The following chart illustrates the colour mapping for BIN files. It shows you the 256 different colours you can get from inserting the values 00-FF (hex) in a BIN file. They're in numerical order, so you can see that 00 gives you dark purple, 01 gives you dark red, and so on.

The standard colours for EFS are:

 

How did you change the text strings?

To change various bits of text in the game, I edited files Strings.res, Efs.res, Compstr.res, Diplo.res and Diplostr.res, using a hex editor. In these files, each string is preceded by a 4-byte header:

For editing the RES files, it's easier to use WinVi32 (from http://www.snafu.de/~ramo/WinViEn.htm) rather than AXE, as AXE doesn't have an easy way to insert additional bytes. Using WinVi32, go into hex mode and edit the text in the ASCII display (the right hand side of the screen). But remember that, if you change the length of a text string, you must also change the byte which specifies the length. You have to do this in the hex display (the central portion of the screen), and you need to enter the value in hexadecimal.

Example. Open Strings.res in WinVi32. Look down the text on the right-hand side of the screen and find the word "Orthodox". It's about 30 rows down. Let's change it to "Brother Battle". Drag the cursor across the text "Orthodox" to highlight it, and type in the text "Brother Battle". (Alternatively, you can click on the text and use the Delete key to delete the old text.) Now, highlight the text again, and you'll see that the corresponding hex values are also highlighted in the central portion of the screen. Just before the highlighted values is the value "00" (this byte is always "00"). And just before that is the value "08". This is the length of the text string, as "Orthodox" is 8 characters long. However, "Brother Battle" is 14 characters long, so we have to change "08" to "0e". (0e is the hexadecimal equivalent of 14.) So highlight the value "08" and type in "0e" over the top of it. Then save the file. Now, when you start a new EFS game, you'll find that all references to "Orthodox" have been changed to "Brother Battle".

 

What do you mean by "hexadecimal" ("hex")?

The hexadecimal number system is also called "base 16", as opposed to our normal decimal number system which is "base 10". What this means is that there are 16 different digits (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) instead of the usual 10 (0,1,2,3,4,5,6,7,8,9). So the equivalent numbers are:

Decimal

Hex

Decimal

Hex

Decimal

Hex

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F

32


159
160
161


254
255

20


9F
A0
A1


FE
FF

 

Could you list all the files you changed in creating Escape?

Main EFS directory:

RAND directory:

BIN directory:

S directory:

PCX directory:

 DAT directory:

Return to Nova Home Page