An interesting finding

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
Post Reply
User avatar
Mr Sol
Ensign
Ensign
Posts: 46
Joined: Mon Apr 11, 2016 5:44 pm

An interesting finding

Post by Mr Sol »

I was messing with the color palette again and had one idea:

I would extract all the gifs to a folder and then change one ship by importing another model and then extract all the gifs again and see what happens.

I was hoping to find why the palette goes up each time one imports a new ship even if its for substituting a ship already in the game, instead of adding one to an empty slot.

I picked the sovereign, its called HH3 in the ship list under EDIT / GRAPHICS / ADDREMOVE SHIP MODELS. I did exactly as I mentioned, extracting the original gifs to one folder and doing it again after importing the ship to another folder and begun to compare.

The first thing I found was that in the original folder the HH3 model uses 3 textures: hh3_a, b and c. The second thing was that in the after importing folder the hh3_a.gif texture was missing but both folders had the same number of files: 299 textures. Obvious conclusion: Someone had its name changed. Looking again I found a new texture by the name bbk_a.gif with the same image, or one very similar, to the texture of hh3_a.gif.

I saved the game and ran it using a saved file Ive made with all the ships strategicaly positioned for doing tests provoking a combat. I selected the sovereign and there was it in combat screen perfect, as expected. I closed the game.

Now I was thinking: How do I check if the sovereign hob file is using this texture and whats being made of the other 2?

I checked the textures under EDIT / GRAPHIC / TEXTURES and found that bbk_a.gif is using a palette number different from the hh3s textures, what is very interesting!

Then I just noted there is a place to check what I wanted: EDIT / GRAPHIC / HOB FILES. I looked for the hh3 model and found out that it is splitted in 3 files: hh3_a.hob, b and c. What I found to be interesting is that hh3_a.hob was pointing to the bbk_a.gif file, and that this hob was moved to the end of the list, different from the others in alphabetical order. hh3_b.hob and c dont point to anyone, so I just found that hh3_b.gif and hh3_c.gif had just become two files ocuppying space in stbof.res.

That is the reason why one import a new ship and the palette number goes up. A new texture is imported (duh) and the old ones stay there. The palette number dont go down with trimming because of these spare textures. If you search for them and delete then do the trimming the number of palettes went down one, returning to the number it was before importing the ship in the first place. This means that if you dont mind having some work doing a search for the right files to delete you wont need to do all the palette reduction proccess unless you want to add more than 7 ships to empty ship slots. For just changing models there is no need for any palette messing, just do as I did and remove the extra, useless textures then trim the palette.

Im not sure if I just discovered the wheel because I didnt see anyone talking about this in the foruns up to now but then the info is here now if you didnt. Hope it serves anyone.

Hugs!
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: An interesting finding

Post by thunderchero »

Correct, UE does not effectively add ships. It is cleaner if ships are added manually. This way you can rename the files before adding them.

ship packs have all the info needed to add manually, but you would need to assign everything and add proper code to phaser slots.

required changes to add manually;
1. rename files
2. assign gif to hob
3. register texture to use own palette
4. add new code to trek.exe for phaser slot from "phaser" file
5. setup ship in shiplist

if model uses basic code you can also use "temp" slot. "Optimizing usage of TMP slot"

viewtopic.php?f=150&t=2272#p32044

also the unused textures can be "removed" from palette list. (files will still be in stbof.res just not on palette list.
User avatar
Mr Sol
Ensign
Ensign
Posts: 46
Joined: Mon Apr 11, 2016 5:44 pm

Re: An interesting finding

Post by Mr Sol »

And that would allow me to add ship models from the armada I & II?

What would be this new code for trek.exe?

What if every single ship have a unique size?
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7936
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: An interesting finding

Post by thunderchero »

Mr Sol wrote: Thu Jun 14, 2018 8:05 pm And that would allow me to add ship models from the armada I & II?
un-edited models from A1, A2 no, yes if you are able to convert models to hob
Mr Sol wrote: Thu Jun 14, 2018 8:05 pm What would be this new code for trek.exe?
not new, but edited phaser slots (edited when new models are added)
Mr Sol wrote: Thu Jun 14, 2018 8:05 pm What if every single ship have a unique size?
if using "temp" slot it uses a single scale value for all ships that use the temp slot. (ships must be scaled during conversion to hob)
User avatar
Mr Sol
Ensign
Ensign
Posts: 46
Joined: Mon Apr 11, 2016 5:44 pm

Re: An interesting finding

Post by Mr Sol »

Thunderchero, I was just looking at the trim palette button and occurred to me that the limit of palettes is a signaled char.

Cant one of the coders here try to change it to an int variable with the hex editor? That would definitely solve the palette limitation issue, allowing to have up tp 65535 palettes.
Post Reply

Return to “General Modding Information/Questions”