I moved to a new URL! Check it out!

posts tagged with: sfml

Otter Updates: Effects!

Otter Updates: Effects!
Another round of Otter updates are here! I'm getting ready to go to a game jam for the weekend so I wanted to make sure I was equipped for making rad special effects for whatever I end up making (if I end up making a game, even.)

Image


* Added the Particle entity. It can be used to easily create particles with simple effects.

* Added the Flash entity. It can be used to easily create screen flashes.

* Added the ImageSet graphic. This is used by the Particle entity right now. Think of it as a very very simple SpriteMap. You can render one image from a set of images (a sprite sheet) but there's no automatic animations.

* Added various window options to the Game class.

I have a few more fixes I want to do before the jam starts including a small fix to the Axis class and possibly changes to the StateMachine class to use enums for states, but I don't know if I'll be able to get to those before the jam starts in just a couple hours.

Otter Updates

Otter Updates
I just recently pushed some updates to Otter with a lot of changes to various things!

* The Controller class had some changes to allow for recording and playback of input. This is best applied to controllers used by Sessions. You can now record input to a compressed string, save it to a file, and play it back. This probably only works in fixed framerate mode.

* The performance of the game is now more accurately reported.

* Started working on an ImageBatch class that will batch rendering of a bunch of images sharing the same texture into a single draw call (or will try to minimize the amount of draw calls.) I might end up switching all of Otter's rendering to this technique at some point, but for now I'll leave it up to the user to decide what to batch.

* Various bug fixes across the board, and updates to the documentation. Note that the most recent version of the docs is in the repository and the ones online may not be the latest yet.

More updates are on the way! I'm planning on using Otter for a game jam this weekend and we'll see how it goes.

Otter Documentation

Otter Documentation
Just a quick update about Otter! If you don't know already, Otter is a 2d game making framework that I'm making using DotNet/C# and SFML 2.

I just pushed a first pass at some documentation. This should be enough to at least help some people out with basic questions, but I'm sure it all has a long way to go. It's being generated from the source using Doxygen.

I'm going to be attempting to use Otter for a game jam coming up next weekend, and I can't wait to see either what I can make with it, or what horrible bugs will reveal themselves! I've been tinkering away on two different projects in Otter and so far so good, but you never know until your deep in the trenches of a game jam...

Otter

Otter
For the past couple of months I've been working on a little framework using C# and SFML, and I think it's time to finally release it (in beta form) to the public!

Check out Otter!

Image


Right now Otter is only officially working in Windows with Visual Studio, but if anyone wants to figure out how to get it working in other programs and operating systems then let me know! The SFML dll files should be able to be used with Mono for Mac and Linux, but I don't know how to do that yet.

It's important to know that this is a beta release of the framework. There's still no official documentation, so you'll have to fumble around on your own for now if you're planning on using it. I also would advice against tackling any huge game projects for now unless you're comfortable digging into the source and changing stuff around yourself.

I'll be posting updates about Otter here on my web zone, and the latest version and updates will be available on Otter's website.

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!