[EFFECT] Force 16 Colors

Share your Construct 2 effect files

Post » Tue Nov 29, 2016 6:14 am

This is a modification of @gigatron 's NESify effect. It takes 16 user-defined colors and forces any other color to be one of these by checking the nearest color to it.

Do not mistake this with the "16 color replacer" effect! This one will force 16 colors in your game by comparing them to the nearest user-defined color. This means that, for instance, if your game has a certain shade of green and you define a different shade of green in the effect properties, it will change just fine.

This effect is NOT able to take a color (for instance, blue) and swap it with completely different color (for instance, yellow). For this one you'll have to use the "16 color replacer" effect.

Edit: (fixed link)
Link: https://www.dropbox.com/s/zo1wdkfaoipfd ... s.zip?dl=0

You can also use the Brightness property to make some cool fade-in/out animations while still forcing your game to use limited colors:

Image
Last edited by andreyin on Tue Mar 21, 2017 11:31 am, edited 1 time in total.
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Tue Nov 29, 2016 2:29 pm

Wow, that's great! I've been using ReplaceColor to get some palette control going but this looks much more useful. Does it work on individual objects or layout only? Is it limited to 16 colors?

Thanks for sharing :)
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Tue Nov 29, 2016 4:37 pm

ErekT wrote:Wow, that's great! I've been using ReplaceColor to get some palette control going but this looks much more useful. Does it work on individual objects or layout only? Is it limited to 16 colors?

Thanks for sharing :)


Yup, it works just fine on individual objects too.

This effect allows up to 16 colors but you could use less without having to edit the effect directly - just set the unused colors to Red 0, Green 0 and Blue 0 and it should work.

You can also add more colors but you have to manually edit the .fx and .xml files using notepad (I recommend Notepad++, it's a great app for this).

To add more colors:

In the .fx file you need to copy the last 3 variable lines :
Code: Select all
uniform float COLOR16R;
uniform float COLOR16G;
uniform float COLOR16B;

then paste it below while changing the numbers (to 17 and so on),

Then you need to add a line for it below the "TRY_COLOR (vec3 (COLOR16R, COLOR16G, COLOR16B));" line (also just copy/paste it while changing it to COLOR17R, COLOR17G, COLOR17B).

After this you must edit the .xml you have and copy the last 3 params (they're on the bottom of the file):
Code: Select all
<param>
         <name>Color 16 Red</name>
         <description>Red color to replace, from 0 to 255.</description>
         <type>float</type>
         <initial>255</initial>
         <uniform>COLOR16R</uniform>
      </param>
      <param>
         <name>Color 16 Green</name>
         <description>Green color to replace, from 0 to 255.</description>
         <type>float</type>
         <initial>241</initial>
         <uniform>COLOR16G</uniform>
      </param>
      <param>
         <name>Color 16 Blue</name>
         <description>Blue color to replace, from 0 to 255.</description>
         <type>float</type>
         <initial>232</initial>
         <uniform>COLOR16B</uniform>
      </param>

And paste it below, editing the COLOR16 variables to COLOR17 and so on. If you want you can also change the numbers between the <uniform> tags to have a default value (aka the color you want). This way when you add the effect it will already have the color you wanted.

You can have as many colors as you want by doing this.
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Tue Nov 29, 2016 9:45 pm

Thanks for the explanation, I'm adding colors like no tomorrow now. The fade effect you can get with this is great, I dig it.
B
39
S
16
G
6
Posts: 542
Reputation: 7,617

Post » Wed Dec 07, 2016 11:03 am

This is awsome! I love this kind of style and will deffinatly be using it as soon as I can.

That example GIF looks great as well. But is it just a mock up or is from an actual game? Cause I would like to play it :D
B
8
S
1
Posts: 10
Reputation: 420

Post » Wed Dec 07, 2016 12:45 pm

DonpatchXD wrote:This is awsome! I love this kind of style and will deffinatly be using it as soon as I can.

That example GIF looks great as well. But is it just a mock up or is from an actual game? Cause I would like to play it :D


It's a game I'm working on right now but it's still very early.. won't be done for the next few months!
B
124
S
43
G
41
Posts: 849
Reputation: 28,235

Post » Wed Dec 07, 2016 3:56 pm

I will be looking forward to it :D
B
8
S
1
Posts: 10
Reputation: 420

Post » Sat Feb 11, 2017 2:42 pm

I was looking time ago for something like this but not RGB based. Is there any chance to use Hex Values?

To add colors like:
1: F0F0DC
2: FAC800
3: 10C840
etc...

Instead of fill 3 parameters for one color. So Instead of use 48 parameters for 16 colors we only had to fill 16.
B
24
S
10
G
3
Posts: 557
Reputation: 4,491



Return to Effects

Who is online

Users browsing this forum: No registered users and 1 guest