Jump to content

Color Codes


exec
 Share

Recommended Posts

Over in the Release section I have a tool that generates color codes based on user input, but I don't think I've ever seen any documentation on how they work. In case you ever wondered just that, here's how.

Colors

Colors are commonly represented as hex numbers of 6-8 characters, made up of 3-4 byte sized values for the Alpha, Red, Green, and Blue values of a color. For example, FF0000 is red (red = 255, green = 0, blue = 0), 0000FF is blue (red = 0, green = 0, blue = 255), and FF00FF is pink (red = 255, green = 0, blue = 255). This type of color works as you would expect in Mabinogi, but there are alternative modes, controlled by the alpha value, which make Flashies possible.

Alternative Format

In those alternative modes the 3 RGB bytes don't represent one color anymore, but 2 colors and a delay. Since 1 byte doesn't have a big enough range to represent a meaningful color value the client uses a lookup table located at "data/db/color.xml" that contains a list of exactly 255 colors that can be used. The delay controls how smooth the animations are, and the last byte, alpha, specifies the animation speed and which mode to use. This is the full format:

MSDDC2C1

M = Mode
S = Speed
DD = Delay
C2 = Color 2
C1 = Color 1

Modes

The following are the modes that I know of.

Static 1 and 2 (Modes 1 and 2)

This simply displays the first or second color without any animations.

Client_2018-06-06_14-12-50.png.cbe68655649cea48e9e4bc3e80cf4c56.pngClient_2018-06-06_14-12-18.png.fcc68a12e5038223523d5523d4304814.png

(0x100016fd, 0x200016fd)

Pulsate 1 and 2 (Modes 4 and 5)

Depending on the mode, pulsate starts at either color 1 or 2, fades to the other color, and then jumps back to the main one.

2018-06-06_14-13-56.gif.65af5e7bdcfa1e97eb65e52289b74fde.gif2018-06-06_14-14-49.gif.b74122ff63693825a45d42e29e9fe3b4.gif

(0x400016fd, 0x500016fd)

Even (Mode 6)

This mode is a smooth back and forth fade between the two colors.

2018-06-06_14-15-35.gif.fb3003bc31b2853f8539d78aaf23cc57.gif

(0x600016fd)

Flickering

Flickering is a kind of random flickering of color 2, while the main color is color 1.

2018-06-06_14-16-16.gif.f348465d180715017a31c56cb2b50142.gif

(0x700016fd)

Speed and Delay

The animation speed is defined with the second hex character in the alpha byte, allowing for a potential 16 speed levels. You'll note that my simulator only goes up to 9, because at that point it seems like the client has problems animating it properly. The delay on the other hand is not supported by the simulator yet. What this does, on a scale from 0 to 255, is specify the delay between animation frames. The higher the delay, the less smooth the animation is, as it jumps to the next color every few hundred milliseconds.

The fade time appears to be about 500ms on speed 0, each level lowering the time by half. The delay is presumably a number of frames that are skipped animating the color, creating a step-by-step effect. This also reduces the animation speed sixteen-fold with the delay on the maximum of 255. If speed and delay are both set the effect looks a little random because they aren't in sync anymore and the animation continues while the delay allows only infrequent glimpses.

2018-06-06_14-21-56.gif.09c860d615d6a5fc6e7454056503b536.gif2018-06-06_14-18-12.gif.82c024b69662558f802f81a17998a880.gif

(0x690016fd, 0x607f16fd)

Trivia

The alternative modes work on everything from clothes, to hair, to fences, but they don't work on names. Apparently the client treats alpha how it's usually used for UI elements, as transparency, which is why you can't have a flashy name. In turn you can have a partially transparent name though.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...