PalMod: color hacking for fighting games

Started by Preppy, July 11, 2020, 03:30:12 AM

Previous topic - Next topic

Preppy

> Is there an open link or is it more confidential ?

I'll DM you - they're doing pretty cool stuff there. :)

> If you can now easily add automations for other games, maybe you could add one for the tinted (shadow) palettes in 3S which are all over the place and, as far as I could tell, only replicable using ESN's site ?

Which ones?  I can only think of portrait.

> Same with Twelve's Xcopy palettes > generating each char's xcopy from twelve's 7 palettes would be really cool.

That's a little more complicated in that the xcopy's are over in the encrypted rom 10 and the user is doing color modifications in rom 51.  It'd be doable as a project, but probably something I'd shy away from for now.  The code presumes that linked modifications are in the same rom for now. :)

alien nose job

Hey Preppy,

Thanks a lot for the links and the reply !
I started looking into the hacking of 3S and RE and it does look interesting, I think I noticed some small task I could tackle... I'm just a bit hesitant to commit right now.
I'll mos def have some free time in the coming months, but not just yet.  :)

For the tinted palettes every single item in the game except for the characters and health bar portraits have a tinted/shadow duplicate.

Namely :

- the backgrounds... it's used for the shadows under the chars and the super art freeze (huuuge amount of palettes to edit and manually enter every time you want to replicate a change you made in the "normal" background palette)

- the portraits, as you noted

- the icons from the select screen (I think they use the same palette as the next item below, I list it just to be thorough)

- the icons from the warrior path (with the white/grey gradient behind the character icon)

- the win / loose backgrounds (I'm a few versions late as I lacked time this past month, but last time I checked, palmod was still missing the grey one used for 12. I found the address in my old files [0x0070B480 to 0x0070B520], it's a bit too wide, but that did the work... note that I was too lazy to try and find the tinted version of it...)

- the select screen background the blue arrows and cursor selectors (not 100% sure for the last two), the final score font, icons, special points (I think), etc...

Most get activated when P2 hits start.

To replicate the tinted palette here is the only method I'm currently aware of, maybe there is some mathematical way that could make it easy, but I never could figure it :

1) I open my freshly modified .png image in photoshop (portrait, background, icons... either edited in palmod or in photoshop, for backgrounds, mostly)

2) I select everything on this image except for the uniform background colour

3) I create a new layer atop, in multiply mode and fill it with a uniform mid-grey (RVB : 124, 124, 124)

4) flatten and save as .png

5) go to ESN's and download the desired item in one form or another (I mean normal image, or tinted version, with the matrix palette or any other available, it doesn't matter)

6) in photoshop I paste my edited greyish item on top of ESN's to match the exact pixel width or image position/formatting, this will allow to re-import it on the site (for Icons we did a full page with every icon, not individual images for each char icon as they are in palmod now)

7) re-import the image on ESN's site to get the colour code from the image... provided that part of the site still works

8 ) sometimes I have to the change the header that will not match palmod's (Remy's portrait)
Or most likely, if we're speaking of something big like a background, or the whole icons sheet, I have to paste it on a text file, count separate 256 or 512 chunks of characters, add the needed header for palmod code aaaaaaaaaaand paste it back in palmod, block by block if we're talking backgrounds. For the icons I also had to figure which code bit was which icon as we used a sheet with all icons on it and the code generated on ESN's will have all icons one after the other.

A bit cumbersome, isn't it ?

If you could figure how to easily replicate the colour modifications that happen when you add a mid-grey layer in multiply in photoshop and automate the process, that would be great.

Of course some people will want to do something more with it, like playing a bit more with the colour saturation, or whatever, but since your script is optional I think it's more likely that it would save every one a lot of time and stale effort.

Twelve is another battle, no rush for anything  :)

Preppy

That's interesting.  What I show in palmod usually is what's actually directly in the game roms: I don't show calculated colors or previews.  If the shadows are a run-time filter, they wouldn't be modifiable.  Are they saved in game data...?  I have the Tinted data for the 3S portraits, but I'm currently unaware of any of the other tints/shaded versions being static.  I'd have to do something funky to show the shaded/tinted versions alongside the normal version, and it seems like it would be unique to 3S. :\

alien nose job

Hey Preppy,

Thanks for your reply.
Sorry, I'm not sure I made myself clear, or maybe I don't understand something in your answer (my technical english vocabulary is a bit limited).

Short version :
Everything is already into palmod, you have all the adresses and everything ripped clean for the previews.
I don't think there is any real time filter effect in 3S.
It is pretty much like Cyclops intro in MVC2, but there is only one secondary pal.
I thought that in the same manner you could automate the creation of the greyed out palette of the different assets.
The only thing to clear is by what amount you should grey the original image to correctly replicate Capcom's work.

Long version :
Every bit of graphics I mentioned has two separate palettes which are called in certain situations.
e.g. :
the select screen background or win/loose background, have their regular palette + a shadow palette that is called when P2 presses start.
This is replicable in photoshop by adding on top of the regular palette image a multiply layer filled with medium grey (RVB 124,124,124).
It may be replicable manually in palmod, moving the R,V,B sliders to the left by a specific amount, to grey them out.
But I never managed to do it. That's why I took time to explain the process in photoshop, because it replicates exactly what Capcom's artists did.

The only thing that stands out in 3S is that the super art greyed out stage background is actually also used under the feet of  the characters during a match, for their shadow.

Sorry if my previous message was misleading, I tried being clear but it's not easy talking tech when it is not your language.


Preppy

Ah, I believe I understand the request now.  I've implemented most of it as of last night's build (1.77o) for the Street Fighter III arcade games (NG, 2I, 3S, 4rd) by adding in a new internal "blend" option.  With this change, if you have Advanced Settings: Process Supplement Palettes checked, we will:
* auto-generate the Faded (tinted) version of Stages
* auto-generate the Faded (tinted) version of Portraits
* auto-generate the Faded (tinted) version of Character Select Icons
* automatically update the "flipped" versions of Gill to match

I believe that's what you were asking about: it seemed logical enough.  Linking up the X.C.O.P.Y. palettes would involve going cross-ROM, and that's not something that PalMod supports.  Just within the same ROM at that point.

Hopefully that helps.  I think I got the math pretty close to right.  Lemme know if I missed anything. :)

alien nose job

woohoo !

I noticed the update yesterday (but am a bit tied up with work atm).
Thank you very much, that's a greeeeeaaaaat addition.
Plus I didn't even think of Gill's double palette, smart !

Let me check...

I think you got every instance. The only thing that I see missing is the grey win/loss screen used by Necro, but the palmod team missed that one (and we didn't enter them on ESN's).
To edit it on my side, I used this address from my old files :

[0x0070B480 to 0x0070B500]

But I never got around finding the address for the faded version.
It shouldn't be difficult to calculate : it should be the same offset from the faded blue, green or orange as it was offset from the non-faded win/loss screens.

Anyway, that's no big deal and your addition will be a huge improvement.

No problem for X Copy, I get it.

I'm experimenting with Vsav these days (discovered the boss hack and the aesthetic hack and merged the two).
I'll come back to 3S in a while.

Best,


Preppy

Ah, thanks!  Yeah, I found the match pretty easily using PalMod's "areas we don't know about" Extras feature.*

==
Necro Win/Loss Screen BG (Normal), 0x70B480, 0x70B500
Necro Win/Loss Screen BG (Faded), 0x710280, 0x710300
==
is the pair here.  I also found some further Faded palette variants for various HUD aspects that I'll add in for the next build.

*: If you do not have an existing Extras file, PalMod will offer to create an Extras file for you.  It will offer to add the data we already know about to the Extras file either as sorted comments or - much more helpfully - to simply create a file with Extras for all unknown regions of the ROM, optionally bounded by the currently known start of the palette section and/or the end of the known palette section.  So that makes spelunking around much easier than it has been.

Thanks for the tip! :)

alien nose job

#27
Hey Preppy,

Thanks for the update.

I just discovered the newer feature you are currently implementing with the lifebar portraits in 3S !
Great, I never dreamt of having these generated automatically.
I tested with Alex, Chun, Dudley and it seems to work well.


Not sure it is worth mentioning, but as I noticed you implemented this for a few chars so far, I thought it may be WIP...

EDIT ///
I think my first reply was a bit misleading so, here it is, better explained.

Actually, I was asking more of a question.

To auto-generate the lifebar portraits, did you :
1) Stricktly  replicate how it is natevely set in the game engine ?
2) a bit of that, plus some guessing ?

Looking at Chun's shoulders in the palmod auto-generated lifebar portraits reminded me that some of these palettes use colors that are not part of the character's in game palette... e.g. Ryu's face.
I may be mistaken as last time I edited a lifebar portrait was a long time ago, but chances are you may come across this situation when moving onto further characters.

If you had to resort to 2), guessing, do you need a hand at picking the best possible colors in the character's in game palettes ?
In that case, I'd be glad to contribute if it helps.

Anyway, it is already good as is IMHO.

------------------
I left my first message below for completion's sake, but I found it a bit misleading :
------------------

I'm not entierly sure how you approached this.
I mean do you generate the lifebar portraits palettes straight from picking some colors into the in game char palette ? Or is it more convoluted ?

From my memories (and don't take this too seriously as I dropped editing manually these years ago as it was too tedious), I seem to remember that theses lifebar portraits used custom colors that did not come straight from the in game char pal...

e.g. Ryu's lighter skin tone

This may just be me, or maybe at the time I tried this I was a bit too inexperienced.
This may as well be my own edits that tend to enforce volume a little bit compared to 3S base palettes.

Well, upon testing I came across this :
I think Chun's shoulders may not be using the most appropriate pick with you automation (same thing as for Ryu's lighter skin tone) :

In game Chun :


Chun's auto generated portrait :


Chun's manually corrected portrait :


Don't take my comment too seriously, I'm aware I can still fine tune things manually and it already is going to win us a huge amount of time.
Thanks a lot  :)

Preppy

>  as I noticed you implemented this for a few chars so far

lol - yeah, I was leaving for a couple weeks on vacation, so had to stop at Dudley.  In the latest build I have added this logic for everyone.

> To auto-generate the lifebar portraits, did you :
> 1) Stricktly  replicate how it is natevely set in the game engine ?
> 2) a bit of that, plus some guessing ?

Great question!  The second, really. The Judgement palette turns out to be super easy, as they were generally lazier there and just moved colors around.  The HUD portraits as you note involved a bit of tuning on their part that I don't currently know how to generate exactly programmatically.  The HUD portrait logic is fudged: I tried to get close to their logic while avoiding transforms that might not look right.  The source code for this logic is available here:
* https://github.com/Preppy/PalMod/blob/master/palmod/Game/SFIII3_A_DEF.h

The first Portrait update logic in that file is "paletteBuddy_3SAlex_HandlePortraits" on current line 863.  The palette change engine used here has a number of directives possible: I'm mostly using simple copies, but there are some LUM and RGB modifications done here and there as seemed best.  It is very easy to update this logic if we come up with better conversions, but this at least should be a substantial step forward.

The latest PalMod also automatically handles updating the Gill left/right glow palettes.  The shaded shin region colors aren't quite perfect, but again it should at least give people a lot better of a starting point.

The past few days I've also been working on exporting RAWs to HTML+JS.  I'm not sure where I'm going with that yet, but I appreciate the ESN site and wanted to figure out the basic logic for letting users export the previews/palettes to web-usable data.

So yeah: if you have better suggestions/transforms on how to handle the auto-generated palettes, I'm all ears.  It's pretty easy to tweak. :)

alien nose job

#29
Hey,
I hope the holidays have been good.

It's great that you're implementing this into palmod, these are such a hassle to create, this will really make things so much more comfortable.

So far I only tested the 3 first you had done in the previous version, and itwas looking pretty good already.
I just remember the trouble some could be.
I'll definitely have a look at the others.

If it is any help to you, I can look through all of them and give you feedback on which color you could paste from the in game pal (I remember this is not what the game does for some chars, but I'm pretty sure we could come up with something that looks good even without having to resort to RGB and light tinkering).
If there is still a need to alter RGB values or something, I'll also try and provide you an offset if needed, but I'm almost sure it can be avoided.

The general idea would be to alter your code only where it can be improved of course.

The judgement pals looked perfect (for the 3 first chars), no need to touch that.

The only question is how can I communicate the useful infos to you ?
I had a look at your code (funny to see you write silly comments in the margins... of course I do the same on my photoshop layers) but I can't really understand what to do from here.

Here is a proposal, I could post screenshots like this one, showing where to pick and paste.


The goal of the palettes we made, with L_E_T were to try and provide as many different skin tones and fabric types as possible, while keeping the shading believable.

So here, I ran tests on all my Chuns, which seemed like it could be improved a bit, some of my pals are veeery light, some pretty dark and this is what I think works for all of them, more or less after testing this pick and paste pattern.

Tell me if it is any help, if it is, I'll check all the chars.
Otherwise, I'll try and do what you'd want f it's easily explainable for you.

Oh, and btw, I'm curious to see where you exploring ESN's site's logic :)
Actually he wanted to do something like palmod, but you could only edit one color at a time on his first tests, which was not so useful.
It must still be on the site somewhere...
I sent you a PM with ESN's mail, in case you think this could be useful. I don't know if he's still active or if he still checks this address though.

Preppy

Thanks!  I've tweaked it to pull from 35 and 37 for those two Chun-Li color pairs: that does provide a little more contrast.  Here, DM, my email, Twitter, or the PalMod Discord all work. :)

The new build contains a sample HTML export.  It's not superbly functional, but it's a start in the right direction.

alien nose job

Hey, glad this is of help.  :)

I'm leaving for a short time for holidays, then back and forth between freelance projects and some more holidays, etc... But I'll go through all the characters soon and check if anything can be improved.

I'll also go back and compare how that's done on the original game, just to make sure this is the best pick for most cases.

Then I'll send you images like the one above.

Thanks again for the improvements !
I may even try to do something with Gill... I only got rid of the effect as I never liked it, but this is worth a try now that it's easy to edit.

I'm also curious ton see what you're aiming for with the HTML code, sounds great !

best,

Preppy

Updated first post with the ~+30 games we've added support for as of PalMod 1.78.  Other useful additions:

* Support for GiMP (.gpl) and HipPalette (.hpl) palette files.
* Support for CFPL (Central Fiction Palette List) and IMPL (BBTAG palettes) files for use with BBCF.
* Support for auto-generating gradients when you select 3 or more colors and right-click (or use the Tools : Gradient options). You can choose between RGB, HSV, HLS, and XYZ-based gradients.
* "Developer Mode" (File : Load Directory : Developer Mode) for unknown games now allows you to specify multiple files to load at once.  You can have PalMod read the file list sequentially or interleaved.