Sunday, September 22, 2013

Post-processing added

After some big refactoring made in Gine, I started to play with shaders.

It's not my first time of course, but I'm trying to standarize fx file loading and usage. Another time - make it user friendly.

My first goal was to make a very simple greyscale post-processing effect. Now it looks like that:

Supersimple pixel shader goes like:
Notice the usage of a gTransition float. Yeah! I made smoot transitions as well and I must say it looks exactly as it should ;)

The next step was to blur the background at a pause stage:

The thing was tricky - Gaussian blur needs two passes to work in an optimal way. So after adding a backbuffer render target view, I had to add another and swap them in meantime. Geez, it's so unnecessarily complicated at that level.

I'm happy that main rendering loop looks like that:
And when you want to enable or disable the effect:

Monday, August 19, 2013

Font, Text and Substate

It's been a while... Well, I made a personal portfolio at that time. You can find it here:

Grzegorz Michalak Gamefolio |

To the business.
I've sat a little and write some better classes for text rendering. Right now I have a Font and Text class. Many texts can have the same font if you take it that way. It's much better right now and code is also cleaner.

The thing I've done today is a level start state. Here you have a level number and countdown timer - 3 seconds till you can start solving current level. After 3 seconds, these texts are tweening out of the screen with a smooth animation - it's also a nice thing to implement :)

The next step will be level ending screen. It's quite more complex, you need to count some points, draw some clickable menus etc.

Monday, May 27, 2013

Game Interface

It's very simple, but required some Sprite and Font classes. I've made them with last projects, but now, they've got some crucial improvements.

In next steps, I'll add some gameplay states UIs, like beginning of a level, finishing it and pausing.

Tuesday, April 30, 2013

Like a boss

Today I spent some time making animations for my game character. As for now, we have an idle, walk and push animations. I upgraded Gine to handle multiple animations by simply calling them like:

One of the most important thing I haven't done is a transition between animations. It shouldn't be a problem, but right now I need to get some rest and code some simpler, but more necessary things like gameplay ;)


Monday, April 29, 2013

Exporting animations from Blender to DirectX

It's been a while since my last post... Owh Gooood! The most time and energy consuming thing is behind me. Skeletal animations has been written and I'm really happy about it. In fact, I was swearing at them all the week, the more technologies you use - the more potential bugs you get. What a discovery!

Let me share a few critical problems I got on my way. Maybe it'll save someone's time in the future ;)
It's not a tutorial or step by step instruction, only hints.
  1. Exporting skeletal animation from Blender (v2.65) to a .x file
    • Only active ArmatureAction strip is exported, I was trying with NlaTrack but failed
    • Remember to triangulate the mesh
    • Keyframes on frames <=0 aren't exported
    • Bones have to be in rest pose before running the exporter (but not in Rest Position from Skeleton tab in Object Data panel, I prefer to make a special "rest keyframe" in frame 0)
    • You need to select armature and object first, then launch the .x exporter
    • My exporter options checked:
      • System: Right-Handed (my Assimp loader is configured to automatically change coordinated to Left-Handed)
      • Apply Modifiers
      • Export Textures
      • Export Armatures
      • Animations: Keyframes Only (I guess you know why)
      • Export: Selected Objects

  2. Importing a .x file with Assimp library
    Assimp interface is very neat, so there probably won't be any problems with it. The main I had, was with this function:
    Despite of a fabulous name - it just converts Assimp matrix to XNA matrix. They're both structures with 16 floats in them, and XMFLOAT4X4 has a constructor that enables to build it from a float pointer.
    Tracking this error was a really funny thing, you know where was the problem? The returned XMFLOAT4X4 matrix was transposed... Here's the fix:

  3. Some code issues:
    • Watch out when you want to have a structure like a list of keyframes containing offsets of every bone in current pose. When you're importing, you have a list of channels (corresponding to bones) containing offsets for every frame. It's easy to write some dirty code here.
    • Take a special care for quaternions. Sometimes they're stored as (x, y, z, w) and sometimes as (w, x, y, z)
    • IMHO pointers are much better than lists when managing a bone and animation structure
    • When stuck and don't know what to do, start small. Make a super simple animation with a 3 bones and 6 vertices. Debug all transformations and properties, you'll figure out what happens for sure :)

Friday, April 19, 2013

Suckoban prototype

Finally it's here :)
The best part is that this is fully playable :D Of course you can't save/load, select a specific level from map's pack, etc., but the main idea is on.

Probably I'll spend most of my time trying to implement animations, we'll see if I can do that till the end of April :)


Wednesday, April 17, 2013

Meet Gine

Gine Is Not an Engine

Finally I've come to name my renderer. I really don't want to say it's an engine or something, just wanted to make a happy little framework that I can make 3D games with.

So today was a hard day of refactoring and of course I haven't finished it yet. With every game I made lastly I've been upgrading this framework by adding little pieces. Not it's the time to get them strictly together and make something like Gine v0.1 :)