PaletteMap is fast

August 13th, 2007

This is one of the tricks to my Doom engine. Doom has a 256 color palette, and all colors in the game come from this palette. When an index is found for a pixel, instead of converting it to an rgb value using the palette, write it directly to the image itself. In other words, the last 8 bits (the “blue” section) of every color on the bitmapData should have an index, rather than an actual blue value.

bitmapData.setPixel(x, y, index);

After all processing is complete, you can use paletteMap to convert these indexes for you. PaletteMap uses the value of each byte of an image color (four total) to come up with a new color. See the documentation for paletteMap for more details. Provide an array that converts indexes to rgb values for blue and Flash will do the work for you. If you pass arrays full of zeros for red, green, and alpha, then these values of the associated bytes will have no effect on the resulting color.

bitmapData.paletteMap(bitmapData, bitmapData.rect, new Point(0,0), _blank, _blank, _index2rgb, _blank);

PaletteMap is very fast, which is why this offers a nice improvement in speed. Passing null to a section instead of an array makes it slightly slower on my computer, so that should probably be avoided.

I wrote a post a while back describing how wary digital distribution made me. Now a perfect example of the huge flaw in digital distribution exists. It was provided, surprisingly enough, by Google. They decided to back out of the pay-to-download video market, taking the videos people purchased with them. Refunds are offered, but in the equivalent of “store credit”. Google will likely do something to escape backlash, but more importantly, they really don’t have to do that. This is why digital distribution in its current form is very flawed, not because it isn’t a good idea, but because physical ownership is lost.

Edit: Looks like Google’s giving out full refunds instead of store credit, and they’re being extra nice about it too. Doesn’t change the fact that they didn’t have to do that.

Splice Music

August 6th, 2007

Oh my goodness. Andre has really done it this time. It’s a very “Web 2.0″ community remixing site that uses Flash, allowing it all to run straight out of a browser. The Creative Commons-loving crowd is going to have a joygasm when they see it. Cory Doctorow will be so happy he’ll fall from his balloon. Also, my ongoing battle to outmatch Andre in AS skillz has been nixed again. Of course it seems another fellow did all the real audio work, but I must try harder nonetheless. You win this round Michelle.

Spooky

August 4th, 2007

I noticed that games I lavish my attention on tend to be remade or re-released. Or both. I think it’s quite unlikely that everyone in the game industry is secretly scanning my website as a way of knowing what to do next. Instead I think it’s far more likely that I have some sort of magic power to influence the video game industry.

For one thing, the original Doom is going where it has never gone before - Steam - so it’s being re-released for modern operation systems. COINCIDENCE? Yeah probably, since it was just remade for the Xbox Live Arcade. But wait, I have more.

While plenty of people have tried making in-browser FPS games, none have really pulled it off and become popular. id Software (creators of Doom) just announced a remake of Quake 3 that works in your browser mere weeks after I show off my demo. I think it is obvious that once again my magical abilities have warped the minds another game company’s direction.

It’s also worth noting the chances of this remake being made in Flash are nil. It’s unlikely to be made in Shockwave either. The only real choices are Java or a custom plugin, both of which seem somewhat unlikely. Their main problem is figuring out how to use a mouse/keyboard setup in a browser. I’m looking forward to seeing how they pull this one off.