1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Editing Leader Pictures?

Discussion in 'Civ2 - Scenario Creation' started by Angry_Jerk, May 11, 2008.

  1. Angry_Jerk

    Angry_Jerk Chieftain

    Joined:
    May 4, 2007
    Messages:
    5
    Sorry if this is in the wrong forum. I'm new here (or rather joined up a year ago and asked a question, not sticking around).

    I was browsing the Wikipedia article for Civ 2, and I noticed something about being able to edit the leader pictures with a special program. Is this true? If so, what is the program, and where could I find it? I've dug around through all the files in my Civ 2 folder, and I haven't been able to find any that contain the leader pictures.

    Thanks.
     
  2. Bestbank Tiger

    Bestbank Tiger Deity

    Joined:
    May 23, 2006
    Messages:
    2,137
    Location:
    Mississippi Gulf Coast
    Yes, it's true. I used it to put in the leaders for my custom civs (Shania as leader of the Canadians) as well as remove leaders I dislike (Mao, Elizabeth I, Stalin).

    You have to edit the mk.dll file. Can't remember exactly how it's done. The programs are on my other computer.
     
  3. Mercator

    Mercator Emperor

    Joined:
    Mar 9, 2001
    Messages:
    1,069
    What version of Civ2 do you have?

    If you have pre-MGE Civ2 (no multiplayer ability), download Gif Extractor. Browse to your Civ2 folder with it and open MK.DLL. That's where the leader pictures are in. It's easiest to then save the image you want to replace to a GIF file, edit it in an image editor and load it back into the DLL.

    Make sure you keep a backup of MK.DLL in case something goes wrong!

    With GifX, you also have to make sure that the file size of the new leader picture is equal to or smaller than the original picture! And the file has to be in the same format as the original. I'm not sure if something like MS Paint can do that right.


    If you have MGE or ToT, download Resource Hacker. As above, use it to open MK.DLL, find the leader picture you want to replace, save it as a GIF, edit it and replace the original. With Resource Hacker you don't have to worry about file size.

    You can have a look at the other DLL files in your Civ2 folder too. They've got more graphics in them, such as the spaceship parts, the throne room and the city view graphics.
     
  4. Angry_Jerk

    Angry_Jerk Chieftain

    Joined:
    May 4, 2007
    Messages:
    5
    Thanks Mercator. I have the older one. I'll try the GIF Extractor now.
     
  5. McMonkey

    McMonkey ----Evertonian---- SLeague Staff

    Joined:
    May 9, 2005
    Messages:
    2,876
    Location:
    Cardiff
    Thanks for that Mercator. I tried using Gif Extractor but found the size limitations too frustrating. I want to change a lot of the pics in Fortress Europe so I will give Resource Hacker a go :)
     
  6. Angry_Jerk

    Angry_Jerk Chieftain

    Joined:
    May 4, 2007
    Messages:
    5
    So I used GIF Extractor on my old version of Civ 2, and replaced several pictures. I thought I had the exact file type, but now I'm starting to doubt that.

    Whenever I come in contact with the civilization whose leader I edited, I get an error message saying something to do with the source code, and the game crashes on me.

    I opened one of the original GIFs in Photoshop, and from what I gathered, the mode had to be "Indexed Color" and "8bits/Channel," aside from the file size restrictions that GIF Extractor has. Am I missing something, like another restriction? I tried saving the GIF as both normal and interlaced, still with no difference.

    I feel like such a n00b.
     
  7. Huayna Capac357

    Huayna Capac357 Deity

    Joined:
    Jun 30, 2007
    Messages:
    8,194
    Location:
    Boston, Massachusetts
    Uhoh. It's not working for me. I have Civ 2 MGE and ToT from Civ Chronicles and I can't access the leaderheads. Help!
     
  8. SteamCiv

    SteamCiv Warlord

    Joined:
    May 18, 2012
    Messages:
    109
    This thread is from like 10 years ago, however, I was looking for such an answer and had to learn by trial and error.
    The mk.dll file may be used to change leaders but they show in all scenarios as well as the main game.

    The SIZE of the gif being used MUST BE NEAR EXACT. Try to get exact or maybe slightly smaller in K or yes, either you cannot import the gif, and more insidiously, the game will crash when the diplomacy screen is entered with such an altered leader graphic.

    This means if one is replacing a black and white picture, with a color portrait, you have to reduce the color table until size matches the original. A graphic program that allows graphic fudging, reducing colors or file size without dimensional reduction is very handy.

    Some portraits seem much harder to match than others without errors.
     
  9. Knighttime

    Knighttime Warlord

    Joined:
    Sep 20, 2002
    Messages:
    107
    In case it's helpful, here's another thread -- from 10+ years ago -- that I found about this topic: https://forums.civfanatics.com/threads/leaderheads-help-needed.228789/

    Just to confirm, you're still running an older 16-bit version of Civ2? The options do seem much more limited there. On the other hand, in Test of Time, I've been able to replace a leader graphic inside mk.dll with one that is considerably larger (e.g., 31K replacing an original that was 19K) and that has worked fine. It sounds like that should be possible in MGE as well, although I haven't tested. Also, the new image can use a different color palette than the original image. In my testing, it seemed like the new image might be limited to 64 unique colors, which isn't a lot, but at least those don't need to have any relation to the colors used in the image you're replacing.
     
  10. SteamCiv

    SteamCiv Warlord

    Joined:
    May 18, 2012
    Messages:
    109
    Thank you for that thread!!!

    It basically confirms what I found out by trial and error.
    If Civ 2 (pre Civ MGE and TOT) one must use GifX for Civ2 DLLs.
    This is rather restrictive and runs into the issues described earlier,
    same color palette and dimensions,
    else BOOM

    Resource Hacker (I gather that is what you are using ) should work for MGE and from what I gather is far less punitive with off dimension images.

    "it can make the necessary changes to the DLL headers to allow a larger size resource replacement. " (to quote the thread)

    I'm using Fantastic Worlds on Win XP because for testing, running AI vs AI games goes far quicker with less nag dialogue confirmation boxes to dismiss.
    Generally I can get away with setting "no Human Player" in the cheat menu, place a weight on the "enter" key and the AI will play itself. From time to time I may have to interact with it, but for the most part the game plays itself.

    In MGE it gets hung up every time on the casualty report window.
     
  11. Cassius Critzer

    Cassius Critzer King

    Joined:
    Dec 27, 2017
    Messages:
    918
    Gender:
    Male
    I am going to try using Resource Hacker on MGE using an Android. Many of the utilities do not work under Wine emulation like Exagear, thus we often cannot use them for scenario creation. When playing the Sengoku Jidai 2.0 mod, then it would be great if old Japanese woodblock prints of famous daimyo would be seen versus the standard tribe leader portraits. I'll do a test to see if changing this in Linux using an Android is possible.
     
  12. Cassius Critzer

    Cassius Critzer King

    Joined:
    Dec 27, 2017
    Messages:
    918
    Gender:
    Male
    I experimented with replacing leader portraits. I found that Gif Xtractor3b worked great and was intuitive. I think Mercator who is a Civ 2 mapper going way back created it. You might try that.

    This extracts from a Civ 2 dll as gifs buried within, then you alter or create a new leader portrait then push that back into the dll. Mercator has a tutorial, I think.

    It also ran fine on an Android tablet under emulation which was a plus.
     
  13. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    Hi guys,

    I've read this thread and the other thread that @Knighttime linked to.

    So let me get this straight... with mk.dll if you want to keep compatibility with older pre-MGE Civ2s then you need to:
    1. Use GifX
    2. Do not exceed the image file sizes
    3. Use the exact same palettes used in each portrait you're replacing

    Point 3 is the one that surprised me as when I was editing the Tiles.dll file only points 1 & 2 mattered as I was able to extract the mostly grey scale black and white background images and convert them to the full Civ2 colour palette (or at least the one used in Terrain1.gif) which then allowed me to import the colour images I wanted to replace them with (which I'd also already converted to the Civ2 colour palette). However when I tried to import a leader head into Mk.dll using that full civ2 game palette instead of the limited ones in each leader image it did NOT work (see pic below).

    Interestingly our custom GUI text box borders and backgrounds that normally work fine also went haywire in the diplomacy screen (see pic below) for both @Metro Polis and I. So that leaves me wondering whether the entire diplomacy screen and all of its elements operate under its own palette and each leader portrait takes bits and pieces from that palette. Presumably the greys normally used in the text boxes in Civ2 game view are also in this diplomacy palette which is why you don't normally get glitches. If there is a full palette for this screen that all its elements adhere to then I'd love to get my hands on it as that would allows us to import better quality leader faces.
    For example all the portrait palettes are devoid of red. Yet there are red elements elsewhere in the dip screen (eg you can see red on the 3D animating herald) so there must be a gobal pallet for this screen with more colours than whats in the portrait pics.

    upload_2019-8-10_22-56-33.png

    Normal box colours outside of diplomacy screen:
    upload_2019-8-10_22-57-51.png
     
    Last edited: Aug 11, 2019
  14. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    I've had a look at the diplomacy background images which show a bit more of this elusive weird diplomacy palette not shared by other game elements.

    This is pretty much the standard Civ2 palette we all know as the cities, terrains, and icons all use this with a few minor variances.
    upload_2019-8-10_23-32-43.png

    This is the one I keep seeing in all the diplomacy leader heads which is annoyingly devoid is reds and greens. Completely incompatible with the above palette hence the conversion problems we've had.
    upload_2019-8-10_23-36-4.png

    This is the one used by the big diplomacy background pictures. Sure enough it fits like a perfect jigsaw puzzle with the leader heads palette.
    upload_2019-8-10_23-38-43.png

    There are no images used in the diplomacy screen that contain the full pallet so who knows if or what usable colours may lay invisible in that bottom area due to not being used in the images can came with the original game. Argh if I could get my hands on that full palette it would surely open up the doors for better leader portrait replacements and diplomacy background graphics.

    Also of note is the fact that the blacks and greys are identical through all palettes. This explains why the original text box backgrounds work both in-game and in the diplomacy screen despite the palette changes.

    @Metro Polis FYI
     
    Last edited: Aug 11, 2019
  15. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    We also noticed that the colour glitches in the text box keep changing for different leaders and @Metro Polis figured out that it was the Heralds that were screwing up our GUI background elements.

    As a result I think I've figured out exactly how the diplomacy screen palette works.

    A top section used for leader heads that never changes.
    upload_2019-8-11_2-28-1.png

    A central area that's used for background graphics that never changes.
    upload_2019-8-11_2-28-26.png

    A bottom section (that we can't see) that is used by the Heralds and because the Heralds need more colours than what is available in this bottom area the bottom area colours are constantly swapped/interchanged for each Herald that's loaded.
    upload_2019-8-11_2-29-57.png

    So even if we were able to somehow get access to a Herald animation frame and steal it's palette it probably wouldn't mean **** because its lower/bottom area palette wouldn't match the other heralds. Although I'd still be curious to see what it looks like. Does any one know how to access herald animation frames?

    Our custom GUI uses creamy brown colours located right here..
    upload_2019-8-11_2-39-23.png

    Which when the diplomacy screen is loaded those colour slots fall right into that bottom mystery Herald area where the colours appear to interchange. And that presumably explains why our GUI text boxes keep changing into weird glitchy colours when a different Herald is loaded.
    upload_2019-8-11_2-29-57.png

    Anyway back to the main topic of the leader head portraits I think that if I combined the top pallet and the central palette (whos colours thankfully never change) into one unified pallet and then used that combined palette to convert the leader portraits it should gives better conversions. That central palette used on the diplomacy screen contains lots of yellows, some redish orange colours and some bluish greens that would likely help a lot with the conversions. Sadly the proper reds and greens appear to be presumably down in the bottom Heralds area where nothing is stable.

    I'll see if I can create a combined palette and then apply it to a leader portrait and see if it works in the game. If it does I'll post the combined palette here for others to use.

    If it turns out that there are a number of colours in the bottom area (we can't see right now) that do NOT change between the Heralds then they could be added to this combined palette as well, once again resulting in even better leader portrait conversions. But for that I'd need access to the Herald frames to see what palettes they use, and I have no idea how to access Heralds and their animation frames lol.

    .
     
    Last edited: Aug 11, 2019
  16. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    Ahh darn it.. the Herald's are AVI files. I can't pull a palette grid out of that. Yes I can pull colours from them but not their palette grid positions. If we don't know where each colour sits in the palette then we can't use any of their colours. :( Unless one of the Civ2 gurus here has an idea I'm stuck on making progress with the mysterious changing bottom area of the diplomacy pallet.

    Will focus on combining the other 2 palettes (central & top) as that's better than nothing.
     
    Last edited: Aug 11, 2019
  17. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    Just discovered that the palette I had for the leader heads was not the full palette so some of the stuff I posted above was wrong! I was using am modifed mk.dll that @Metro Polis gave me where all the leader heads shared the shame palette. There are leader heads with reds and other nice colours in the original mk file I can rip palettes from haha. Metro has already had a go and produced some good results!
     
    Last edited: Aug 11, 2019
  18. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    Now that I'm looking at the original mk.dll it turns out that the top area also changes for each different leader face. I remember back in the day that Civ2 turned Heralds off if your windows was in 256 colour as the game required you to have 16 bit colour (65,536 colours) activated. Presumably that's because they are plucking lots of different random colours from a much bigger palette and jamming them into 256 colour palette top area for the leader heads and then into bottom area for the Heralds.

    Eg
    upload_2019-8-11_13-32-48.png uses this palette upload_2019-8-11_13-33-55.png

    whereas

    upload_2019-8-11_13-38-8.png uses this palette upload_2019-8-11_13-38-46.png

    So other than the usual shared Blacks to whites it's completely different.

    Interestingly a couple of leader faces at the end of mk.dll fill the mystery bottom areas with colours not even used in the leaders face. While I'd love to believe that these bottom palette colours would work with other leaders, I doubt it though, as I'm pretty sure that's where the Heralds colours are being fed into.

    Eg
    upload_2019-8-11_13-42-20.png uses upload_2019-8-11_13-43-12.png and upload_2019-8-11_13-43-27.png uses upload_2019-8-11_13-44-43.png

    So in the end there is only one constant in the Diplomacy pallet that never changes and that's the center area used for the big background pictures.


    @Metro Polis has already tested and demonstrated that you can pick one of the leader heads palettes and apply it to all the others without glitches to their portraits or heralds (meaning we effectively turn the top area into a static unchanging area which is why I originally mistakenly thought the top area didn't change haha) so that's good news. As it pretty much means we can pick a default civ 2 leader with a good set of colours and then use that for importing. I'm guessing I could even swap out some of the colours I don't want with colours from other leader heads. This custom top area palette wouldn't need yellows because I'm going to take them out of the static central area of the palette as that has good yellows.

    Time to do some more experimenting!
     
    Last edited: Aug 11, 2019
  19. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    As expected, tests have confirmed that the bottom area of the palette is NOT usable across different leaders haha.
    upload_2019-8-11_14-16-16.png

    So those 2 weird cases where the palette was filled with bottom must be special cases where their 2 Heralds fit those bottom area colours or something. Weird.
     
    Last edited: Aug 11, 2019
  20. Blake00

    Blake00 Warlord Supporter

    Joined:
    Sep 24, 2016
    Messages:
    296
    Gender:
    Male
    Location:
    Australia
    Next test is a success! I converted a leader portrait to use nothing but the central palette colours and it worked perfectly!

    upload_2019-8-11_14-25-18.png



    I'm very happy about this one as it means we've got a good selection of yellows to combine with the chosen upper palette area. So now I just need to pick a leader head pic with a good selection of colours in the upper palette and then see if I can add some more reds, blues and greens to the upper palette area from other leader heads. Then combine it with this central palette and I think we'll have a nice palette to use for importing better leader heads without being restricted to lousy individual leader head palettes.

    .
     
    Last edited: Aug 11, 2019

Share This Page