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

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:

Thursday, March 21, 2013

Say hello to my little friend

Only for people with good eyesight:

This looks better in game, believe me! :D

Shadow figures made with billboard technique, geometry shader used for expanding points into quads and texture array for different images on them. In next step I'll try to put some texture masks for bloodstains etc. :P

Monday, March 18, 2013

Dark, Darker, The Darkness

So I implemented my first dynamic SSAO. Results are following:

I still need to tweak light intensivity etc. but this SSAO method looks weird to me. Model's edges around the camera frustum aren't shaded, but the rest seems to be alright. Also it's quite expensive for rendering time, I know it's post-process but a geometry is rendered twice. Of course it's possible to do it in one pass, but I need to learn about MRT technique first ;)

Instancing and a bit of shader play

I sat down and started to refactor my code for serious. FPS rate was still silly low, but the code looked ok. I've implement instancing and saw that it accelerated draw function by 4-5 times, also frustum culling lowers the drawing time at average 4 times. It was really ok, but still...

Consider following shader code:

What will happen in 28 and 29th line?

I'm setting a value for gRenderedPointLights to 7, so it will be logical if this loop unrolls and just copy its code 7 times with different i values.


HLSL attributes are very sensitive. I don't know why, but in that case the loop unrolled circa 50 times, removing the [unroll] attribute solves the problem. Now rendering time jumped like +100FPS.


Thursday, March 14, 2013

Frustrum culling - so what?

Yesterday I added bounding box and sphere calculation to my model class. With that data it was simply enough to finally implement frustum culling. I also refactored inside of the model class, should be functioning faster now :)

Everything is working etc, but... application in debug mode is still at 10-20 FPS level, I've checked lights, normal maps, particles and other things and I still can't figure out what slows it down so bad. Unfortunately I need to spend more time on refactoring and optimization at the expense of gameplay.

Just in case - next step will be SSAO, I don't know if I'll manage but it's worth trying for this project ;)

Tuesday, March 12, 2013

Maze MVP

I'm so wasted because of coding that I barely know how to write anything (in English all the more).

OK, a couple things has been done; multiple point lights, bump and specular mapping, particles, maze generation, 3D sound effects and more. I really regret now that I haven't wrote a post every work day. It's as hard for me as getting up at 7 a.m.
But for now, here's the screen:

And download link:
Omg, such a big file for download... I need to do something about that...

Thursday, March 7, 2013

Labyrinth of Restlessness prototype

That one was kind of quick. My "engine" is getting more and more programmer-friendly. Today I've added diffuse texture support (after 2 months, believe?!) and did some fixes and little additions.
Prototype was really easy to make, now I can go to more serious things like advanced texture mapping techniques (normal, specular and shadow) and some other graphical effects.

Prepare to be scared ;)


Monday, March 4, 2013

Introducing Labyrinth of Restlessness

You wake up in a Labyrinth of Restlessness. You don't know why you are here. The only thing you know is that you have to escape in no time.

Saturday, March 2, 2013

Drumstep Defenders v1.0

February was a very short month for me. But in fact I managed to finish my game aaaaaaand....


Tuesday, February 26, 2013

Glow me baby

You know what sucks when participating in OGAM? Having room redecoration in the same time. But now it's over and I finally have some time to finish my game. Unfortunately I'll had to close the project in beta stage just to fit in February.

I had some hard time with post-processing, after hours of wondering if I'm that stupid or something I found a solution for my problem and it was in adding that line:
DirectX is a state machine, one rendering technique turns geo shader on and it's on until you disable it. Jesus, I know that but it's really hard to debug that kind of stuff on my knowledge level...

Anyway, finally I've added some music-dependent glow:

Of course it looks better in game (it's a music-like game at last). FMOD is really fantastic sound engine, you write something like
float* spectrum = new float[64];
channel->getSpectrum(spectrum, 64, 0, FMOD_DSP_FFT_WINDOW_RECT);
and in spectrum array you have 64 0.0f to 1.0f values describing sound intensity by pitch. Right now I only take bass spectrum to describe wireframe width and glow size but it's really easy to make some fancy effects with it.

Now I have only 3 days left and the next big thing to do is instancing and frustum culling (yes, I still haven't done it).

Wednesday, February 20, 2013

Plasma gun

No screen today, only a little note.
Yesterday I've replaced static laser canon with a plasma gun. Technically you can imagine it as standard spaceship weapon in Star Wars series. It requires quite more of CPU cycles, but I think the result is worth it. Collisions in 3D can really be pain in the ass, fortunately I'm using XNA math library for vectors, matrices, etc. Is has this set of functions in xnacollision.h like:
So collision detection is quite simple with this. When I finally sit down and force myself to write instancing and frustum culling every model will have its own bounding volume which make collision detections even simpler and faster.

Tuesday, February 19, 2013

MVP ready!

MVP of Drumstep Defenders is on! Download it here:
And here's a little screen:

Fast track to beta version now! I need to replace laser with lightning machine gun, add few more enemies, some bosses maybe, and of course 2 more scripted tracks to play. Meanwhile, have you seen this video yet? It's hilarious :D

Monday, February 18, 2013

Only one more step to MVP

I really need to post every day I make something new... But, look at this, guys!

Only some graphical corrections and menu left for the MVP version. I've added 2 more enemy types, sounds, music and interface. After hours of fighting with Direct Sound I came to the "fuck-it" point and connected FMOD to my game, also fonts are rendered using GDI+ because (quoting
Unlike previous versions of Direct3D, Direct3D 11 does not have a utility library for drawing sprites and fonts.
Microsoft, really? You can't complicate these things more? Can't you?

Monday, February 11, 2013

Graphical update

So here's the render I called "bro, tell me in what direction this thing is placed".

Mothership, as well as laser cannon and asteroids got new meshes. Also I put some work into particles. It can be quite difficult to get the result above in the game, but the next thing is to make thinks look better by applying some nice shaders. The main problem seems to be not rendering diagonal lines at quads. Wireframe rasterizer state from DirectX renders all triangle lines by default and you can't change it. So my solution is to use another rendering technique. Gah, edges once more...

Sunday, February 10, 2013

Particle Sunday

Today's work: asteroid destruction particle effect and dynamic stars.

At collsion with laser, asteroids explode to little triangles. Screen above has auto-explosions enabled. With the time, triangles decelerating and getting more transparent.

At lower speeds we can see star points around. When we're getting faster and faster, points transforming into lines. The faster we get, the longer the lines.

These two effects were generated by the same particle system. Most of the work is done by stream-out of geometry shader, the C++ class is the same, only fx files differ. So right now I have wireframedExplosion.fx and stars.fx in use. Geez, I need to say that - Geometry shader kicks ass! You can do magic with it. Just gathered some EXP in my noob-to-pro path :)

Saturday, February 9, 2013

Drumstep Defenders prototype

After 3 days of work (too much I think), I've finished my game prototype. It's ugly, it's hardly playable but it has some core features:
  • FPS camera
  • Random asteroids from quasi particle system
  • Imma firin mah lazor!
  • Laser-Asteroid collistion detection

Prototype means - you can run core game mechanics. Now is my way to MVP, need to add some real particle effects, more enemies, upgrade graphics, etc.

If you want you can download prototype here:

Monday, February 4, 2013

Introducing Drumstep Defenders

It''s 4th already and I haven't started coding yet... But it's OK, accorting to this rules of course:
How to succeed at making one game a month
Drumstep Defenders is an ultra-fast space rail-shooter game. As an operator of a laser canon you're destroying hundreds of thousands of alien spaceships. All of that mixed with a wicked drumstep soundtrack by Tut Tut Child.
I decided to share some of my "work secrets" and public the needs and wants list. Maybe some of you will have any ideas how to make it better :)

  • Centric FPS camera
  • Wireframe rasterizer mode
  • 3 enemy types (asteroid, kamikaze and fighter)
  • Destruction particles
  • Stars in the background
  • 1 complete level loaded from a script file
  • Simple score interface
  • Minimalistic start menu
  • Drumstep music
  • Sound effects
  • Mothership model
  • Laser canon model with viewfinder
  • 3 enemy models
  • Game logo
  • Bloom/glow/blur effect
  • 3 complete levels
  • 10 types of parametrized enemies
  • Score particles
  • Chat-with-commander cutscenes
  • 3D start menu
  • 2D sound effects
  • Hi-scores table
  • Gamepad input
  • Power-ups
  • Different weapon types
  • 10 enemy models
  • Power-ups models

Don't forget to check out some of The Real Drumstep music!

Thursday, January 31, 2013

Shallow Blue v1.0

I haven't been posting 4 days in a row... Pity...

Fortunately that doesn't mean that I didn't work :) Shallow Blue is finished, I can say that. In fact there is always much more to do, but there is a deadline and it's all about finishing the game. I've spend last few days on a fight with WinApi, DirectX "sprites" rendering and some general bug fixes. Right now 3 play modes are available:
  • Player vs Player
  • Player vs CPU
  • CPU vs CPU
Here are some screenshots:

Feel free to download it and comment!

Saturday, January 26, 2013

Edges #2

Hello there! My second approach to edge detection is almost over. See what I got:

I know it's not perfect, but let me call them good enough. Normal vectors of faces are rendered to texture, then Sobel operator is applied and the result mixed with a regular render.

I had a really serious problem with my first render to texture. I didn't know why, but a geometry didn't wanted to render on a giver render target view. After hours of surfing I came at some really weird... It's because MSAA. I've turned it off and render-to-texture began to work, it's some DirectX issue that stands for disability to have more than one high quality texture in use (for MSAA).

Actually, I'm a noob so I don't know how to fix it :D So all I need is to implement supersampling, this should work, if only I'll make it ;)

But right now it's high time to get everything to work. Make some menu and stuff, then I can go to visual upgrades.

Friday, January 25, 2013

Edges #1

OK, so here's my first try to do toon edges. It looks very badly, but it's the simples method I've found. Check out this:

Oh It looks so nice on that turtle... Unfortunately only there. The mesh must be smooth to accomplish a good effect, other way the neighbouring normals will be orthogonal to each other and edges get gaps between them. Also, the line won't "stick" to an object, it can "float" a few units next to it. See it here:

Screen looks very untidy. This isn't a look I want to have ;)
So today I'll have more time to try the-way-better method; render normals and depth to texture, do a edge detection and mix it with a regular render. Simple post-processing but in fact, (another time) my first one ;)

Wednesday, January 23, 2013

Chess engine?

Yeah, I was thinking about connecting some chess engine to my game. Of course, I want to have a Player vs CPU option so there must be some AI. I had 3 ways to do it:
  1. Write my own chess AI algorithm
  2. Use a freeware chess engine
  3. Find some simple open source chess game and copy/paste game logic from it.
Guess what I choose.

I really don't think writing my own AI would be a good idea, it's a problem for a month alone. I just want to make a chess game, why breaking a open door?
There's a lot of ready-to-go chess engines over the Internet. It's a small, individual program that can make a chess decisions and communicate with a chess GUI by standard system pipes. Personally I think that it's the best idea - I just need to write some communication protocol based on the UCI or something. So I take a look over the Internet. OMG. After hours of searching I've found the article that describes this problem best:
And my reaction was:
OK, so here's my try. I've found this:

Yesterday I've made a Player vs Player possible version, so adding a CPU option to this should be quite simple. Today I'll try to connect these functions above...

Monday, January 21, 2013

Only juice

Juiciness day. I've made a lot of animations and graphical improvements today, added planar shadows also.

Board model is quite upgraded, I've finished with this boring rectangle and put some variations in it. Looks better I think. Another thing is model selections. If you click on a model, it will get a black cursor on it, and really, black is the only color I found useful for both of the sides.

Piece hovered by the mouse cursor is bigger than the others, just to see which one is selected (see tank above). I've also updated materials and lightning to make it looks better. I put my trust in cel shading all the time and probably will give it a try faster than I though.

Saturday, January 19, 2013


"Do you have a quarter? My mom told me to call her when I found the woman of my dreams?"
--Pickup Line Panda

No exactly what I mean, but yeah! Picking is ready!

The screenshot is really ugly (all they are?). Wild animated cursor appears when you roll in the chessboard. It was kinda easy to write, and it's quite quick 'cause I don't need to make ray and models interception. Only virtual chessboard representation (some simple horizontal quads) is checked. Also the current hovered model is a little bigger, I was experimenting with tweening in 3D, a piece of cake I need to say :) If you haven't seen this already, you need to:

The next step is units movement. They need to turn, ride and turn back. If I made this, the simple PvP game will be ready :)

Friday, January 18, 2013

Graphical problems?

Yeah, I dunno... I probably have some problems with my aesthetic sense. Really can't figure out what to do to make it looks better. Maybe next project I'll made with some "photorealistic" graphics so it will be easier that way...

Probably with cel-shading and some flat shadows under vehicles it'll look better. But I don't know, really :/

So graphical part need to sleep a little and get some rest. Time for picking implementation, then, some basic pieces movement - without any rules or something, just like real figures. At that stage playing PvP will be possible and afterwards will be the time for a chess engine :)

Thursday, January 17, 2013

The work is on!

Oh gosh... I got a terrible flu last Sunday. I wasn't capable of thinking not only coding...
So, from the OGAM POV I'm 5 days late.

Fortunately, I managed to sit on my ass today and do some work. Custom OBJ loader went to a trash, in case, it was junk :P I've used the Assimp (Open Asset Import Library) for importing my OBJ and MTL files and it looks alright. Quite simple to pin it to the project and extract all the useful-for-me data from its objects. But in fact, documentation for Assimp is terrible.

I've manage to load two models with different materials on mesh subsets. The funny thing is that I made "materials library" global, so I can take vehicle body material, change its color and all models on scene using this material will change its color as well.

Of course some simple instancing was made. You know, just for not loading and holding two identical meshes. 13 FPS on the screenshot below but we have here ~400 objects, no frustum culling and it's in debug mode, quite OK I think.

I've made my try to cel-shading. The only acceptable method will be the one with post-processing. Normals map need to be rendered for the full scene, then some edge detection algorithm implemented for this. I probably wait with that kind of stuff and right now focus on main gameplay :)

Friday, January 11, 2013

OBJ Loader

I've choose a OBJ extension to load models from. Its quite simple and popular. In the DX11 there's no more ID3DX10Mesh class, so all the utils thing like loading a mesh from a file gonna be made by hand. I know there's a lot of open libraries etc, but it's always better to write it by yourself for the first time.
So I haven't done much more than the LoadObj() function and some basic classes like Mesh, Material and Model. It's still much to write.

Thursday, January 10, 2013

The Project

Ok, the worst thing's done. I really like to code, make some funky classes, super duper functions, do refactoring etc. but the thing I hate is configuring the project. Adding all this dependencies, include and lib directories, project configurations... I'm really not into that kind of stuff.
Hopefully I can now start to code some basic DirectX encapsulation. I really don't want to make another 3D engine or something, but you know - there must be some layer of interface. Eventually this "core" classes will get better and better with making this project and next ones, after a year and 12 games it should be awesome :D Omg, I really believe in that :P


Ok, so we have a little change of plans. Green color was too similar to grass and was blending with it (omg, really?!), so I've come with a standard blue-red convention. Celshading is on only on units, it looks better that way ;) Of course the map could look a lot better and readable, but I think it's all I can afford right now.

Soooooo... I'm starting with the code tommorow. Just as now, I'll be posting daily about my next steps etc. I really can't wait to see that in game!

Tuesday, January 8, 2013


Nuclear King. Who gets checkmatted looses the atomic war. It reminds me of something ;)

Ok, so for now all chess pieces are up and ready. Tommorow I'm making a board, it will be in TBS map style!

Monday, January 7, 2013

Saturday, January 5, 2013


What a nice issue we have here. Smooth shapes are kinda hard to handle in this graphical style. I wonder what I'll do to make it look good enough in the game...

Friday, January 4, 2013

Thursday, January 3, 2013


As you can see, there're two color versions (black and white pieces are now green and yellow armies). Model was made in Blender, here we have a render with ambient occlusion and cel shading. I doubt if I'll make AO in the game, but cel shading should be achievable for me ;)