Romhacking => Newcomer's Board => Topic started by: ArugulaZ on July 20, 2021, 11:22:49 pm

Title: Hook'ed on Palettes
Post by: ArugulaZ on July 20, 2021, 11:22:49 pm
Here's my dilemma, if anyone would care to offer their assistance. Recently I started playing the video game adaptation of Hook on both my 16-bit mini consoles, the Genesis Mini and the Super NES Classic. The Super NES game is objectively better, with a more symphonic soundtrack and a richer color palette, but the Genesis version ain't too shabby either. Core did a decent job of porting Ukiyotei's game over to Sega's hardware... it's not the train wreck Super Smash TV was on the Genesis, that's for sure.

There's just one thing I can't handle about this conversion. Peter Pan is a dingy yellow in this game. He's not yellow. He's never been yellow in any movie or television show I can remember, and seeing him in yellow nags at me like a scab begging to be picked. I want him GREEN, and after following a YouTube tutorial I was able to restore him to that color. Unfortunately, now everything else that was yellow is also green. Green apples, green cherries, green pirate ships, green hair on The Lost Boys, green gems inside treasures (which are oddly still gold)... it's like Saint Patrick's Day at Neverland.

I know how to change the palette for Peter Pan specifically, but what about all these other sprites? How do I find the addresses for their individual color palettes and change the values so that the cherries are red, without changing everything else to red in the process? The guy in the YouTube video didn't specify how to change the colors of sprites individually... only the lead character.

If you have any suggestions (helpful suggestions, not "bite me" or "just play the Super NES game and stop being so picky"), please let me know. Thanks.
Title: Re: Hook'ed on Palettes
Post by: [Unknown] on July 21, 2021, 01:29:10 am
The trouble is that there are only so many palettes with only so many colors on the Mega Drive (and indeed, most tile based systems.)

It can have 4 palettes of 16 colors each, the first of which is transparent for objects like you're describing.  A given tile (8x8) must all fit within a single of these palettes, meaning each 8x8 pixels has only 15 colors to choose from.

If the palettes loaded have a green color, you can potentially change the tile to reference that palette and change the graphics to use those colors.  This might be tricky if that palette is used for animated effects or not always on screen.  You're best off using a palette the game keeps "fixed" if possible.

If no loaded palette has a green color, you'll have to sacrifice another color to get green.  That means something will have to change to green - and again, you'll need to make sure the palette you use is common throughout scenes where Peter Pan shows up.

There are some tricks you can do with changing palette entries between scanlines to "get" more colors, but they're more complex, and you'd still be sacrificing a color on that scanline, I think.

Title: Re: Hook'ed on Palettes
Post by: FAST6191 on July 21, 2021, 07:11:13 am
Was quite familiar with the SNES vs megadrive Aladdin debate but this is a new one.

As above the older devices are not like a modern PC and you only get a limited selection of colours to make up a palette from, many pulling double duty for multiple items. Some later devices might still be limited but have enough in some modes that devs can afford to do multiple gradients and still have space left over, however 15 colours (plus transparent) tends not to have such luxuries.

You then have three choices in editing things, maybe four depending upon how you approach it.

So you changed the colour in the palette the game uses but found as you say it also does for a bunch of other things

1) You edit the sprite instead.
Sprites outside of game and watch are little more than a grid of pixels referencing a palette, think paint by numbers. This means you can change the number it says to look up to paint or you can change the list of what colours the numbers decode to. Right now you are doing the latter.
You mention the things also changed. If for some reason the sprite is not going to be enough you can change all of them. Tedious vs just doing it for one item but if it is what is necessary, to say nothing of the more radical -- Peter Pan might never be caught dead in yellow but the rest of those can be other colours more easily.
That said "which are oddly still gold". Sounds like there might be a secondary yellow in whatever palette it is, albeit possibly a darker one if it is more a gold stand in. Personally I would see about cannibalising that.

2) You change the palette it references (ROM level), granted if everything else uses the same pointer then you are back where you started. Probably more of a thing for later devices where storage and graphic space is so abundant I occasionally see every frame in an animation loop (basic small window reaction shot in one example I have) have its own separate palette.

3) You change the palette it references (RAM level). I am a bit hazy on megadrive graphics modes right now but generally the sprites have their colour choice governed by the same thing that governs location and whatever effects it might care to apply. Tell it to use the another palette option that is more amenable to editing, or suitable for this. Might need to bring in some 1) and edit the sprite if the colours are a different type.

4) You see about changing the game using some kind of fancy trick or workaround. I am not so familiar with the megadrive options here, and will involve fiddling at code level.
Title: Re: Hook\'ed on Palettes
Post by: ArugulaZ on July 21, 2021, 09:52:44 pm
Thanks for the information. Here's what I can glean from the tools I've used... there are 64 total colors in the palette, minus the three transparencies. The last row of colors in the list are for sprites, and sprites cannot take colors from the first three rows, which are reserved for backgrounds and foregrounds. Do I have that right?

I wouldn't mind changing the tile data for the sprites. Believe me, I have the time for it. I just don't think I have the necessary tools. I have graphics editors, but they're confusing, with an odd default palette that makes all the tiles look like random jumbles of off-colored pixels. Is there a tile editor better suited to the task, or at least a way to import color palettes from other programs so the tiles I'm viewing don't look like indecipherable digital barf?

I remember waaay back in the 1990s, NESticle had a way to alter video game graphics on the fly, while you were playing them. It was hugely flexible and borderline foolproof, and I regret that there aren't any emulators that let you screw with Genesis games in a similar way. (Was this a possibility with GeneCYST, the 16-bit sequel to NESticle? I should check and make sure.)

July 22, 2021, 12:25:52 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Okay, I'm seeing a pattern here. This is how the palette looks now that I've changed it...


Notice how the third and fourth rows share colors, from columns 2 to 6. These are supposed to be skin tones, but they're also used in a pinch for objects like the treasures. Some characters (especially ones wearing blue clothes) use that third row palette and look fine; fairly similar to their Super NES counterparts. The fourth row palette belongs to Pan, but it also belongs to a lot of sprites (fruits, treasure, spiders, bats, some enemies and Lost Boys) which would be better suited to the more versatile third palette. Fruits could be red as you would expect, treasures could have inset rubies and sapphires, the Lost Boys wouldn't have eye-searingly green clothes and hair, etc.

I think Fast's third suggestion, changing the palette in RAM, would be my best bet. Heaven only knows how I'd do that, though. I'm also mystified by why Core did what they did; there must have been a method to their madness in making Pan yellow, but it seems like they could have come up with better options and made smarter sacrifices. The Sega CD version of Hook, as I recall, has similar issues, but also has an arranged soundtrack that blows away the Genesis version and even edges out its Super NES counterpart.
Title: Re: Hook'ed on Palettes
Post by: FAST6191 on July 22, 2021, 06:59:51 am
Many tile editors will pull from the ROM, savestates or even some variation on the theme of standard Windows style palettes. Similarly many find it unnecessary for this sort of thing and for a simple edit like this will go for abstraction approaches (so what is purple in the editor is green in the game... edit purples like they are green, because they are. Or go for hex approach, which has the added benefit of not having similar looking or duplicate colours to confuse you).

Tile editors in general are not usually so bad. You open the ROM, set the mode (some systems have multiple methods), set the width/height (usually a fairly standard one for most sprite and background work on older systems, can usually see it in the game or even be told it by the vram/OAM/map/... viewers in debugging emulators. Text being the main exception) and scroll around until you find it. Compression can get in the way (be it actual binary, or things like the legs are reused in another sprite) and there are sometimes changes between it being in the ROM and landing in the RAM but generally not as change is expensive in CPU cycles that could be used for better things. Most changes being limited to things like mirroring or rotating if the baseline console does not have it, though other times the annoyance might be that there are multiple sprites needing editing (mirror a right handled animation of a character and suddenly it is left handed)
If you are good then you can narrow things down ( is for the GBA but the principle is the same everywhere. This being called tracing. I don't know what we are suggesting for a megadrive debugger though and they don't generally have the best reputation in general compared to other consoles and definitely not the PC), corruption is a thing some do, if you know a part of the game does something else (levels, music, text, game code...) then can probably skip that in the tile editor, or try searching for stuff you dumped from VRAM in the ROM.

Back on palettes

Genecyst might have had such options but I did not know much of ROM hacking and programming when I was playing with it some decades ago. That said NES stuff can be a bit different to more software defined things where palettes are cycled around on a whim on later systems which makes certain edits a bit easier for the NES/able to be made more generic such that emulators can usefully be used to alter things.

For the later stuff you tend to work backwards - palettes are usually too small to usefully compress so tend to be left raw. Search for the palette as found in RAM at runtime in the ROM and you will usually find it, if the palette is animated or altered at runtime (often a good way to do changing colours or light-dark pulsing gradients) then find a section that is not and search for that. It is not impossible for a radical change to happen between ROM and palette RAM but it is rare.