Friday, December 2, 2011

New Website is Up!

Ok, so I was talking with the folks at the Ludumdare IRC the other day and they advised me to create a website to show off my stuff. And so for the last two days I've been working on it tirelessly almost every waking hour to get it up and running and I tell you: HTML, CSS and javascript are NOT nice to work with!

Also as I'm writing this I'm talking to the guys at IRC and another suggestion of theirs that I think I'll follow is first to switch from blogspot to wordpress, then register a proper domain name, and finally change my hosting. But since I've only just created it and I'm really busy right now I'll do that next week if not later.

Anyway, here's my Website:

Any critiques in relation to content, design and anything at all are very welcome!


Tuesday, November 29, 2011

Deferred Lighting

First a quick update on stuff that's been going on since my last post here:
-I've been let go from my old job, looking for new one.

And now back to our topic at hand.
I always like to boast that I'm a graphics programmer, that there's little that can stop me in my way and even though I actually do believe that's true I don't have much to show for that. Be it because of work and being uninspired to program back at home, or because I've spent far too long retouching my engine and in the end I end up with a lot of hidden work and nothing visible, or because I was simply too lazy/distracted.

Well, since I lost my job I decided It's time to boost my portfolio a bit, and prove to everyone and to myself that I can actually be a good graphic programmer. To accomplish this I decided to work every day on a small demo of a certain feature I never implemented before. The first one being:

Deferred Lighting.

Of course my first reaction was grabbing as much as I could from the internet in terms of research papers and tutorials. The most helpful I found are these:

Creating a GLSL Library - This was a good way to quickly sketch out a simple per-fragment lighting shader and apply it to a model lit directly. I've used this before so I simply copied most of the code

Coding Labs Deferred Rendering Tutorial - This is what I needed, though I decided to skip the tutorial and learn directly from source code since I already understood the concepts and implementation, but I didn't know which opengl functions to use.

Normally Deferred rendering requires you to use the inverse of the modelview matrix and inverse of the projection matrix to get both the pixel position from projected screen space to camera-space, and to get the lights from world space to camera space, however the tutorial used a nasty inefficient hack to get the pixels in world space without the need for transformation: it simply recorded all x, y and z inside what in normal deferred lighing program would be a single-32bit float-value gbuffer.

However with lights I did another nasty hack: instead of using the gl_LightSource[i].position in my shader I simply replaced it with an array of vec4 screen-space light positions I calculated outside using the modelview matrix from the first pass and passed to the shader.

All of this just so I didn't have to write/find and de-obscure and test and debug a matrix inverse function.

In the end I spend between 4 to 8 hours on this (how mach depends if you count the research time) over the course of 2 days.

The results?

All in all it wasn't that bad but the code ended up a horrible conglomerate mess, most of which was shoved into a single main.cpp file.

If you're interested you can download the demo with the code here:
Deferred Shading Demo

Before you look at the source please note that this is terrible code, unoptimized and originally wasn't meant for viewing by other people, if I ever did the exact same demo again there would be ZERO similarity.

Right now I'm working on another experiment, namely importing a model with animation using Assimp (which I still have to learn) and then use that data in my animation tree (similar to the one UDK has), in the end add some IK, but this experiment is much larger than the deferred shading one, so it'll take probably about a week or so before I post here again.

Thanks for your attention!

Sunday, August 21, 2011

Progress snippet

Ludum Dare 21 has started yesterday. Unfortunately I'm not participating but that doesn't mean I won't be doing anything this weekend!

For the last month or two I've been working on my game engine. My little baby Litterbox has it's third rewrite from scratch ever since I've started making it. This time the key word is "Components"!

Now, components are a very, very good thing, but the classical component-based engine design has it's flaws like component communication overhead, the lack of centralized control, and many more than would normally keep me away from it. However I couldn't just go back to using the traditional deep hierarchy design as it constraints the flexibility of the engine, and many times you have to use a super-complex base-object that I really don't want to have.

So.. What's the sollution?

My engine architecture is a hybrid one, having always a centralized  game entity to which the components are linked. In most cases this means that I have a command center for my objects, but I can also add and new components easily. So if I have a 2D game engine where I suddenly would want one of my bosses to be fully 3D there wouldn't be a problem! I just add a lb3DModelComponent to my boss object, and handle all the special 3D code in the entity.

So far I've moved from 2D animated sprites to 3D models (with Horde3D) without any problems, and if I want a 2D game on top of my 3D game then there's absolutely no problem!

So, here's my progress so far:
-I have a fully functional Entity system with attachable components.
-2D box-based collision system (with various iterations per frame)
-2D graphic system, leftover from earlier engine testing, with support for animated sprites loaded from a sprite sheet.

My Game
I also started thinking about the game I want to make. In my earlier days as a wannabe game dev I created a small demo in gamemaker, where you controlled a fiery guy, you had a selection of fire-based weapons and you were left in a small town full of squishy pink dudes and buildings to use your abilities on.
Recently I showed it to a couple of guys at LudumDare IRC channel and the feedback they gave me really pumped me up so I decided to give that game another try.

The basic idea of the game was that you were a Poyo, a little pink dude kinda resembling a Poring from Ragnarok Online. You would then acquire special powers that would let you transform into a version wielding 1 of 3 natural elements, namely: Fire, Water and Flora.

The game setting was mostly based in a fantasy land with traces of advanced tech.

Now I'm reworking the Idea. I'm planning for keeping the feature of 3 elemental transformations, and as planned before the game would be an Action-Adventure, though I might throw in some RPG elements in there too since it seems to be a good blend considering the fantasy setting.
Anyway, here's the screenshot of how things are so far:

This also was a good excuse to go back to modelling in Blender.
Importing these models to Horde3D was a real pain in the ass as the colladaConverter crashed when converting them, but the people on Horde3D forum had a nice workaround which works good so far.

For comparison here's how the old PoyoAdventure demo looked:

That's quite a sight there in all its 2D glory, however 2D constraints when it comes to depth and having object on top of one another really threw me away from it, that's why I decided to remake this game with 3D graphics (though with the same 3/4 view). I still plan on using 2D collisions though, just to work faster and have something done in less time.

I won't finish this game but I want to have a fun to play prototype. If it's fun enough then I'll work on it more adding fully 3D collisions, proper story, and I'll invest more time into it. (Basically this version will be the proof that I can make a game, as well as a proof of concept for my engine).

I'll be working on this most of the weekend, in a few hours I should have the little pink dude walking around with a basic animation and colliding with stuff. No idea what I'll do tomorrow but lately I've found out that striding back and forth around my house, brainstorming, gave me lots of good ideas as well as will/inspirations to implement them.

Edit: For those interested, no I didn't get the animations playing. I have no idea how I export animations from blender to use in Horde. I'll ask on Horde forums but that place is pretty much a ghost town. I'm kind of starting to regret using Horde instead of Ogre3D. If I don't find anything reasonable soon I'll try making my own converter with the help of AssImp.

That's all for now!


Monday, July 11, 2011

Going social

As a mean to slowly start changing my life and become more social I joined Google+ and Twitter(SpliterCbb).
My life in the last few months has been almost nothing more than wakeup-watch videos on yt/play games-sleep and it's been a bit colourless lately (especially if I compare it to my academic life before I lost everything). But as a way to keep my sanity and keep myself minimally occupied in my free time (considering I can't bloody do anything creative as I have enough of programming at work) I decided to jump onto the latest social craze.
Whoopee frikin Do.

Wednesday, June 1, 2011

The joints are turning

Luck is not always on our side and so the animation tutorial will be delayed a little. I do have it completely planned out though so pretty soon you'll see the first chapter. The complete tutorial will have 9 chapters ranging from vector transformations, through skinning, blending animations IK and saving.

It's the biggest such project I have got myself into so wish me luck!

The first chapter will just talk about vectors and vector transformation so those that already know this stuff can skip it without much thought.

In this chapter I will assume you've at least heard of vectors and I'll just speed through a few useful things like dot and cross products, and matrix transformations and some interesting applications, so even if you already understand vectors it'll be worth skimming though it.

Mikolaj (Spliter) Kuta

Tuesday, May 24, 2011

I'm back from the dead, and with some good news!

Hello Ludum-Dare-ians and people who randomly found this blog on Google looking for game save tutorial!

I'm back from my slumber, and what slumber it was!
I did get the job at the company I was making those challenges for, I'm even on our company's page ( as software developer! (though everyone knows there I'm the Senior Graphics Engineer).

Anyway, I've not been completely procrastinating! Since I've worked there for several months I've been programming everyday for almost 8 hours which shows in my code I write for my own projects. However! Even on my own hobby codefront  I did not procrastinate (not entirely anyway).

I am now announcing I'm working on a game. I'm not sure if it's gonna be commercial or not (probably not as the quality of many thing will be shit) but I'm making it with a long lived friend of mine MICL.
He's going to write the story and make music, while I program and work on graphic art.

But the point of this post is not that.

My Litterbox engine is reaching it's 4th anniversary, and so I decided to make another step and make it fully 3D!

But the point of this post is not that either!

The point of this post is:


So far I've created a working 2D prototype. but mainly it's a tree-based animation system, where the leaves can be either animations, physics, or anything that modifies a given skeleton. This system was larely based on UDK animation system, and because of it's tree-based structure it's possible to do the following things:

1-Dozens of working animations , only the animations connected to the tree are updated so no wastes.

2-Animation Blending, which allows for composed animations (eg: having a character with a walk animation composed of four different walk animations (eg: NSEW directions).

3-Synchronized animations! Yes, this is one of the golden jewels in the crown of my engine. This means that you can have a 1.5 second running animation blended with a 4.0 second walking animation and the transition will be seamless as long as the movement is synchronized timely as well (eg: in both animations the left foot is on the ground at 50% mark, up on the 0 and 100% mark, etc)

4-Easy to add nodes that depend on the current pose. Just pop an IK node between the root and the result of the animation and you have IK with the starting position of the animation.

5-Bone masking! Don't want your "running animation" affect the hands and torso? No problem! you just disable all the bones you don't want animated!

6-Adding new types of nodes is easy! if you just follow the node structure of the animation tree, you can add nodes or leaves that fill any necessity, from IK, Physics/conscious ragdolls to procedural or keyframed animation!

Here's an example of the tree structure I've mentioned:

So! When can you use this fantastic animation engine?
Well... that's the bad news: you can't.

At least not for now. I've made a 2D prototype that works and now In the middle of porting it to 3D.
I've got the skeleton working in 3D with quaternions using my handmade math lib. I've also got skinning working, but no texture loading and no normals so far.
here's how it looks right now:

Not really impressive, is it?
Well, it'll change in a couple of days. I've recently (about a month ago) mailed Chriss Hecker for advice on how to keep focused even if I really don't feel like doing anything.
His advice?

"15 minutes"

Every day work for 15 minutes no matter what the mood, no matter how hard you don't want to.
If you really don't want to do anything then hey, 15 minutes is like 1/16th of your free time if not less. After that go do whatever the hell you want.

I've been following this advice for the last month, I've had occasional slips, but usually when I work I end up working far beyond those 15 minutes. (before writing this post I've been working for about 3 hours stopping occasionally to glance at a video running in the background).

So, this is my official statement:

Since Saturday I'll be making a tutorial on how to implement your own 2D or 3D tree-based animation engine with all the features I listed. And I'll be releasing this tutorials in several chapter, one chapter every 3 to 4 days.

I won't fail unless something really unexpected happens (like the second coming of Christ, or having to stay late at work for the entire weekend).

Wednesday I'll release the list of chapters of the tutorial, but I know I'll be starting explaining the basics of vector math and a bit on matrices and quaternions. In the later chapters I'll explain on how to create a working IK system, and how it'll be integrated into the animation system.

By Saturday I should also have my animation system completely working which should serve as a good proof of concept that I'm not just babbling madly.

I'm out!
Mikolaj Kuta