News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: How to change the color palette assigned to a sprite? (SMB8)  (Read 1154 times)

CryinOnion

  • Jr. Member
  • **
  • Posts: 65
  • "Once upon a time, a terribly sad onion ..."
    • View Profile
How to change the color palette assigned to a sprite? (SMB8)
« on: November 01, 2020, 08:21:42 pm »
Greetings from Barcelona!

After a pause (which I needed) from my current project https://www.romhacking.net/forum/index.php?topic=31354.0 it's time to get down to business!

The graphic changes on level 1 and 2 are ready. The problem is that when I started working on level 3, I had to discard many good ideas because most enemies share color palette with the character.

So, the question is: Could someone teach me how to locate the color palette assigned to a sprite and change it? Depending on the answer, I will choose one approach or another to continue the project.

sics

  • Sr. Member
  • ****
  • Posts: 371
  • Contact me!
    • View Profile
    • Deviantart: Terwilf
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #1 on: November 01, 2020, 08:42:53 pm »
If you do not have technical knowledge about the system, the easiest way to change the assigned palettes is to look in the rom data for the following data "A9" + "The assigned pallet number of the object", which would be 00, 01, 02, 03

For example, in the PPU viewer we can see that the palette assigned for the main character is the fourth palette, so you should search: A903

< look here!

The idea is to go replacing the palette number until you see a change on the screen and that's it when you find it, reload the rom and replace it definitively :thumbsup:

« Last Edit: November 01, 2020, 09:12:36 pm by sics »

Cyneprepou4uk

  • Hero Member
  • *****
  • Posts: 576
  • I am the baldest romhacker
    • View Profile
iromhacker.ru - NES ROM hacking tutorials for beginners. Please use Google Translate browser extension

CryinOnion

  • Jr. Member
  • **
  • Posts: 65
  • "Once upon a time, a terribly sad onion ..."
    • View Profile
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #3 on: November 04, 2020, 10:21:32 pm »
Thanks for your help! I spent a whole night trying to figure out how to put it into practice, but I think I've got it. Let me explain:

First I tried to do exactly what you suggested: Search for matches with the value A9 03 and modify it looking for any change on the sprite.

This, actually only works with the main sprite, and only in one of the matches with the value.

Anyway, when I checked that the palettes were indeed assigned with a value from 00 to 03, I thought: If the rest of sprites work the same, I ONLY have to check all values '03' until I locate the one I want to modify.

A system as you can imagine, horribly slow, but I still found the value I was looking for. Actually, the first sprite I want to modify uses 4 values '03' for each frame.

At this point something happened that disoriented me: I managed to change the sprite's color palette when walking to the left, but the sprite still used the original palette when walking to the right!

I continued trying for hours to modify values '03' without result. After discarding practically any other idea, I investigated further the area where I made the palette modifications... and it turns out that when the sprite walks to the right it uses a '4' in front, instead of a '0'. In other words, the values I couldn't find were in the same place with another name...

At least I managed to modify the first sprite, and I think that repeating it now that I understand better how the values are grouped I will be able to do it faster.

Still, if you can think of how I could improve my searches, I'm all ears

sics

  • Sr. Member
  • ****
  • Posts: 371
  • Contact me!
    • View Profile
    • Deviantart: Terwilf
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #4 on: November 05, 2020, 02:43:02 pm »
Sorry, I didn't use that method for a long time and I forgot a few things  :P

These are the positions a sprite can be in
0X 4X = The ones you know
CX 8X = The same thing but face down

On the other hand, it would have been convenient for you to look for a fragment of the sprite of the character that you wanted to edit first and review around that area or directly delete lines of the hexadecimal code to break things, if you break something wrong you can undo it until you get to the place you really wanted to review :thumbsup:

CryinOnion

  • Jr. Member
  • **
  • Posts: 65
  • "Once upon a time, a terribly sad onion ..."
    • View Profile
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #5 on: November 05, 2020, 06:31:10 pm »
Quote
These are the positions a sprite can be in
0X 4X = The ones you know
CX 8X = The same thing but face down

In any NES game or in this specific one?

Quote
On the other hand, it would have been convenient for you to look for a fragment of the sprite of the character that you wanted to edit first and review around that area or directly delete lines of the hexadecimal code to break things, if you break something wrong you can undo it until you get to the place you really wanted to review

Sounds like a good idea. I use the same system when looking for parts of the background or sprites that are difficult to locate in the tile editor, removing large portions until the sprite is affected.

One question: I thought I understood once that there are specific sections of code that are usually dedicated to a task. Knowing where these areas begin and end would greatly reduce my search field. For example, I wouldn't start searching from the very first line if someone told me "From the value xxxxxxx to the value yyyyyy is usually found the information related to sprites".

Anyway, the information you've given me so far is being very useful, thanks!

sics

  • Sr. Member
  • ****
  • Posts: 371
  • Contact me!
    • View Profile
    • Deviantart: Terwilf
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #6 on: November 07, 2020, 01:33:39 pm »
In any NES game or in this specific one?
At least in all the games I've ever worked on

One question: I thought I understood once that there are specific sections of code that are usually dedicated to a task. Knowing where these areas begin and end would greatly reduce my search field. For example, I wouldn't start searching from the very first line if someone told me "From the value xxxxxxx to the value yyyyyy is usually found the information related to sprites".

Sorry, I am self-taught, so practically everything I know I have learned directly by manipulating the ROMS, what I can say is that there are always patterns that are repeated, both in the same game and in general.

Sometimes finding out where something starts helps you find its pointer and consequently its pointer table, other times a visual search with DjinnMapper.1.5. it is enough, there are also occasions where a game has several versions or has been hacked so many times that it is enough to use a file comparison program like HexCmp2 to find its most important sectors.

In short, there are many more efficient ways to speed up the hacking process, and the main one is to think carefully about how to start, since in addition to the classic methods already established there are many creative solutions that are waiting to be discovered :beer:

CryinOnion

  • Jr. Member
  • **
  • Posts: 65
  • "Once upon a time, a terribly sad onion ..."
    • View Profile
Re: How to change the color palette assigned to a sprite? (SMB8)
« Reply #7 on: November 10, 2020, 12:32:30 am »
Interesting. I will try to apply some of your advice. The truth is, I have a lot of work ahead of me (and projects between hacks and my Youtube channel to fill 2021 XD). Any advice that will speed up my work is welcome!