How to modify GameFonts.tga for FREE

Eusebius

Warlord
Joined
Feb 11, 2006
Messages
242
Location
Hopewell, NJ, USA
Tutorial: Editing GameFonts.tga for Free


BEFORE YOU START: Get the image(s) you want to add to the file.
  • Because I am really cheap, I usually hunt Google Images for what I want and then use IrfanView to resize and edit it. I then paste it into GIMP to save as a DDS file. (I am mystified by GIMP’s user interface and use it for as little as possible.)
  1. Get a copy of DTXBmp; install it.
  2. Go to the GameFonts.tga file you want to edit in File Manager. With the right mouse button, select "Open With" DTXBmp
  3. You should get a screen that looks like this… DTXBmpScreenShot2.jpg
  4. Click on the third icon from the left on the bottom; floating help identifies it as "send to editor".
  5. The Windows Paint application will pop up with the main icon screen, using filename ‘norm.bmp’. At this point, I like to maximize that window and View->Zoom->Custom->200%
  6. Pull up the image you want to add. Resize it to be 21 pixels wide by 20 pixels high. Hit Edit->Copy to put it on the clipboard. (Again, I like IrfanView for this purpose.)
  7. Go over the Paint application and hit Edit->Paste. Then drag it to the next available empty spot of the type you want to use. In my case, I put it after the religion icons. If you are adding a resource, put it after the resource icons. You should be able to enclose your new bitmap within the purple gridlines so that all the lines still show. Click somewhere else in Paint to leave your image there permanently.
  8. Put the crosshair cursor right at the point where you pasted your picture. The lower right corner of Paint will show the coordinates. Write these down somewhere.
  9. Notice that all the existing icons in the file have a single green pixel after each icon. I have no idea what this is for, but according to rumor it might be important. So, go to one of the purple gridlines that has it, grab a 3x20 section containing the line, Edit->Copy and then Edit->Paste as once for each icon. You should be able to do this by eye. (Zoom helps!)
  10. Hit File->Save. (I hope you are still with me because all this has been the EASY part!)
  11. Go back to DTXBmp and hit the fourth icon from the left on bottom. "Refresh From Edit". The colored image in the center should now reflect your changes. [DO NOT CLOSE THE PAINT APP YET—you might still want it.]
  12. Now, go over to the right side where there is a black square with white icons on it. This is the infamous alpha channel part of your tga file. Hit the second icon from the left under it. "Send to Editor".
    [*]Another
    Paint application will pop up with the filename ‘trans.bmp’. I maximize and zoom here.
  13. Now, take a look over the white icons and pick the one that is closest to your new image. This will usually be one of the big round ones or the square one for Confucianism. Select a 21x20 area around it. Hit Edit->Copy.
  14. Now hit Edit->Paste. Move the pasted section to the coordinates that you wrote down in step #8. Click somewhere else in Paint to leave your image there permanently.
  15. Hit File->Save.
  16. Go back to DTXBmp. Under the black rectangle, hit the third icon from the left, "Refresh after Edit". Now both the colored image and the alpha channel should reflect your changes.
  17. In DTXBmp, hit File->Save.
  18. You are done. Close all the windows.
  19. Exclaim "What a hassle that was!"
  20. Reach over and smack your friend who is a graphics expert and is laughing hysterically at you by now. Remind him that you did this for FREE!

The same process will work for GameFonts_75.tga, except that the size of each icon is 16x16 and the size of the bar with the green pixel is 3x16. I have never succeeded in converting GameFonts.tga by resizing it; I have always had to do the whole thing twice.

I played around with trying to generate the alpha channel by taking the original image and converting it to black & white and then taking the negative. All of these efforts resulted in abyssmal failure. Cutting and pasting from the real alpha channel is all I could get to work.


Free Windows Applications Mentioned in this TutorialCheers,
Eusebius
 
ohcrapitsnico said:
My tga file isn't showing up.

That was a bit cryptic; not clear what you mean. Naturally, you have to copy the files from the assets directory to your mod directory, just as you do with XML and Python. They are under 'res'.

E.
 
I right clicked the font file that I wanted to edit. Actually I want to copy a religion icon from another file into my rise of persia mod for warlords.
Also do I have to edit both the game font and game font 75 files?


EDIT: Sorry I realized what I did wrong.
Actually it appears right but the send to editor button doesn''t pull up paint.
 
ohcrapitsnico said:
I right clicked the font file that I wanted to edit. Actually I want to copy a religion icon from another file into my rise of persia mod for warlords.
Also do I have to edit both the game font and game font 75 files?


EDIT: Sorry I realized what I did wrong.
Actually it appears right but the send to editor button doesn''t pull up paint.

Yeah, you do need to edit both. DTXBmp does have the capability to change the editing program. Make sure you have the editor set to be Paint. Otherwise, it should work on a standard Windows system. Keep trying.

E.
 
It works!!!!!!!!!:dance:
Finally an easy way to edit it. Though for the alpha channel thing I can't remember if you mentioned this or not but when copying over a new white thingie you should use one that is about the same size/shape as the one you are adding. I'm adding a circle religious icon so I'm using the yin/ yang symbol since the only part of your symbol that appears in game is what fits inside the alpha channel symbol.:crazyeye: :crazyeye: :crazyeye:

This is an awesome tutorial and thanks for all the help:thanx: . :goodjob:
 
This is really very very usefull. Thanks.
 
Very useful Eusebius! Just a minor question here, how does the game know which icon to use for which? will it know that for example I want the icon next to the thunderbolt to be a resource?
 
Prestidigitator said:
Very useful Eusebius! Just a minor question here, how does the game know which icon to use for which? will it know that for example I want the icon next to the thunderbolt to be a resource?

For religions, it is actually the order they appear in the XML file. So the first religion (Judaism) will use the first pair of religion icons. I assume it works the same way for resources and the other icons, but I haven't actually checked.

Eusebius
 
Nice work
Only one problem:

I got no button for the town which founded the religion, but it appears together with the normal religion button for a city with the religion.

Seems to be a problem with that green pixel on the pink lines, what's to be done with it?

edit:
works now, but religions-buttons are mixed up now. The order of the pictures and the religions in the xml-file is the same
 
I just had an interesting case. One of my alpha channel icons was one pixel too many to the left which caused the game to consider the two icons to be a single icon (of double size). This caused later icons to be "off" by one, so when I founded Zoroastrianism I got the icon for Tenrikyo instead.

I fixed it by moving the alpha icon to its proper position. It is possible someone else will run into this, so I thought I would post.

Cheers,
Eusebius
 
I have a GameFont file with an alpha channel that's all screwed up:



As you can see, instead of white on black, it's black on white. And it looks like gibberish. Can anyone advise? I've zipped up my GameFonts.tga and GameFont75.tga to look at. Oddly, the 75 file's alpha channel is still black on white, but other than that it looks fine.

http://forums.civfanatics.com/uploads/11460/fonts.rar

Note: I did not make these files - it's for someone else's mod.
 
I have a GameFont file with an alpha channel that's all screwed up:

As you can see, instead of white on black, it's black on white. And it looks like gibberish. Can anyone advise? I've zipped up my GameFonts.tga and GameFont75.tga to look at. Oddly, the 75 file's alpha channel is still black on white, but other than that it looks fine.

I have run into this as well. I was never able to successfully edit the file with that appearance using the techniques described in this thread. I gave up in frustration. If you find a solution, please post it!

:confused: Eusebius
 
That's happened to me too, when I save the tga with Jasc PSP, which is my usual graphics editor. I don't know how you really fix it properly, but what I did was use DXTBMP and export the image and the alpha channel, edit them separately, save them, and reload them to the tga in DXTBMP ... probably not the right way but it works well enough.
 
How would I go about creating a fresh alpha channel? Like, how would I delete the existing alpha channel and use the norm.bmp as a basis for the new alpha channel?
 
How would I go about creating a fresh alpha channel? Like, how would I delete the existing alpha channel and use the norm.bmp as a basis for the new alpha channel?

I don't know, I didn't use the norm as the basis for a new alpha channel. I grabbed the alpha channels from the base game's gamefonts files, manually edited them, and imported them back into the modded gamefonts ...

I don't think you can really use the norm (or the black-on-white alpha channel produced by saving in PSP) as the basis for an alpha channel because you're just getting a greyscale copy (whether in negative or otherwise) of the original. In the alpha channels for the base game, it's not a negative image, it's a different image, all the symbols have only a white silhouette outline for transparency. When you use negative greyscales you can't get silhouettes, you just get a negative copy of the icon. I think it more or less has to be done manually.

I suppose you might be able to use a negative greyscale as the starting point, but it's probably alot less work just to use the alpha channels from the base game and modify them a bit.

Give me a couple days, I think I could fix those gamefonts you posted.
 
Zulu ... here they are ... I haven't tested them ingame (sometimes if the alpha is a little off the icons will show up wrong, shifted 1 to the left or right) but the transparency looks good.
 

Attachments

  • gamefonts.ZIP
    195.2 KB · Views: 308
Top Bottom