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

Custom heralds and transparency

Discussion in 'Civ2 - Scenario Creation' started by Blake00, Aug 16, 2019.

  1. Blake00

    Blake00 King Supporter

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

    Because @Metro Polis and I haven't messed with the game enough already :lol::lol: we're looking at some custom heralds too (the animating dudes in the diplomacy screen). However some problems have emerged.

    Metro created a video using animation frames of HoMM2 units which is a very cool idea. However when he put them in-game they had a big pink box around them.
    upload_2019-8-16_16-52-28.png

    He then started looking at video transparency settings in the editor we found (in this thread on creating custom wonder videos) that supports indeo video exports (the format Civ2 MGE needs).
    upload_2019-8-16_16-53-56.png

    However I don't think playing with that stuff will help him as I'm pretty sure its in regards to multi layered videos. Eg one layer has a picture of a house, then another layer of the video has a picture of some clouds, so you make the house picture semi transparent so that you can see the clouds in the other picture. If you don't do that then one picture just overrides the other in the final exported video and you'd never know the under layer picture was there. I don't think it's talking about making the actual exported video itself transparent as I can't recall ever seeing any transparent videos on the internet. Only ever seen transparent gifs and pngs on the net. But I could be wrong as I'm far from an expert on this stuff haha.

    However I'm pretty sure that it is actually Civ2 that is making the video background transparent. So if you save the video with a background colour that Civ2 treats as transparent then it 'should' work.

    When I feed an original herald video file into an old AVI to GIF converter program I have it interestingly shows the video background as pink. However Metro already tried that colour with his dwarf video and it didn't work (unless it was accidentally a slightly different shade of pink?).
    upload_2019-8-16_16-57-8.png

    When I take a snapshot in VLC video player of the same video file the background is completely black. So maybe trying black as the background colour and seeing what Civ2 does with it might be the go
    upload_2019-8-16_16-58-0.png

    When I play it in windows media player it has a black background too however there's lots of weird glitches in the black area that kind of reminds me of transparent gifs.. so that almost makes me think the video itself is some how transparent even though I said above that I thought it was not possible haha.

    When I load an original herald into the video editor it also gets that pink background.
    upload_2019-8-16_16-58-41.png

    So now we're left a bit confused..

    Is the transparency being handled by the video itself or the game? I was sure it was the later but I'm starting to doubt myself now.

    Does anyone here know more about this or if there were any threads where someone really delved deep into this stuff many years ago? I did a search for the world herald here and didn't find anything other than discussions about how to turn them off lol.
     
    Last edited: Aug 16, 2019
  2. Blake00

    Blake00 King Supporter

    Joined:
    Sep 24, 2016
    Messages:
    651
    Gender:
    Male
    Location:
    Australia
    Hmm maybe it is both.. eg you give the video a certain background colour and then you tell it to work out transparency from it using 'first frame analysis'.

    but you have to get the background colour right and it looks like the pink is just off a bit.

    Eg in @Metro Polis 's test shots I can see that the pink has values of:
    Red - 254
    Green - 0
    Blue - 253

    Whereas the pink in the original herald has a pink value of:
    Red - 255
    Green - 34
    Blue - 255

    However when I look at the palettes used in the diplomacy screen they all have a pink value at the bottom. eg..

    And to make things more confusing that has a different value again lol of:
    Red - 255
    Green - 0
    Blue - 255


    So I think you used the wrong pink as the background colour mate. However which one to choose from is the next problem haha..

    Maybe a grab a picture change the custom diplomacy palette I posted here , make sure the background pink is (R 255 G 0 B 255), stick it in the video editor (and don't waste time making lots of other frames, just leave it at one frame that goes for say 60 seconds) and save it as an avi (without touching the video transparency stuff) and see what happens.

    I also find myself wondering if when the video is saved and compressed does it do anything to colours at all.
     
  3. Metro Polis

    Metro Polis Warlord

    Joined:
    May 5, 2012
    Messages:
    253
    Location:
    Southern Hell
    I originally grabbed the pink of the units.gif (saved it as a .bmp first for our old video editor can't handle gifs) as it is transparent in the game, too. Maybe it switched colour during converting?
     
  4. Blake00

    Blake00 King Supporter

    Joined:
    Sep 24, 2016
    Messages:
    651
    Gender:
    Male
    Location:
    Australia
    Looks like we don't need help because @Metro Polis has done it!!!! But I'll post the results in this thread so others can learn from our work and create cool stuff in the future if they wish to. :)

    Metro took a picture of the custom palette I made (in the custom leaders thread), inserted it into a video using the editor he found (in this thread on creating custom wonder videos), and then tested it in game to see what colours were transparent and to our surprised it was a couple of the whites lol! Not pinks or blacks! He then tried white on his Dwarf test Herald and it worked a treat! :)

    upload_2019-8-16_20-43-6.png
    upload_2019-8-16_21-0-10.png

    What's even crazier is that Metro then did another test where he was able to push over the Herald to over the top of the leader portrait and then use it to create facial animations!!! We're probably not going to do this in our scenario but we just had to post the results here for others to see as people could do some really cool stuff in their scenarios with this!!!

    faceman.gif
     
    Last edited: Jan 15, 2021
    Thorvald of Lym likes this.
  5. Metro Polis

    Metro Polis Warlord

    Joined:
    May 5, 2012
    Messages:
    253
    Location:
    Southern Hell
    We broke into the heralds video mechanics. You can make your own videos, 5 sec. long (astonishing because the original heralds' videos were 15 sec. long, so maybe the game uses a time warp).

    0-1 sec: introduction (only once at the beginning of the meeting)
    1-2 sec: waiting for a reply (an infinite loop)
    2-3 sec: cheerful (when you accept something)
    3-4 sec: ready to fight (when you make them mad)
    4-5 sec: reluctant (when you refuse something)

    Looks like this now, actually the genie is moving around, hovering when waiting and having all those other moves/emotions in-game:
    upload_2019-8-23_17-16-55.png
    There are a few colour glitches we can't to anything about, because the we can't get a grip at the heralds unique colour palette from their video. And well, the council members work the same way, I guess. So, if somebody would like to act in front of a white screen... :king:
     
    Thorvald of Lym and Blake00 like this.
  6. Blake00

    Blake00 King Supporter

    Joined:
    Sep 24, 2016
    Messages:
    651
    Gender:
    Male
    Location:
    Australia
    Last edited: Sep 29, 2019
    JPetroski likes this.
  7. Kasius Klej

    Kasius Klej Chieftain

    Joined:
    Feb 14, 2021
    Messages:
    31
    Gender:
    Male
    This is excellent hacking. It inspires me to do something similar some day.

    It is a mystery why would original be 15 seconds long, when 5 seconds seemingly covers the whole protocol.
    Let's solve this mystery. I remember the protocol from civ1.
    0-1 sec: speaking
    1-2 sec: waiting for your reply, blinking eyes, smiling perhaps, bluffing after demanding stuff, having 4 men sometimes to back up his bluff behind him. Indeed you'd have infinite time to figure out the answer.
    And then it all depended on your answer.
    The outcome was either "cheerful" or "ready to fight", or "reluctant". If he was cheerful, next time we meet he'll probably be reluctant. And if he was ready to fight, conversation was over.
    And then I think there was one more question about exchanging maps, if he was alright with continuing conversation, so the video went back to "waiting for a reply" and then the conversation about ended with "reluctant" part of the video.

    So it looks it only takes 5 seconds of video to cover all happenings in the diplomacy room in Civ2. That is excellent discovery.
    But how can I guess whether the guy is bluffing? I mean, I never see the 4 guys in his company like in civ1. In civ1 I could guess whether he was bluffing. Why would I give 50 gold if there was going to be peace anyway? That was an important part of diplomacy in civ1 and sometimes you'd know in a second what's gonna happen.
    It's the same protocol in civ2, but something is missing.
    I wish I would have an example files, so I would look up into the mystery further. What is in the 10 minutes that are extra? My guess is it's the background and in background there are clues to help you figure out what to answer. Or perhaps the game just dropped the clues, leave them out completely, and those 10 minutes of video are empty and unused?

    Whatever the case, I'm almost certain that it isn't a time warp causing this 10 minutes difference.
     
    Blake00 likes this.
  8. Kasius Klej

    Kasius Klej Chieftain

    Joined:
    Feb 14, 2021
    Messages:
    31
    Gender:
    Male
    Hello,

    I solved some of the questions that were bugging me yesterday and also came up with alternative method for making custom heralds.

    Only 4 scenes are used, the scenes are stored in first 5.1 seconds of the movie.
    Now I used 24 frames per seconds, since this is the best for making stop motion animation, and the structure of the movie is:
    1st second "greetings"
    2nd and 3rd second "loop"
    4th "happy"
    5th+ "angry"
    6th and 7th The movie has to be at least 7 seconds long so it doesn't crash, so for in last two seconds any scenery you provide won't show in the game, but you have to provide that anyway.

    If you use different frame rate, like 10 fps or 50 fps, the above structure seems to shift. I haven't tested this any further, since I got solid 3 mega bytes movies for my heraldry by now, but I noticed even before, since I was working with portraits, how you can give somebody a character by just exchanging the scenery for "happy" and "angry" and tricks like that. You should have seen how Alexander the great laughs when I ask him if he would like to exchange maps.

    The video size can be up to 380x600 pixels.

    Transparency is difficult to achieve. In my Sony Vegas movie editor, I couldn't switch on "first frame analysis", so I couldn't get that. On the other hand, I could do some other stuff like zoom in or roll 14 gif presets so I could render 14 movies just like that.

    This is the video settings I used:

     
    Blake00 likes this.
  9. Metro Polis

    Metro Polis Warlord

    Joined:
    May 5, 2012
    Messages:
    253
    Location:
    Southern Hell
    Sounds cool, can you upload a picture or video/animated gif what it looks like in-game?

    Actually something gave me a bit of headache back then: the heralds use unique time schedules, some differ slightly. That means: when one herald-leader changes his face at - let's say 3.0, others do that 3.1 or 2.9. You have to sort that out by trial and error if you want to avoid some emotions starting or ending incorrectly.
     
    Last edited: Feb 25, 2021
  10. Metro Polis

    Metro Polis Warlord

    Joined:
    May 5, 2012
    Messages:
    253
    Location:
    Southern Hell
    Transparency: simple turn the background purely white. Then it should be turned transparent automatically in-game.

    And when it comes to bluffing: pay attention to the number of weapons/signs on the left and right of the leader's face. The more there are, the stronger his army (on the left) and research (in the right) is.
     
  11. Metro Polis

    Metro Polis Warlord

    Joined:
    May 5, 2012
    Messages:
    253
    Location:
    Southern Hell
    It makes everything easier with the videos if you start and end each emotion with the "loop Emotion" to overlay the different time schedules.

    What also helped me a lot was a "counter video" starting at 0.0, 0.1,...for the first second, 1.0, 1.1... for the second and so on. Such a counter is great just to see how it works and how you have to line up the pictures for the video.
     
  12. Kasius Klej

    Kasius Klej Chieftain

    Joined:
    Feb 14, 2021
    Messages:
    31
    Gender:
    Male
    This is how it looks like in-game.

     
    axx and Blake00 like this.
  13. Blake00

    Blake00 King Supporter

    Joined:
    Sep 24, 2016
    Messages:
    651
    Gender:
    Male
    Location:
    Australia
    Wow.. that is really cool man. Awesome to see someone taking Metropolis's cool facial animation herald experiments and making a Civilization 1 themed mod recreating their original facial expressions from Civ1. Oh and I will reply to your posts over in the Civilization 2 Civ1 graphics mod thread soon. Just need to do a few more experiments before being able to reply properly.

    .
     

Share This Page