Advertisement
Civilization Fanatics' Center

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Modding Tutorials & Reference

Notices

Civ4 - Modding Tutorials & Reference Post tutorials, guides, and documentations related to Civ4 modding here.

Reply
 
Thread Tools
Old Aug 06, 2006, 07:33 PM   #1
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Science How to modify GameFonts.tga for FREE

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… Click image for larger version

Name:	DTXBmpScreenShot2.jpg
Views:	1059
Size:	48.3 KB
ID:	134950
  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".
  13. Another Paint application will pop up with the filename ‘trans.bmp’. I maximize and zoom here.
  14. 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.
  15. 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.
  16. Hit File->Save.
  17. 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.
  18. In DTXBmp, hit File->Save.
  19. You are done. Close all the windows.
  20. Exclaim "What a hassle that was!"
  21. 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
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.

Last edited by Eusebius; Nov 23, 2006 at 09:13 PM.
Eusebius is offline   Reply With Quote
Old Aug 06, 2006, 09:48 PM   #2
Gunner
Emperor
 
Gunner's Avatar
 
Join Date: Aug 2004
Location: Goochland, VA
Posts: 1,389
Thanks for this Eusebius. I finally got a gamefont file to work
__________________
"Serenity now, insanity later." - Seinfeld

Development forum for Rhye's and Fall of Civilization, go check it out!: http://forums.civfanatics.com/forumdisplay.php?f=204
Gunner is offline   Reply With Quote
Old Aug 15, 2006, 11:21 AM   #3
ohcrapitsnico
Deity
 
Join Date: Jan 2006
Posts: 2,267
My tga file isn't showing up.
ohcrapitsnico is offline   Reply With Quote
Old Aug 15, 2006, 11:29 AM   #4
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Quote:
Originally Posted by ohcrapitsnico
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.
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.
Eusebius is offline   Reply With Quote
Old Aug 15, 2006, 11:33 AM   #5
ohcrapitsnico
Deity
 
Join Date: Jan 2006
Posts: 2,267
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 is offline   Reply With Quote
Old Aug 15, 2006, 11:44 AM   #6
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Quote:
Originally Posted by ohcrapitsnico
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.
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.
Eusebius is offline   Reply With Quote
Old Aug 15, 2006, 02:44 PM   #7
ohcrapitsnico
Deity
 
Join Date: Jan 2006
Posts: 2,267
It works!!!!!!!!!
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.

This is an awesome tutorial and thanks for all the help .
ohcrapitsnico is offline   Reply With Quote
Old Sep 23, 2006, 03:51 AM   #8
Lord Olleus
Deity
 
Lord Olleus's Avatar
 
Join Date: Oct 2005
Location: England
Posts: 5,102
This is really very very usefull. Thanks.
__________________
Most zealously I seek for erudition. Much do I know, but to know all is my ambition.
-Faust
Lord Olleus is offline   Reply With Quote
Old Sep 24, 2006, 06:30 PM   #9
Splinter13
The Learner
 
Splinter13's Avatar
 
Join Date: Aug 2006
Location: Canada
Posts: 204
Ahh, thank you! i've been wondering how to edit these.
Splinter13 is offline   Reply With Quote
Old Oct 10, 2006, 06:25 AM   #10
Prestidigitator
Prince
 
Join Date: Mar 2006
Location: Is this a trick question?
Posts: 587
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 is offline   Reply With Quote
Old Oct 10, 2006, 02:28 PM   #11
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Quote:
Originally Posted by Prestidigitator
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
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.
Eusebius is offline   Reply With Quote
Old Nov 01, 2006, 07:47 AM   #12
az09
Chieftain
 
Join Date: Nov 2006
Posts: 5
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

Last edited by az09; Nov 01, 2006 at 10:58 AM.
az09 is offline   Reply With Quote
Old Dec 13, 2006, 02:40 PM   #13
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Alpha Channel merged icons

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
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.
Eusebius is offline   Reply With Quote
Old Jan 23, 2008, 09:02 AM   #14
zulu9812
The Newbie Nightmare
 
zulu9812's Avatar
 
Join Date: Jan 2002
Location: Athens of the North
Posts: 6,378
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.
zulu9812 is offline   Reply With Quote
Old Jan 23, 2008, 11:43 AM   #15
Eusebius
Warlord
 
Eusebius's Avatar
 
Join Date: Feb 2006
Location: Hopewell, NJ, USA
Posts: 242
Quote:
Originally Posted by zulu9812 View Post
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!

Eusebius
__________________
BroodWar Mod for WARLORDS - All the StarCraft races + one more!
World Religions - REVIVAL FOR WARLORDS. 18 real-world customized religions, real conversion.
Eusebius Live Animals Component FOR WARLORDS.. Sheep, cows, etc. get up and walk around, spawn, settle down go extinct.
Eusebius is offline   Reply With Quote
Old Jan 24, 2008, 01:00 AM   #16
frekk
Scourge of St. Lawrence
 
frekk's Avatar
 
Join Date: Jun 2003
Location: Kingston, Ontario
Posts: 3,151
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.
frekk is offline   Reply With Quote
Old Jan 24, 2008, 02:35 AM   #17
zulu9812
The Newbie Nightmare
 
zulu9812's Avatar
 
Join Date: Jan 2002
Location: Athens of the North
Posts: 6,378
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?
zulu9812 is offline   Reply With Quote
Old Jan 24, 2008, 07:27 PM   #18
frekk
Scourge of St. Lawrence
 
frekk's Avatar
 
Join Date: Jun 2003
Location: Kingston, Ontario
Posts: 3,151
Quote:
Originally Posted by zulu9812 View Post
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.

Last edited by frekk; Jan 24, 2008 at 07:31 PM.
frekk is offline   Reply With Quote
Old Jan 24, 2008, 09:31 PM   #19
frekk
Scourge of St. Lawrence
 
frekk's Avatar
 
Join Date: Jun 2003
Location: Kingston, Ontario
Posts: 3,151
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.
Attached Files
File Type: zip gamefonts.ZIP (195.2 KB, 88 views)
frekk is offline   Reply With Quote
Old Feb 15, 2008, 12:01 PM   #20
Ekmek
on steam: ekmek_e
 
Ekmek's Avatar
 
Join Date: Aug 2002
Location: San Diego, California
Posts: 5,889
The alpha channel is the example is all black with white icons, but when i open the BTS one it is all white with black icons. why is it showing up different?
Ekmek is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Modding Tutorials & Reference > [TUTORIAL] How to modify GameFonts.tga for FREE

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Advertisement

All times are GMT -6. The time now is 09:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR