• Welcome to Zoo Tycoon Community Download Directory.
 

How does one create a ".pal" file?

Started by johnrn1, August 11, 2010, 11:26:18 PM

0 Members and 1 Guest are viewing this topic.

Jeff

I'll have to check, I really thought I had Zoot 1.1 from here.

The reading of a palette is easy, that was the first bit of code I wrote, didn't take a lot of time at all.

I currently have the following functionality in three short evenings:
- reading/showing color palette;
- reading/showing basic ZT images (non-FATZ);
- reading/showing FATZ-file with 9th byte 00;
- rendering a frame based on HEX values - which I just used in an experiment where I rendered the background for the drink stand.

On my list:
- figuring out the first part (animations), then add proper rendering

- export to png
- import png, create simple ZT image  + .pal-file

- now, the thing which would be new: the user should be able to determine the order of the colors in the palette before they're written out. The user will also be able to create a 8 and/or 16 color palette. This should, after all those years, allow for the color replacement ability.

- batch processing, where a series of PNGs get converted to ZT graphics or the other way around.

dr rick

wow! i just knew this was going to be exciting! I will have to read it multiple times to make any sense out of it, but if the outcome is an ability to make buildings that can be colour changed, that would be great.

Please remind me (whatever happened inside my head a while back seems to have deleted the relevant information), can we make researchable buildings?
Dr Rick<br /><br />How does that work?

Jay

Although we can create researched buildings, they would be hacks and would conflict with other researched buildings of the same type. So we avoid them. Sometimes people want to make researched buildings so that it can show an icon for a program, such as a "Birds of Africa" icon. But instead of creating a researched building just for that purpose, it would be better to show that icon instead of the generic building that is shown in the top left corner of the building info window in ZT.

dr rick

Dr Rick<br /><br />How does that work?

Jeff

I'm actually still surprised, with all this information that was available, especially with that last part about the ZTAF-files, that no one simply improved upon ZOOT.

If successful, I hope to be the first to release that type of building. Not sure if it will be something of my own or a co-project. That would make for another "first" after all those years, after the very first custom tank filter for MM for anyone (which was actually much less challenging). Soon after that, I am planning to release my tool, and maybe the source code. Not sure about the code though.

dr rick

i can understand why you might be reluctant to release the code, but if we had the code for ape and zoot we would have been able to accomplish far more than we have, so my plea would be, please release the code with a very clear instruction that anyone who releases an altered version makes very clear homage to you and your work!

i am very good at graphics so if you would like to work together on a first release i'd be delighted and honoured to help...

jay massively improved zoot in particular ways that the designers of the time (me included) were asking for - zoot 1.1 is brilliant at doing what it does - stable and virtually unlimited in its capabilities within its design parameters.
Dr Rick<br /><br />How does that work?

Jeff

Credits go to MadScientist for creating ZOOT, which is an amazing program, and Jay for the elaborate explanation on the ZTAF-files

The requirement for color replacement will be: a graphic with 16 clearly colored pixels in the right 'darkness' for replacement (eg pink) and probably another 8 in another color which isn't used in other parts of the graphic. But I'll see.

dr rick

so is that 16 different brightnesses of pink? or 16 pixels all the same? I am so literal I have to ask for clarification of almost everything :duh I'm really interested in this development as I had been wondering if we knew how to do this as I was working on a couple of new buildings which started out with red roofs and now have sea blue roofs but would have been an obvious candidate for colour changeable roofs
Dr Rick<br /><br />How does that work?

Jeff

#38
It's a recommendation, but: just 16 pixels of any 'same' color preferably. You will manually need to select the color sets of which the color will be replaced. You could theoretically pick all sorts of colors, but it might be easier to use just shades of pink for example.

It should just be a color which you generally don't use in the image itself if you want to make it easier for yourself.
If your building doesn't contain any blue except for your roofs, you could also just have 16 different types of blue which will be replaced in any color by ZT1.

So in your case: if you manage to limit your buildings to 16 types of blue (maximum, less is not really an issue), it should be fine.

Update: my tool can open and render files like the restaurant, and its palettes.
It will also allow you to just open color palettes.

One complication I didn't think of: for example, the drink stand and restaurant use one main palette for idle and used animations. So you might need to use the same animation for a building in use at this moment. I'm not sure yet where ZT1 checks for the .pal files which are related to the color replacement (color.pal, 1.pal, 2.pal). I'm hoping it just looks in the same directory. Then we can have 4 palettes for "idle", and 4 other ones for "used". This should make it easier for us.

Dr Rick, here's an example of what I mean. I loaded the "used" restaurant, which my tool can render completely. I've also opened up the two separate files (1.pal, 2.pal).
In this example, you can see how Blue Fang used grey and blue as the colors which are replaced.




With this tool, I also looked at the guests. Most animations are indeed some sort of reddish shirt and purple pants. Those colors are defined in for example shirts.pal and pants.pal (16 color palettes). These colors are replaced by the colors in the palettes specified in guests.ai . The index for these colors is what triggers the color replacement.

Unsupported at this point: icons. I need to look into the format. It's also similar, but different, and I need to figure out how to detect the differences and some other stuff (blank lines).

dr rick

wow!  :fireworks

OK, seeing that is very helpful. So the range of blue and grey tones (colours not used anywhere else except the colour change regions) are the ones that zt knows it can change to colours defined in other palette files...

so is there one standard zoo tycoon-wide set of colour change pal files to give the range of colours to which you can change it, or is there a set of defining palette files unique to each object?
Dr Rick<br /><br />How does that work?

Jay

Quote from: dr rick on January 14, 2015, 04:07:47 AMif we had the code for ape and zoot
...
jay massively improved zoot

We do have the code for Zoot, which is how I was able to improve it. The code is available at DG:
http://www.ztcdd.org/DG/index.php?topic=4773.msg18198#msg18198

As that post says:

QuoteI would like to thank Madscientist for creating Zoot and for making the source code available. Even before the changes I added, to me Zoot is the most important utility to be created for Zoo Tycoon, even more important than APE itself. From my perspective, Madscientist will always be recognized as the creator and most important contributor of Zoot.


Quote from: dr rickso is that 16 different brightnesses of pink?
...
so is there one standard zoo tycoon-wide set of colour change pal files to give the range of colours to which you can change it, or is there a set of defining palette files unique to each object?

As Jeff mentions, he needs some way to say which colors in an object should be put into color slots 232 through 255. So that is why he is saying there would need to be 24 colors that are not used elsewhere in the images. That is just the approach he chose. Whatever 24 colors are used, although those will be the colors shown in Zoot and APE, those might not be the colors that will be shown in ZT. I attached 2 images showing which colors will be used in ZT. The first image, colors16.png, shows the colors that will be used for color slots 232 through 247. If a person clicks on the blue button in the color replacement screen for the first replaceable part, ZT will use the 16 colors shown in the blue16 row for colors 232 through 247. If a person clicks on the yellow button in the color replacement screen for the first replaceable part, ZT will use the 16 colors shown in the yello16 row for colors 232 through 247. The second image, colors8.png, shows the colors that will be used for color slots 248 through 255. If a person clicks on the blue button in the color replacement screen for the second replaceable part, ZT will use the 8 colors shown in the blue8 row for colors 248 through 255. If a person clicks on the yellow button in the color replacement screen for the second replaceable part, ZT will use the 8 colors shown in the yello8 row for colors 248 through 255.


Quote from: JeffI'm not sure yet where ZT1 checks for the .pal files which are related to the color replacement (color.pal, 1.pal, 2.pal).

Concerning the ".pal" files, ZT does not use 1.pal or 2.pal. It also does not need color.pal if the ".ucb" is changed to use the original ".pal" instead of color.pal. I attached a user made "Blue Stage Door" to show this. It is similar to the in-game stage door but is blueish instead of whitish for the concrete. It also defaults to a light blue frame border and a gold curtain and star. It allows color replacement in-game. Of course, since there is no tool yet to allow making the needed ".pal" file, I had to make the ".pal" file manually.


Quote from: JeffUnsupported at this point: icons. I need to look into the format. It's also similar, but different

In-game icons should be the same as the simple FATZ format where the 9th byte is "00". In-game icons do not use transparency. So their i.pal file does not have the transparency color in it. User made icons have to have transparency only because APE and the current Zoot assume the top left pixel represents transparency.

Jeff

18
#41
Well... I'll have to check. I was able to read things like the restaurant's graphics, but for the icon, my program got stuck. I'll have to look into it if it's a bug in my rendering or a minor difference in those sort of graphics (which would surprise me).

I'll also have a shot at the shadows you mentioned (are you referring to the 's'(subswi) folders of MM animals?) and what I'm currently missing about guests and color replacement (the colors for animals which attack the guest, look off. If you use Zoot , you should see what I mean if you take a look at the animation of a guest being attacked by a grizzly. It's greyish instead of brown. So some form of color replacement is also applied to the bear in the guest animation, although I missed it yesterday where it's defined.)

Hm, I was assuming that ZT1 knew which parts to replace by reading those palettes.

One feature I'll add (most likely tonight) is to see a preview of color replacements in my tool. I'll change the name of the temporary title "Zoot .NET" to "ZT Studio" or something, to avoid confusion between the programs.

".ucb"? User-created building? I didn't know you already managed to create something like that manually! Great! :)

Update:
- it looks like the issue with icons seems to have been something random.
- ZT Studio can show a preview of color replacement. Steps: select building graphic (eg restaurant), pick one of the color palettes ZT1 used (e.g. blue8.pal, blue16.pal)
- ZT Studio renders the Beluga's shadow perfectly - I'm assuming Jay is referring to another type of shadow?

Also... What exactly are the x/y-coordinates in the .ani file referring to?


Looking at the guests and the grizzly animation. Interesting in guests.ai. grizzlyf = grizzlym (animations).

[BehaviorSet\bCaughtBygrizzlym]
; caught by male grizzly bear
f = fPlayWithSound(grizzlym, bear_roar)
f = fPlay(getupall)
f = fShowPredator()

[BehaviorSet\bCaughtBygrizzlyf]
; caught by female grizzly bear
f = fPlayWithSound(grizzlyf, bear_roar)
f = fPlay(getupall)
f = fShowPredator()

grizzly.ai:

[m\BehaviorSet\bCaughtGuest]
; the time of animation below should match bCaughtBy in guest
f = fPlayTime(stand,4)

The stand animation is not of a  bear standing *up*, but just standing there. So no idea why it would need to match "bCaughtBy".



Also, unrelated, it's interesting to see they use quotes here:

[m\BehaviorSet\bChasePrey]
f = fMove(prey,0,"run",68)

Jay

#42
Quote from: JeffI'll also have a shot at the shadows you mentioned (are you referring to the 's'(subswi) folders of MM animals?)
...
- ZT Studio renders the Beluga's shadow perfectly - I'm assuming Jay is referring to another type of shadow?

The beluga shadows use the simplest format and are not a problem. The dolphin shadows are an example that causes problems. For the dolphin/m/ssurfswi views, those are supposed to be the shadows when the dolphin swims at the surface in a tank. They cause APE/APExp to crash and Zoot cannot display them. Looking at the bytes for that SE view, the 2 bytes representing the height of the image are "20 80", which reversed are "8020" in hex. When converted to decimal, that would either be 32800 or -32736, neither of which would be good values for the height of an image, which is why it causes problems for APE/APExp and Zoot. I have not looked to see if that highest bit can simply be ignored in Zoot, making it "0020" in hex instead of "8020" in hex. Graagh believed that highest bit being set tells ZT to use a different type of format for the shadows, but he may have just been guessing. It certainly must tell ZT something. But it is currently unknown if that is something we need to take into account.


Quoteand what I'm currently missing about guests and color replacement (the colors for animals which attack the guest, look off. If you use Zoot , you should see what I mean if you take a look at the animation of a guest being attacked by a grizzly. It's greyish instead of brown. So some form of color replacement is also applied to the bear in the guest animation, although I missed it yesterday where it's defined.)

You are using the wrong combination of grizzlym and man.pal. You should use the most current of both. The most current of grizzlym is in ZUPDATE\global01.ztd and the most current of man.pal is in XPACK2\global05.ztd. When more animals were created for the expansion packs, more colors were needed in guests/man/man.pal to have those expansion pack animals attack the male guest. But they were limited to 256 colors total. So they had to redo previous animal attacking male guest animations. The color replacement is only for the man in the animation, which would change the color of the clothes and hair to match those of the man being attacked.


Quote".ucb"? User-created building?

Yes, ".ucb" stands for User Created Building. We no longer use ".ai" files for buildings or anything else that use "bldg....cfg" files. We use ".ucb" files for buildings, vending machines, rides, games, shelters, toys, trash bins, scenery with sounds, and, as shown above, for scenery with color replaceable parts. The ".ucb" has the same contents that the ".ai" would have. The advantage of the ".ucb" is that we do not need a "bldg....cfg" file.


QuoteAlso... What exactly are the x/y-coordinates in the .ani file referring to?

ZT might not use them for typical animations. The reason I believe that is because APE does not set those coordinates when someone loads animations into APE for an existing view. Those coordinates are just a copy of what was used as the base animal or object. ZT did use those coordinates when displaying icons, but the expansion packs changed how those coordinates are used. In the original ZT, before we had Zoot, I changed those coordinates for icons I wanted to display. Although that worked in the original ZT, the icon positions changed in the expansion packs. So now, we use the same coordinate settings for icons that are used for in-game icons, when our icons are the same sizes. When I have to create an ".ani" myself for other graphics and I feel the positioning is critical for what I am creating (such as cliff walls), here are notes I created for setting them: 'The x0,y0 in ".ani" files appears to be the location of the center point touching the ground for the largest image, though with minus signs in front of the numbers. When there is a choice, use the point that you get to first along the bottom edge from the left. x1 = image width + x0. y1 = image height + y0. The image width and height might be for the canvas rather than the actual image.'


QuoteI haven't found a grizzlyf folder yet. Looking for it, although it might simply not exist?

No, there is no grizzlyf folder. All animations where a guest is caught by an animal are only for male guests. They probably felt it was not worth the effort to create more animations for something that should not happen often.


Quotegrizzly.ai:

[m\BehaviorSet\bCaughtGuest]
; the time of animation below should match bCaughtBy in guest
f = fPlayTime(stand,4)

The stand animation is not of a  bear standing *up*, but just standing there. So no idea why it would need to match "bCaughtBy".

The animal animation is turned off while the animation from the male guest is turned on, which shows the animal attacking the male. So in that sense, it does not matter what animation is used in the bear ".ai" at the time. It is the time that is important. They want the bear to stay inside its "bCaughtGuest" behavior set until the male guest animation finishes playing. Once the male guest animation finishes, though, the animal animation turns back on. So that is when they want the bear to be doing its "stand" animation.


QuoteAlso, unrelated, it's interesting to see they use quotes here:

[m\BehaviorSet\bChasePrey]
f = fMove(prey,0,"run",68)

Those quotes are not necessary. I remove them in animal configuration I do. There are a number of inefficiencies like that in the configuration. I took care of them in APExp 3.2.

Jeff

Quote from: Jay on January 15, 2015, 03:40:46 PM
You are using the wrong combination of grizzlym and man.pal. You should use the most current of both. The most current of grizzlym is in ZUPDATE\global01.ztd and the most current of man.pal is in XPACK2\global05.ztd. When more animals were created for the expansion packs, more colors were needed in guests/man/man.pal to have those expansion pack animals attack the male guest. But they were limited to 256 colors total. So they had to redo previous animal attacking male guest animations. The color replacement is only for the man in the animation, which would change the color of the clothes and hair to match those of the man being attacked.
I was using man.pal + grizzlym from "global.ztd".  So I thought I was using the original animation - so I'm wondering, if you only installed ZT1, what that did look like - or was the image/bear color messed up in ZT1 for the attack animation? Or was the file replaced somehow later by its expansion packs? (which I generally thought would only "update" files by adding new versions in new folders). With the files you mentioned, it works flawlessly. But I'm still puzzling at the "original" files or how it was done....

Thanks for all your notes Jay! I was already wondering why Zoot also doesn't seem to do anything with the .ani files.





dr rick

i'm looking forward to having a play with ztstudio, although it might take an awful lot of help to get me to understand how to use it because my brain does not work properly any more (legacy of three weeks on a painkiller that cut off a load of synapses that it was not supposed to).

if you do want me to come up with the graphics for a new building for your first release, just let me know and i'll start thinking about it - this deserves something really special!
Dr Rick<br /><br />How does that work?