Color palette borked - everything's rainbow colored in my game

Game:

Using this module to save stuff:
http://www.roblox.com/EncodeInstance-Module-Does-not-work-with-CSG-item?id=176696010 (by Stravant)

Before the color palette update:

After the color palette update:

Reports:

What DID happen? Help me xlegox D:
Was the palette shifted around??

Edit: Would this be a limitation with his bitbuffer module? If so, am I essentially screwed unless they rollback the update…?
Repainting 20,000 bricks (for multiple people each) is really hard to accept.

Yea this happened because Stravant encoded the BrickColors into a palette. Take a look at line 155 of BitBuffer module

local BrickColorToNumber; local NumberToBrickColor; do
	BrickColorToNumber = {}
	NumberToBrickColor = {}
	for i = 0, 63 do
		local color = BrickColor.palette(i)
		BrickColorToNumber[color.Number] = i
		NumberToBrickColor[i] = color
	end
end

Since new colors were added between 1 and 64 it causes your colors to shift. From my understanding once they loaded it won’t be possible to undo the effects. (someone smarter + thorough-er than me correct me if I am wrong)

So I could write a script to fix any colors loaded in? I’d have to find the old palette and manually shift each color in a table according to the new one… oh man…

Going forward, the best way to remedy this is to update your copy of Stravant’s EncodeInstance module like so:

local oldPalette = {
	[0] = 119,
	24,
	106,
	21,
	104,
	23,
	107,
	37,
	1001,
	1,
	208,
	1002,
	194,
	199,
	26,
	1003,
	1022,
	105,
	125,
	153,
	1023,
	135,
	102,
	151,
	5,
	226,
	133,
	101,
	9,
	11,
	1018,
	29,
	1030,
	1029,
	1025,
	1016,
	1026,
	1024,
	1027,
	1028,
	1008,
	1009,
	1005,
	1004,
	1032,
	1010,
	1019,
	1020,
	217,
	18,
	38,
	1031,
	1006,
	1013,
	45,
	1021,
	192,
	1014,
	1007,
	1015,
	1012,
	1011,
	28,
	141
}

local BrickColorToNumber; local NumberToBrickColor; do
	BrickColorToNumber = {}
	NumberToBrickColor = {}
	for i = 0, 63 do
		local color = BrickColor.new(oldPalette[i])
		BrickColorToNumber[color.Number] = i
		NumberToBrickColor[i] = color
	end
end

If you want to support the new brick colors, that’s a much harder task. I believe it will take more than 6 bits to store the new colors, which is what Stravant allocates.

1 Like

I’ll try that out. I don’t want to mess with the new colors yet, thanks for the warning O:

Works

If you haven’t already, set up a version number in your data structure. Next, detect if stored data is of a particular version (or unversioned) and decode accordingly. For example, version 1 encodes and decodes with the new palette, while unversioned data decodes with the original palette.