Professor Neo's Guide for Editing S3K Special Stage Palettes
This guide will make S3K special stage palette editing much easier

S3K hacking has been becoming quite a trend today since the release of a disassembly made for this game, and special stage editing was part of this trend. There are editors out there that edit S3K special stage layouts, but they DO NOT allow you to edit palettes. So people ask themselves, "Is there a way I can edit the special stage palettes?" Well, the only way to edit special stage palettes is to alter hex values using a hex editor, but if you carefully follow this guide, editing S3K special stage palettes will be a whole lot easier.

Tools needed:

Hex editor
MS Paint for all Windows users (I will show you exactly how I do this using Paint)
Notepad (to take note of values and addresses)
In-game screenshot of special stage
S3K or Blue Sphere ROM (you can use the Blue Sphere ROM since it is part of the S3K engine)

Things to always consider when editing palettes:
(If you already know these techniques, then you can skip this -- this is for people who do not know how to edit palettes based on the 16-bit color system)

1. When editing palettes, 2 nybbles (or 0.5 bytes) are always used for every single color. The first nybble affects the B or blue value of a certain color with the second bit as the primary factor. The lower the bit, the smaller the concentration of a primary color and vice versa. The second nybble affects the G (green) and R (red) values in this order. The first bit affects the green value and the second bit affects the red value.
Hint: An object's color is always blue whenever the second nybble is 00. If the first nybble is 00, then the color will lack any concentration of blue.

3. When editing colors in 16-bit format in MS Paint, read from bottom to top since the blue value is listed on the bottom.

4. Remember this order when doing the above step: BGR. Not RGB, but BGR.

Now, here's how to edit S3K special stage palettes!

Step 1:

Save your screenshot and open it in Paint. (If you use Kega Fusion, the screenshot will be saved in 24-bit .bmp format)
Don't edit in this format. Open and save your screenshot in 256-color .bmp format to convert it to 16-bit format [hence 16 2 = 256]

Step 2:

What you want to edit is the foreground and background, so click on the Color Picker tool, located under the Fill tool to the right of the Eraser, and click on any of the marked areas as shown in the example.
The arrow points to the sky (blank area in the background) The circles indicate that the moon and stars (background objects) are also editable. The checkerboard-patterned foreground is marked by two stars with one for each color.

Step 3:

This is where you will really have to play close attention. As you select your color of choice, click "Edit Colors". A dialogue will pop up, displaying several values, according to the selected color.

What you need to look at is the second column of values. Those are your BGR values. Those are the values you will change to get the colors of your choice. The thing is that you have to input values that are multiples of 32, with zero being the lowest value. The highest value of any BGR concentration is 224, with the lightest white possible using 224 for all three values. If you want to know know how to translate all of this to hex, here's a conversion chart that you need to look at:

Bit value = Paint BGR value

0 = 0
2 = 32
4 = 64
6 = 96
8 = 128
A = 160
C = 192
E = 224

Multiply the left value by 16, and the result on the right is what you get.

In the example, the selected color has a BGR value of B = 192, G = 0, and R = 192. Based on the conversion, this color has a value of $0C0C. All examples shown are shots of the third special stage's palette of the Sonic & Knuckles version.

Step 4:

Look up the palette location of the corresponding stage in the SCHG guide and you will find the example's address at $8B7A. Open your hex editor, go to that address, and you will see that a single special stage's palette consists of 38 total nybbles (9.5 bytes) with the checkerboard foreground using 8 total bytes and the background using the other 1.5 bytes. The first 8 bytes of the foreground are listed first. You will see that each of the two colors of the checkerboard uses 4 bytes each, alternating after every 2 bytes. Then the last 1.5 bytes of the background are listed with the single nybble of the main background listed first. The moon and stars use two colors, so that's a full byte. The darker shade is listed before the lighter shade.

S&K Special Stage 3's palette address highlighted

The green highlight represents color "A" of the foreground; the yellow highlight represents color "B" of the foreground; the red highlight represents the main background color; the blue highlight represents the darker shade of the moon and star objects; and the pink highlight represents the lighter shade of the moon and star objects.

For quality purposes:

- Don't use the same color twice for the foreground.
- Make sure the main background is darker than the moon and star objects.
- Remember to list the value of the darker moon/star shade first.
- If you mix up the BGR values of the foreground, you will end up with an irregular and distracting color pattern. [Someone may eventually ignore this rule and make one of their FG colors consist of a four-color rainbow -- shoot, I may as well show you this weird example below]

Step 5:

Take note of the conversion chart and just go at it building your custom palette! It would really help if you simply did this:

If you just simply cut out, copy, and paste whatever you need, you can then make a more compact template of the desired special stage. The three swatches on the bottom are the background colors, in order of darkest to lightest. If you use the Color Picker tool and just mix and match FG/BG swatches using your choice of colors, you can actually see a preview of your new special stage palette!

If you are comfortable with your color combinations, you can then jot down their Paint BGR values and convert them into hex as mentioned before in Step 3 and then repeat Steps 2-5 with the other 15 stages.

And presto! here is your new special stage!

If you have any questions, comments, or concerns, you can either reply to this thread or send me a PM. I am open to any feedback. If you have any additional suggestions or stuff that you want to share on this thread, then you are welcome to share it. Admins and staff are more than welcome to comment.

SN: I was told by Eduardo Knuckles that ROM editing is obsolete, and people use disassemblers now. So whether you are still editing ROMs the old-fashioned way, or working with disassemblers, you can still use this guide.

While this is an well written guide, there are much simpler ways of editing palettes today, and palette hacks are obsolete for the most part now. Tribeam made a real time editor for S3k, meaning you can edit the palettes in game while playing it using Gens, and Hivebrain made a palette editor a long time ago. You don't need to use hex, unless if you really wanted to.

@ Ravenfreak: You know, someone else told me that earlier, and I did mention it as a side note. But this is the method I currently use. It's understandable that the new S3K editing tools available will obviously make my guide useless. But I just wanted to share a little something to those who still choose to use old-fashioned methods. I'm really not doing a full S3K hack, but I do like to play around with the special stages.