News:

The forum has been updated to SMF (2.1.3)!
Please be patient as we work to polish up the place and update features as we can.

Main Menu

Casting psynergy in TLA makes the BG fade to a random color, how does it work?

Started by Triyence, 18, November, 2014, 03:13:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Triyence

I'm getting nowhere asking color interpolation questions on forums so since the source of the effect I'm trying to duplicate comes from Golden Sun I figure I might as well ask here.

When you cast psynergy (I'm referencing GS:TLA) the background will fade to a random color, be it orange, blue, red, grey etc... I want to know how it does it. Specifically, how does it choose an end color and how does it determine at what rate the pixels should decrement their color components by.

Here is an example:





So obviously, it's fading to blue, but how is it doing it? Here is the data for 5 random, non-black pixels, changing over the 6 pictures:


╔══════════════════╦═════╦═════╦═════╦════════╦═══════╦═══════╦═════════╗
║ Sample.Iteration ║  R  ║  G  ║  B  ║   H    ║   S   ║   V   ║   X,Y   ║
╠══════════════════╬═════╬═════╬═════╬════════╬═══════╬═══════╬═════════╣
║ 1.1              ║ 104 ║ 168 ║ 144 ║ 157.50 ║ 38.10 ║ 65.88 ║ 121,81  ║
║ 1.2              ║  96 ║ 152 ║ 144 ║ 171.43 ║ 36.84 ║ 59.61 ║ 121,81  ║
║ 1.3              ║  80 ║ 120 ║ 152 ║ 206.67 ║ 47.37 ║ 59.61 ║ 121,81  ║
║ 1.4              ║  72 ║ 104 ║ 152 ║ 216.00 ║ 52.63 ║ 59.61 ║ 121,81  ║
║ 1.5              ║  56 ║  72 ║ 160 ║ 230.77 ║ 65.00 ║ 62.75 ║ 121,81  ║
║ 1.6              ║  40 ║  40 ║ 168 ║ 240.00 ║ 76.19 ║ 65.88 ║ 121,81  ║
║                  ║     ║     ║     ║        ║       ║       ║         ║
║ 2.1              ║  72 ║ 144 ║ 128 ║ 166.67 ║ 50.00 ║ 56.47 ║ 125,119 ║
║ 2.2              ║  64 ║ 128 ║ 128 ║ 180.00 ║ 50.00 ║ 50.20 ║ 125,119 ║
║ 2.3              ║  56 ║  96 ║ 128 ║ 206.67 ║ 56.25 ║ 50.20 ║ 125,119 ║
║ 2.4              ║  48 ║  88 ║ 128 ║ 210.00 ║ 62.50 ║ 50.20 ║ 125,119 ║
║ 2.5              ║  40 ║  56 ║ 136 ║ 230.00 ║ 70.59 ║ 53.33 ║ 125,119 ║
║ 2.6              ║  32 ║  32 ║ 136 ║ 240.00 ║ 76.47 ║ 53.33 ║ 125,119 ║
║                  ║     ║     ║     ║        ║       ║       ║         ║
║ 3.1              ║ 152 ║ 208 ║ 168 ║ 137.14 ║ 26.92 ║ 81.57 ║ 80,82   ║
║ 3.2              ║ 136 ║ 184 ║ 168 ║ 160.00 ║ 26.09 ║ 72.16 ║ 80,82   ║
║ 3.3              ║ 112 ║ 144 ║ 184 ║ 213.33 ║ 39.13 ║ 72.16 ║ 80,82   ║
║ 3.4              ║  96 ║ 128 ║ 192 ║ 220.00 ║ 50.00 ║ 75.29 ║ 80,82   ║
║ 3.5              ║  72 ║  88 ║ 200 ║ 232.50 ║ 64.00 ║ 78.43 ║ 80,82   ║
║ 3.6              ║  48 ║  48 ║ 216 ║ 240.00 ║ 77.78 ║ 84.71 ║ 80,82   ║
║                  ║     ║     ║     ║        ║       ║       ║         ║
║ 4.1              ║  40 ║  72 ║ 104 ║ 210.00 ║ 61.54 ║ 40.78 ║ 158,75  ║
║ 4.2              ║  32 ║  64 ║  96 ║ 210.00 ║ 66.67 ║ 37.65 ║ 158,75  ║
║ 4.3              ║  32 ║  48 ║  88 ║ 222.86 ║ 63.64 ║ 34.51 ║ 158,75  ║
║ 4.4              ║  24 ║  40 ║  88 ║ 225.00 ║ 72.73 ║ 34.51 ║ 158,75  ║
║ 4.5              ║  24 ║  32 ║  80 ║ 231.43 ║ 70.00 ║ 31.37 ║ 158,75  ║
║ 4.6              ║  16 ║  16 ║  72 ║ 240.00 ║ 77.78 ║ 28.24 ║ 158,75  ║
║                  ║     ║     ║     ║        ║       ║       ║         ║
║ 5.1              ║ 144 ║ 192 ║ 232 ║ 207.27 ║ 37.93 ║ 90.98 ║ 127,99  ║
║ 5.2              ║ 128 ║ 168 ║ 224 ║ 215.00 ║ 42.86 ║ 87.84 ║ 127,99  ║
║ 5.3              ║ 104 ║ 136 ║ 224 ║ 224.00 ║ 53.57 ║ 87.84 ║ 127,99  ║
║ 5.4              ║  96 ║ 120 ║ 216 ║ 228.00 ║ 55.56 ║ 84.71 ║ 127,99  ║
║ 5.5              ║  72 ║  88 ║ 216 ║ 233.33 ║ 66.67 ║ 84.71 ║ 127,99  ║
║ 5.6              ║  48 ║  48 ║ 208 ║ 240.00 ║ 76.92 ║ 81.57 ║ 127,99  ║
╚══════════════════╩═════╩═════╩═════╩════════╩═══════╩═══════╩═════════╝


Some things I've found interesting about this data.


  • The RGB colors are all a multiple of 8.
  • The decrement and increment amounts are also all a multiple of 8.
  • The end hue is the same on the 6th iteration of each sample.

I can't seem to figure out the pattern. Any help on this would be greatly appreciated.

Daddy Poi's Oily Gorillas

QuoteThe RGB colors are all a multiple of 8.
The decrement and increment amounts are also all a multiple of 8.
The GBA's color palette only supports 5-bits for red, green, and blue. Which means you should find them as multiples of 8 in all GBA games.

Quotehow does it choose an end color
I have looked into this once. If I recall, the color was likely chosen randomly, and I think it's the same colors you can get as the background of the in-game Sprite Viewer which is not normally accessible in-game.

[From documentation] 080F3954 - Area palette swaps during utility use (may have other uses as well); either 8 or 9 of them, and they are read as 32-bit values

Quotehow does it determine at what rate the pixels should decrement their color components by.
Can't remember/ not sure... Maybe it's based on number of frames to be blending for?
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Salanewt

OH! I've played around with this before. There's basically a small list of colour values that are used in some sort of function; you can change the background fading by changing these. It's the one Fox posted. Anyway, only some of those are used 100% randomly as far as I know (I think Blaze consistently uses red for example).

As far as your actual question goes, I'm like Fox as far as not knowing exactly how the game does it. I haven't really looked into it yet, but I assume it actively changes the current map's palette by using some sort of calculation that is performed based on frames or something, likely with a counter that ticks every time it performs the calculation until that counter is equal to a certain value; basically a code loop. It might even be reasonable to expect that, if not for the counter, the code would keep looping forever and just make the map all one colour or something.

I have to say though, I kind of like the middle pictures more than the end result. I might just look into it later if I have any free time, since it would be cool to be able to alter this stuff more easily and maybe even assign certain background fades to certain spells. Could you imagine if something like Douse consistently made the surrounding area more gray or blue, as if you were creating extensive cloud cover?
Oh yeah baby, £ me harder.

Fusion is just a cheap tactic to make weak Adepts stronger.

Yoshi's Lighthouse is a hacking website in progress. Why not check it out if you like Yoshi or the Mario & Luigi games?

Daddy Poi's Oily Gorillas

Oh! I almost forgot about that Blaze thing always using red... (Can't believe it slipped my mind.)  So here's some other stuff in the doc that is relevant, of which I forgot to post: (It's where the coding is.)


080DC1B0 = AreaPaletteSwap(?,color) ; ?=8 for Utilities. Might be number of frames?

080DC244
080DC294 = Utility area palette swaps / Blend screen to a color
Three sections determine the color blend from 8 colors: 0-7.
First: [0300122C] & 7 ; The counter value, so it's pretty much a random number where each color has an equal chance.
Second: Color determined by utility.
Third: Story flags 0x148-0x14F are checked.
0 = Blue (Pound, Grind, A??, Cyclone)
1 =
2 = Red (Blaze)
3 =
4 =
5 = (Scoop)
6 = (Tremor)
7 = Light Gray (Burst, Sand, Parch)
Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Sometimes I like to compare apples to oranges. (Figuratively) ... They are both fruits, but which one would you eat more? (If taken literally, I'd probably choose apples.)
Maybe it is over-analyzing, but it doesn't mean the information is useless.


The only GS Discord servers with significance are:
Golden Sun Hacking Community
GS Speedrunning
/r/Golden Sun
GS United Nations
Temple of Kraden

Can you believe how small the Golden Sun Community is?

2+2=5 Don't believe me? Those are rounded decimal numbers. Take that, flat earth theorists! :)

Triyence