I moved to a new URL! Check it out!

posts dated from: june 2014

Otter Updates 0.9.6

Otter Updates 0.9.6
Otter is slowly approaching the big 1.0.0 moment, and I've been tinkering with it little by little trying to fix bugs that pop up. I've also been using the dev branch so you can see my updates as I make them. Otherwise the default branch is supposed to be the "stable" one, and every once in awhile I merge the dev branch in with the default one.

Here's some of the recent changes and fixes!

* Text now has CenterTextOrigin() in an attempt to find the center of the actual text, and not the full bounding box.

* RichText also now has CenterTextOrigin()

* Fixed Text bug that would cause text to jitter when the height of the tallest character was changed.

* Fixed the same issue in RichText.

* Tilemaps have had some improvements in their performance for looking up tiles.

* Tilemaps can now use Enums for their layers.

* Fixed bugs with accessing tiles out of range in a Tilemap. Tiles are now automatically clamped inside of the limits of the Tilemap.

* Tilemap GetTiles() will return a list of TileInfo objects for every tile on a specific layer.

* GridCollider now has a Clear() function

* GridColliders can now load collision data from a Tilemap, using a specific layer on the Tilemap.

* Fixed a bug with not updating Graphics when their alpha was changed.

* Game's "SmoothAll" value should now actually affect Textures. Considering changing this to a static value on Texture.

* Fixed crash bug with Surface's SaveToFile() function.

* Updated the Glide Tween Library to the latest revision.

* Updated the documentation.

That's all for now. If you have any issues you can post on the forums and that'll be the easiest way to get help. Hope everyone out there is having fun with the engine!

Dev Log: Shader Follow Up

Dev Log: Shader Follow Up
My last post went over some of my recent shader developments with displacement maps, and using gradient maps to recolor portions of the screen. I had a couple of questions of what exactly was going on behind the scenes with the render textures that I was using to tell the shader how to actually manipulate the image, so I thought I would address that now!

Here's an example image from the game with a lot of explosions going on:

Image


Each explosion has a shockwave ripple coming out of it which distorts the area around it. The explosion also changes the color of the screen around to a gradient map with pink and yellow. This makes it look like an intense heat, or something.

For reference, here's the shader again (it's been slightly modified since yesterday.)
uniform sampler2D texture;
uniform sampler2D displacementMap;
uniform sampler2D paletteMap;
uniform sampler2D gradientMap;

void main() {
// Get the pixels off of the maps.
vec4 displacementPixel = texture2D(displacementMap, gl_TexCoord[0]);
vec4 palettePixel = texture2D(paletteMap, gl_TexCoord[0]);

// Read the pixel from the displaced position.
vec2 pos = gl_TexCoord[0];
pos.x += (displacementPixel.r * 2.0 - 1.0) * 0.025;
pos.y -= (displacementPixel.g * 2.0 - 1.0) * 0.025;

// Get the displaced pixel.
vec4 pixel = texture2D(texture, pos);

// Proper grayscale conversion.
float gray = dot(pixel.rgb, vec3(0.299, 0.587, 0.114));

// Get the color from the gradient.
float gradientPos = mod(gray + palettePixel.g, 1);

// Get the actual color from the gradient.
vec4 gradientMapPixel = texture2D(gradientMap, new vec2(gradientPos, palettePixel.r));

// Mix the gradient with the pixel color based on the palette pixel.
pixel = mix(pixel, gradientMapPixel, palettePixel.a);

// Apply the final color multiplied by the gl color.
gl_FragColor = pixel * gl_Color;
}
From this point on there's going to be a lot of images and some hefty animated gifs, so I'll hide the rest of this post behind the read more button!

Dev Log: Shaders All Day

Dev Log: Shaders All Day
I've been taking an extended vacation in shader town lately, and so far I've been having a lot of fun! One of the things I was figuring out was how to take an image and remap all the colors to a gradient based on their luminosity (well, a sloppy way of estimating the luminosity.) This seems like a pretty powerful effect that could be used to really spice up effects. Yeah, I'm always thinking about how to make explosions better.

First I'll share the actual shader code that I'm working with right now. This is the shader that's being used for all of my full screen effects.
uniform sampler2D texture;
uniform sampler2D displacementMap;
uniform sampler2D paletteMap;
uniform sampler2D gradientMap;

void main() {
vec4 displacementPixel = texture2D(displacementMap, gl_TexCoord[0]);
vec4 palettePixel = texture2D(paletteMap, gl_TexCoord[0]);

vec2 pos = gl_TexCoord[0];
pos.x += (displacementPixel.r * 2.0 - 1.0) * 0.025 * displacementPixel.a;
pos.y -= (displacementPixel.g * 2.0 - 1.0) * 0.025 * displacementPixel.a;

// Get the displaced pixel.
vec4 pixel = texture2D(texture, pos);

// Proper grayscale conversion.
float gray = dot(pixel.rgb, vec3(0.299, 0.587, 0.114));

// Get the color from the gradient.
float gradientPos = mod(gray + palettePixel.g, 1);

vec4 gradientMapPixel = texture2D(gradientMap, new vec2(gradientPos, palettePixel.r));

// Mix the gradient with the pixel color based on the palette pixel.
pixel = mix(pixel, gradientMapPixel, palettePixel.a);

gl_FragColor = pixel * gl_Color;
}
Using Otter I can just apply this shader to the game's main Surface object and I'm ready to roll with special effects. This post is going to be image heavy, so I'll hide the rest of it behind the jump!

Doodle Post

Image


Been doin' nothing but doodling lately. Gotta get back to programming work!

Doodle Post

Image

Doodle Post

Image