I moved to a new URL! Check it out!

posts filed under: general

Dev Log: Boring Code Stuff

Dev Log: Boring Code Stuff
With the release of Otter I got a brand new handful of bug reports and other things to fix, so I've been busy churning away at those over the past couple of days.

My collision code for AABB test was off by just one pixel (because I guess I needed to use >= and <= instead of just > and <, oops) so I got that fixed up. I also fixed some other bizarre bugs in the collision code that was mostly caused by me just using the wrong variable for some things.

I recently changed the input components around to allow for external sources of input. This is a pretty cool feature that I personally like a lot because it goes along with one of my methods for making computer controlled entities, like enemies or characters or whatever.

As an example, I like to code all of my enemies in games as potential players... meaning that they control themselves with input from a controller just like a player would. Instead of just moving left and right by changing their speeds, an enemy will push left and push right on its movement axis, and then other code will read that input and change the speed. For some reason I like doing this a lot because it feels like the enemies are operating under the same rules as the player -- and if I ever wanted to give players control over specific enemies or characters I could easily do that!

Even Dinobaus from Offspring Fling is internally controlled by a fake controller that is being fed input by his "AI."

This also allows for people to potentially record input over time, and then play it back by taking external control of the state of Buttons and Axes, a feature that is often cool for replays, or attract modes.

The one bug I'm currently stumped on is that there is a crash when you close a game in Windows 8 in Debug mode when using an Intel HD graphics card. A very specific weird thing that I have to hunt down... and I have no idea what could be causing it! The joys of programming.

Indie Custom Magic Cube

Indie Custom Magic Cube
Last year before GDC I had a small part in creating a completely custom set for Magic: The Gathering based on the indie game development scene. The full set ended up being 360 cards total, and I'm responsible for about 45 of those cards! I even made it into a couple of cards myself, with Kyle Pulver, Game Jammer, and Rapid Prototyping. My cards were the ones about Source Control, Multimedia Fusion, Lyle in Cube Sector, and a couple of references to Bonesaw, Snapshot, and Offspring Fling.

Update: The indie cube has been taken down. I suggest reading this to find out more.

Here's just a small sample of some of my favorite cards, you can check out the full visual spoiler to see the rest.

Image


Image


Image

And now a card that I hate with all of my being because Edmund used it on me every game and kept stealing my best creatures from my hand:

Image

Blue is so annoying.

Dev Log: Distortion Shaders

Dev Log: Distortion Shaders
I should be working on this example game for my framework, but instead I'm extending my stay in shader town to try and figure out some other stuff. I managed to get a basic distortion map going which looked like this:

Image


And then after that I played around with my old friends sine and cosine and was able to make a cool animated wave effect on the screen:

Image


Here's the code for the first shader:
uniform sampler2D texture;

uniform sampler2D anothertexture;

void main() {

vec2 coord = gl_TexCoord[0].xy;
vec4 other_color = texture2D(anothertexture, coord);

vec4 pixel_color = texture2D(texture, coord + other_color.rg - 0.5);
vec4 final_color = pixel_color;

final_color.rgb += other_color.rgb;
final_color.rgb /= 2;

gl_FragColor = pixel_color;

}
And the second:
uniform sampler2D texture;

uniform float timer;

void main() {
vec2 coord = gl_TexCoord[0].xy;
coord.x += sin(radians(timer + coord.y * 500)) * 0.07;
coord.y += cos(radians(timer + coord.x * 250)) * 0.03;
vec4 pixel_color = texture2D(texture, coord);

gl_FragColor = pixel_color;
}

Dev Log: Shader Town

Dev Log: Shader Town
I'm back in Shader Town in my framework! Right now I'm just finishing up getting my RenderTexture classes fixed up to support multiple shaders automatically. This is helpful for those post processing effects that require multiple passes. Here's what it looked like after my first attempt to get the shaders working automatically:

Image


And then I realized that I was doing a lot of things wrong with SFML's RenderStates class, as well as not calling Display() on the render texture before rendering it again. After I fixed up some of that stuff, it ended up looking like this:

Image


Much better! Yeah, that is what it's supposed to look like. What I'm doing here is just applying a crapload of shaders to the game's main render texture. So in code all this is right now is:
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/shader.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
game.Surface.AddShader(new Shader(ShaderType.Fragment, "assets/blur.frag"));
And all the shaders will be magically applied one after another when the game is rendered. Neato!

Dev Log: Using the Debug Console

Image


I think I've finally got this debug console working the way I want to for the time being. Right now I'm able to push log messages to it, and send commands that have been registered from the engine. The more I think about it, the more I don't really want to go all out on using reflection to invoke any method that exists in the program from the console, just because it doesn't seem to really match what I want the console to be used for.

One of the main purposes of this console will be the ability to debug large content games, like metroidvanias or something along those lines. Debug commands can be set to something like giving the player items, warping them to a specific location, and even summoning enemies or NPCs into the scene to test.

I also added the ability for the console to advance the game frame by frame, or however many frames the user wants. I can type "next 1" to advance the game one frame, or "next 60" to advance it 60 frames. This should come in handy for figuring out weird timing issues and making sure things are happening on the exact frames they should be.

I'm getting closer to the release of this framework as the last couple of things come into place. The last thing I'm looking into is better shader support, and after that I think all I have left to do is a lot of bug fixes and polish, and finally an example game to go along with it.

...but first I'm going to mess with shaders for awhile!

Dev Log: Debuggin Stuff

Dev Log: Debuggin Stuff
I'm trying to now take care of the last couple of things on my checklist before a public beta/release of my framework! This includes the elusive debugging and command console.

Image


This is the quick first pass of the debug console running in my Offspring Fling mock up using my framework. Right now all I can do is just type into this box, but eventually what I want to do is have commands being run from this console, as well as debug output being sent to it.

I'm also toying around with shaders as well and I think I'm starting to get a grasp on it, or at least fragment shaders, but I still have a lot to learn. Exciting!

--

Hey I'm editing this blog post to show the progress! Here's the console as it looks after working on it for the whole day:

Image


Still no fancy reflection, but for now it has cool enough stuff to debug a game, I think!