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 :)

Tuesday, April 16, 2013

Introducing Suckoban

Ok, so why do I post a new project introduction in a half of the month? I've been doing a secret project that I can't share but it was still in DirectX, so I'm on fire all the time ;)

Suckoban is a 3D remake of a classic Sokoban game, nothing more. It's a project I've been working on 3 years ago with my friend. Here's the site with our WIP:

And a little trailer here: