Help with flags and graphics in general

GustavBjorklund

Chieftain
Joined
Apr 9, 2006
Messages
93
Location
Borås, Sweden
Hello ya'll. I'm working on a small mod of my own, and I am clueless as to how you get a three-or-more-coloured flag in the game. I also have some other questions. I have followed Kael's excellent tutorials (I'm a fan of Colbert too :D) on how to create civilizations and leaders, and have searched the forums, but nowhere does it say clearly how to add, say, the british flag to the game.

So my main question; How can I get a three-or-more-coloured flag to work with Civ4?

My other questions are related to Photoshop and the DDS plugin from Nvidia. Another flag I am trying to create is this flag. As you can see I need an alpha layer, but when I try to export to .DDS Photoshop gives me the following message:
alphalayerproblem.jpg


I have ticked the alpha channel box, in the window that pops up when I try to save as.

Thanks in advance!
 
One civilization I'll be including in my mod is Prussia. The flag has a bunch of different colours (one of the coolest flags of the time IMO). 128x128 with no alpha layer:
Prussia_flag.jpg


What that looks like in-game:
prussianempire3.jpg


My ArtDefine code:
Code:
<Path>Art/Interface/TeamColor/Prussia_flag.dds</Path>
<bWhiteFlag>1</bWhiteFlag>



On a side note, is it possible to mod the flag standard? The two pieces of wood holding the flag up doesn't quite fit my englighenment age mod. I've yet to find the file for it, in the Assets directory.
flag_banner.jpg
 
Take a look in this file: Hungary_CIV4PlayerColorInfos.xml. The colour values are touching the flag as well. Play a bit with the primery and the secondary colour. I can imagine the second one is black to. This would darken the other colours. I had a similar thing when I converted my mod to run with bts. You may test how your flag is influenced by the colours by taking two extreme colours, for example pink and poisson-green but I don't know what you have to type in if you want to use them). If this is the reason try white as the "bad colour".

Some general tips:
- I suggest to don't use dds converter or dxtbmp, instead use photoshop or gimp with the corresponding plugin, if you are loosing importent informations of the picture when saving it, try "the compressonator" by AMD
- some machines support flags with alpha channel others not, AFAIK there is no fix to make one file run on both types of machines; the thing is: if your machine supports alpha channel then flags without alpha won't be supported and viceversa, if a flag isn't supported it shows completely white in the game, what modders usualy do to be compatible with both types of machines is adding a white-flag-patch to their mod that only includes the other type of flag - the gamer will replace the other if needed; I have this effect on my desktop and my laptop pc: one supports alpha, the other not
- check your alphas, that your flag is showing up black could because of a false alpha
- look for tutorials that describe how to add a custom civilization, most of them also show how to make flags
- you may read something about the <bWhiteFlag>-tag in Hungary_CIV4ArtDefines_Civilization.xml, according to your listening it is correct for a "more-coloured" flag (so don't change it), for a bicolour flag it is wrong I think (but I don't deal with these flags)

EDIT: about his swedish flag: I think this kind of flag is not possible... DDS doesn't support transparency AFAIK and think that this alpha thing is about defining an area to show up in the players colour. But I am not sure. Never seen a flag like this in a mod...
 
Hi cool3a2, thanks for replying. I couldn't find a Hungary_CIV4PlayerColorInfos.xml in my Civ4 directory. I found your Magyar mod, is that where the file is from? I tried to download it but it didn't work. Where can I find these values you're talking about, the primary and secondary colours?

I am using photoshop, and as you can see in my first post I can't export to .dds with an alpha layer. The DDS script says I've got too many channels (RBG, Red, Blue, Green and Alpha) and thus won't export. I don't see how my problem could be related to alpha channels, as I can't export an alpha channel. Shouldn't the picture just show up? The british flag and other flags in the Desert War mod work just fine. I've compared the ArtDefines and the .dds - there is no difference between them, yet my prussian flag shows up as an all-black flag.
 
Yeah, my mistake. The file is CIV4PlayerColorInfos.xml, not Hungary_CIV4PlayerColorInfos.xml. The second one was the specific file of my mod. I had to rename it to make it running as modular mod. The file you need should be somewhere in civ4 byond the swords Assets/XML/Interface folder. You should copy the file to your mods files. If your are creating a bts modular mod, you have to rename it the ordinary way and delete all <PlayerColorInfo>-entries (of course with subentries) except one. The last one you change to:
<PlayerColorInfo>
<Type>PLAYERCOLOR_Test</Type>
<ColorTypePrimary>COLOR_PLAYER_PINK</ColorTypePrimary>
<ColorTypeSecondary>COLOR_PLAYER_YELLOW</ColorTypeSecondary>
<TextColorType>COLOR_PLAYER_BLACK_TEXT</TextColorType>
</PlayerColorInfo>
(or maybe other values for the <ColorTypePrimary[Secondary]> entries (I don't know what colours are possible).
If you create an ordinary mod, keep the name and simply add an extra entry for your colour. To do this copy an existing one and change it to the example above. After this you need to do some changes to the CIV4CivilizationInfos.xml file. Copy the file from Assets/XML/Civilizations from Beyond the swords directory to your mods folder (But you already should have done that since you have a running mod). In this file search the <DefaultPlayerColor>-entry and change its value to PLAYERCOLOR_Test. Try to run your mod.

About Photoshop: I don't think I have created a channel for every colour. I simply took the flag, resized it, added an alpha (if needed for the target machine) and saved it. That's all, I think.
 
I did what you told me to do, and this is the result:
prussiaproblem_yellowflag.jpg

You can clearly see some of the yellow features of the prussian eagle aswell as a black contour. The problem is that the rest of the flag is yellow.

Re: Photoshop. I didn't create a channel for every colour either. I took the flag, resized it and saved it as a .dds. I did not add an alpha layer (what would I need it for?). If I try to add an alpha layer, I get this error popup when trying to save the flag as a .dds:
alphalayerproblem.jpg



What now? Try with different colours? Why is there no purple on the flag?

Edit: I think I know what PlayerColorInfos.xml does, but how is it relevant to my flag? I gather that the different Playercolor types are for the Civ4 flags, like America's white star on a blue background. The american flag .dds file has a black and white alpha layer. The black area gets the primary color (blue) and the white bit (the star) gets the secondary color, white. I have not counted how many colours my flag has, but there's plenty more than just black and white (red and yellow details on the eagle etc.)

Edit 2: Seems like whatever color I attribute to <ColorTypeSecondary>, it ends up covering all of the flag (except for the contour seen on the yellow flag above)
 
I guess it is normal that there is no purple in the flag. I think the primary colour has no influence on the flag. But there should be other things that occur in purple, like the shields at the bottom of the cities. But this is not our problem. Change the Secondary to white. If you have luck, that's all. Maybe you should cut the sides of the picture off. The picture has to be quadratic, but in the game it is not. So the eagle would become somewhat fat. If this doesn't work, you should take a look at the dds you have saved. If the picture doesn't look like your original file you made the flag out of, you may try "the compressionator" by AMD. It is able to save files in dds format without information losses. If your flag already looks as it should (you could post a screenshot here), then I have no idea.

You don't need to concentrate on the alpha channel. Your flag isn't white, we can even see parts of the eagle, so the alpha is okay. You only should create a copy of the dds without alpha if you plan to publish the mod. You would have to zip it or put it in a different folder, so everybody can overwrite the default flag if it is not working for them.
 
Okay, I went through the process of recreating the Prussian flag. Thanks for reminding me to make the eagle wider, my Frederick leaderhead is 25% wider so that it'll look okay in the game - will do the same to the flag.

Here are the settings for the nvidia dds converter. See, no alpha.
ddsexport_noalpha.jpg


The code:
Code:
<ColorTypePrimary>COLOR_PLAYER_PINK</ColorTypePrimary>
<ColorTypeSecondary>COLOR_PLAYER_WHITE</ColorTypeSecondary>

The result:
prussiaproblem_whiteflag.jpg


Same old problem with the secondary color (contour clearly visible). There are no black bars and there's no eagle :(


Edit: Here's the new flag, with the fat eagle:
Prussia_flag2.jpg

There is no alpha channel, nothing wrong with it.
 
Hmmm... I never had this problem... For the moment I have no idea. Sorry.
 
I am also interested in multi-color flags. I haven't started to research this specifically. Have you found the flag tutorials at this link?

Regarding the "too many channels to export", you need the DDS format "DXT3", which contains R, G, B and alpha. You didn't mention which photoshop you were using. I have several versions of "elements", which handles alpha channels differently. If you are using elements, the problem is that elements doesn't really have alpha channels. You must create exactly one layer and that is your transparency. If you have any working button files around, bring one up in photoshop and use the menu choice "select->load selection". That will show you the alpha layer.

If you are using "full" photoshop, I don't know the exact answer, but you must use DXT3 and one alpha channel.
 
It seems that the tutorials give enough information to make multicolor flags, along with this other thread.

Once you can export to DDS DXT3 successfully, make sure your alpha channel is set to disable transparency (usually this means it is all black, or "nothing selected" in photoshop elements). Then set bWhiteFlag in the xml to show your full color image. The tutorial thread will discuss about the size, it seems 60x90 saved as a 128x128 file is required.

I will try it in the next couple of days, please reply if you are stuck (or if you get it working :-)
 
As you can see, I have set <bwhiteflag> to 1, and I don't have an alpha channel in the .dds I have exported. Yet, I still get the "bleeding". Not sure what difference the scaling (60x90 saved as a 128x128) does, as you can clearly see the contour of the eagle on my flag - it's just that the primary colour is bleeding through.

Edit: Oh right, I'm saving my .dds as a DDS DXT1... I'll try DXT3.
 
I have Adobe's creative suite 3, so Photoshop CS3. I exported my flag as a DXT3 DDS file and the flag is now completely white (the secondary color in PlayerColorInfos.xml). What's going on? bWhiteFlag is set to 1, as it should be...
 
I have Adobe's creative suite 3, so Photoshop CS3. I exported my flag as a DXT3 DDS file and the flag is now completely white (the secondary color in PlayerColorInfos.xml). What's going on? bWhiteFlag is set to 1, as it should be...

I am guessing, but I guess that your flag is now completely transparent. Can you use CS3 to explicitly create an alpha layer and set it to "completely opaque"?
 
Seems to me like you need a different program that actually works... why not try DXT BMP Manipulator and ditch that NVidia junk.
 
Wolfshanze: The nvidia plugin has worked fine before... I have worked with alpha channels and .DDS, just not with Civ4. I tried DXT BMP, and it did not work. White flag, no eagle contour, same as my Photoshop DXT3 attempt.
 
I am able to create a multicolored flag on my second try. I did mess up the alpha layer on my first try :-) It seems your problem is on the photoshop side. You need four channels, R,G,B,alpha, and somehow your file has five. If you were able to get four, then you could export to DXT3, and it would work. Or at least, I have not done anything extra besides what is listed here using photoshop elements 3, and it is working. I am also using the nvidia plugin.

attachment.php
 

Attachments

  • flag.jpg
    flag.jpg
    63.8 KB · Views: 589
Hah, it works!
prussianflag_working.jpg

Looks great doesn't it? Probably need to make the black bit a bit bigger and the eagle a little smaller though.

So yeah, Photoshop ain't working too well for me. I magically got the nvidia exporter to work and not give me the too-many-layers-popup (have to save as a .tga or .bmp, then open that, then export it). But, the thing still only showed up as a white flag in-game. So I used the DXT BMP tool and edited the alpha layer, and it worked. Thank you guys! Now to finish all of the flags :)
 
I found this thread and has similar issues with Photoshop and the DDS plugin. &#8234;The Too Many Channels error is because the plugin doesn't like having an alpha with multiple layers and/or transparency. So if you flatten the image, it exports. Also, the dark gray/black seems to be what Civ4 does if the color info isn't what it likes.

I haven't worked out the three colors or more (bWhiteFlag = 1), but I did get the two-tone worked out (bWhiteFlag = 0). Here's what I did. Maybe it'll help someone out. I'll look at the original issue later when I have more time.

This assumes you have Photoshop CS3 (regular or extended) and you have the Nvidia DSS plugin installed.

1. Create a new image with the following settings:
Width 128 pixels
Height 200 pixels
Resolution 72 pixel/inch
Color Mode RGB 8 bit
Background Contents White
2. Make a Black and white image here. Put the image in the middle and leave space at the top and bottom. (The size ensur5. es that the image will come out relatively square when Civ4 resizes it for the flag).
3. If you have multiple layers, go to Layer > Flatten Image
4. Click on the Magic Wand tool. In the toolbar, put in a Tolerance of 30, and uncheck 'Contiguous'.
5. Click the magic wand in a black area. (Or click in a white area and go to Select > Inverse to invert the Selection
6. Go to the Channels palette and click the Save Selection as Channel button. This will create a new Alpha Channel. Click on the eye icon next to the alpha channel to see it - your image will turn pink - that's the alpha channel and is normal.
7. Click on the RGB channel to select it.
8. Go to the Layers palette.
9. Hit CTRL-A to select all of the image.
10. Hit delete to clear the image. Your black should be gone and you should see white where it was, surrounded by pink.
11. Go to File > Save As.
12. Choose D3D/DDS (*.DDS) for Format. Make sure 'Alpha Channels' is checked.
13. Click Save. The NVIDIA dds Format screen will pop up.
14. Choose "DXT3 ARGB (Explicit Alpha) from the dropdown.
15. Under MIP Map Generation, choose "No MIP maps".
16. Click Save.
 
Back
Top Bottom