środa, 23 listopada 2011

2 Fast 4 GNOMZ

This is the second game in Gnomia world, look at the first one. While GNOMZ was a multiplayer game, 2 Fast 4 GNOMZ is an exclusively single player game, just like the previous one - made by QubicGames for WiiWare service. This time our goal is to run through the world of Gnomia to find a woman and, of course, collect socks. There are four characters that you can morph into, that's why there is '4' in the title. The game is quite indie in style and is strongly related to Bit.Trip Runner and Super Meat Boy in a matter of difficulty. Our goal was to create a game that is really a challenge, only for hardcore, oldschool gamers. My role at 2F4G was project management and lead programming. There were 11 people working on this title development, including programming, visuals and audio.





piątek, 4 listopada 2011

GNOMZ on the market

I can proudly say, that my youngest child - GNOMZ, was finally published on WiiWare, USA. Read more at gnomzthegame.com. You can also buy the game, visit nintendo.com

I can also say, that Gnomia is such an inquiring world, that we are allready working on another title that is going to be placed there. This has been already announced on nintendolife.com by Michał Dys, our PR fella ;)

piątek, 16 września 2011

With or without GPU, that is the question...

This post just represents my thoughts about how people get into some hi-tec trap. They know how to create some eye candy effects, like fish eye or chromatic aberration with GPU shader with 5 lines of code or less - that's cool. But when it comes to a situation when people don't have those shaders for their support, they get confused and say "that's impossible, you can not create such effects without modern GPU" and that's bullshit. A good example is the platform, that I'm currently working on - Wii. I can not say anything more technical about this platform due to some legal rights, but I can say (and everybody know it) that it's rather a low-end hardware. Let's get back to those effects that I've mentioned. You can create some approximation (simple fake, but that's what graphics are all about, ain't it?) using simple linear texture filtering - just create a grid of quads with regular mapping and distort their positions in some manner. With fish eye - just create radial distortion with strength proportional to distance from center of the grid. It looks quite good and is extremely cheap both in performance and implementation.Chromatic aberration - draw red channel on such grid with horizontal distortion with some strength, then green one with 2/3 of this strength and blue one with 1/3, mix them using additive blending et voila!

As a conclusion - this can be really simple, just don't ever think that something is possible only on new GPUs or CPUs or whatever, stay open-minded :) I think that this is quite what low end hardware demoscene is all about.

niedziela, 28 sierpnia 2011

Class method as template parameter

I had an interesting problem that can be solved using a little bit tricky C++ code. Imagine a singleton that holds some pointer to a class that has many methods with identical params, but different purposes. Now, imagine you're creating some wrapper for this class in some other class (the first one was a ID3D11Device in my case, so I didn't modify it) and your code is also identical, despite this single method call. You can obviously copy paste this problem, creating n-times more lines of code. But this is an ugly solution, so below I paste the nice one. Class A is the ID3D11Device, class B is my wrapper. In my case fun1 was enough (i knew A type while implementing this), but because i find this useful - i paste code for case with unknown A type. Of course in practice, fun1 and fun2 would be big functions with this single call embedded somewhere deep.

struct A {
void a(int param) { std::cout << "a " << param << std::endl; }
void b(int param) { std::cout << "b " << param << std::endl; }
};


struct B {
template< void (A::*F)(int) >
void fun1() {
A* a = new A; // obtain A, this may be singleton or anything else
(a->*F)(1);
delete a;
}


template< typename T, void (T::*F)(int) >
void fun2(T* t) {
(t->*F)(2);
}
};


int main() {
B b;
b.fun1< &A::a >();
b.fun1< &A::b >();


A a;
b.fun2< A,&A::a >(&a);
b.fun2< A, &A::b >(&a);


return 0;
}



The only aspect that may need some explanation at the moment is how to pass ID3D11Device method marked with STDMETHODCALLTYPE as template parameter. Notice, that STDMETHODCALLTYPE is just a macro for __stdcall. We can pass this additional keyword using syntax like:


template< HRESULT (__stdcall ID3D11Device::*CreateShader)(const void*, SIZE_T, ID3D11ClassLinkage*, ID3D11VertexShader**) >
bool load_(const char* filename) {
...
}

Ok, now for the real example - the code will be a little bit more tricky, because we have to use derived template param as param for functions used as template params, blah, compliacted - look at the code :)

template< typename ShaderType >
class Shader {
protected:
ShaderType* shader;
public:
Shader() {
shader = NULL;
}


virtual ~Shader() {
if(shader) {
shader->Release();
}
}


template< HRESULT (__stdcall ID3D11Device::*CreateShader)(const void*, SIZE_T, ID3D11ClassLinkage*, ShaderType**) >
bool load_(const char* filename, const char* entryPoint, const char* shaderModel) {
...
}


template< void (__stdcall ID3D11DeviceContext::*SetShader)(ShaderType*, ID3D11ClassInstance* const*, UINT) >
void bind_() {
...
}
};


class VertexShader : public Shader< ID3D11VertexShader > {
public:
__forceinline bool load(const char* filename) {
return load_< &ID3D11Device::CreateVertexShader >(filename, "mainVS", "vs_4_0");
}


__forceinline void bind() {
bind_< &ID3D11DeviceContext::VSSetShader >();
}
};


class PixelShader : public Shader< ID3D11PixelShader > {
...
};


class GeometryShader : public Shader< ID3D11GeometryShader > {
...
};


class DomainShader : public Shader< ID3D11DomainShader > {
...
};


class HullShader : public Shader< ID3D11HullShader > {
...
};


class ComputeShader : public Shader< ID3D11ComputeShader > {
...
};


Of course you may decide to make load and bind virtuals, and to pack them into some kind of manager - this is just a design decision, whether you want to automate use of those classes. In such case design would get a little bit more complicated. My load is virtual, bind isn't. Additionally, VertexShader is strongly coupled with VertexLayout (ID3D11InputLayout), which is created while loading, so my structure looks something like this:


środa, 24 sierpnia 2011

GNOMZ the game

GNOMZ is a WiiWare multiplayer hot seat action platformer developed by QubicGames. I worked over this project as lead programmer and project manager since january till august 2011. You can read more about this game on GnomzTheGame.com. I also wrote some paper about implementing AI in GNOMZ, you can read it here.






Reviews:
  • "I would say that Gnomz is an excellent multiplayer game"
  • www.gev.com


sobota, 6 sierpnia 2011

Smart Traffic Signs

Recently, I've been traveling more than 4k km by car, and I had some time to think about stuff not connected with gamedev. In Germany I've noticed a strange sign - speed limit depending on slipperiness of the road surface. It was strange, because there were no precautions if weather is ok, so you can go 300km/h if your car can, and in case of rain you can go only 80km/h, so it's quite discrete. And than the idea came - why not measure the state of the road and show the speed limit in electronic form. For example in dense rain - 80km/h, in snow - 50km/h, in light rain - 120km/h and so on. We kept going, and on the bridge there was a sign - in case of wind, 100km/h or something like this. The idea is even better here - just measure wind speed and show appropriate limits. The method is great because the sign can measure a lot of parameters at a time, and using some heuristics it can show the speed limit, or some other information. What other info? For example - imagine a sign showing a pedestrian crossing. If you go at night you usually can't see anything, so slowing down is the only option, but even going 50km/h is too much if someone enters the crossing. The solution is simple - show some additional info, that there is someone near the crossing, so that the driver knows that he has to stop, not only slow down. It's not easy to implement, but in my opinion it's not impossible. Smart signs can also take into consideration some other stuff, like traffic - read this. In my opinion, the method has almost no limits, and would really improve safety on roads. The only question is, will politics spend money on our safety? I don't think so, they need money for PR :)


Let's go further - the speed limit also depends on the car, for example big truck should have much bigger limits. Why not implement traffic signs... in cars? Imagine a display that shows you the limit, or in extreme it can even automatically limit your speed. The idea can be really simple - all traffic signs have some transmitters attached, that broadcast restrictions at some place (some norm would be required). Receivers collect those broadcast, and analyze them, for example taking into consideration mass of the car, state of it's tires and so on. But for now this is rather science fiction, because all cars would have to implement this. Maybe it's a good moment to start such revolution, this depends on motorization brands. Remember, that such a solution doesn't have to mean that we remove all "classic" signs - they can stay, we can just add some new features to them.

czwartek, 7 kwietnia 2011

Tempy Guardian, 3rd place in IGK'2011

This is our entry to IGK'2011 8 hour competition. Our - I mean my team, that is:

  • Michał "Sobol" Sobiecki (me) - shaders & rendering, catapult, most of the framework
  • Maciek "Słoń" Stefańczyk - gameplay (with Box2D), sound framework
  • Kacper "Szkudi" Szkudlarek - sounds, level design
  • Oskar Świerad - all graphics and animations

Compo theme was "Temple Guardian", and orgs ment tower defence by this. But we decided to create an anti-game, with Godzilla as Tempy Guardian (it means stupid guardian in polish). The guardian is so stupid, that he can not defend the temple, that is nuclear plant, because he prefers to dance. We have to destroy green pulsating radioactive something with blue teddybears thrown with the catapult. Simple, but fun. And that was our goal.

During the competition, we have created 90% of the code. We didn't manage to finish particle system (due to stupid bug... sic!) and stuff like this. But as I said, 90% of the game was created during the compo, including all 8 levels! We've placed 3rd, out of 12 teams.


poniedziałek, 21 lutego 2011

Remote Racers (QubicGames)

Remote Racers is a 3D racing game for Nintendo DSi platform. I worked over it as a main programmer after project reactivation (September - December 2010). The game was developed and published by QubicGames. On the 21st of February, 2011, the game showed up in DSiWare market in the USA. The trailer is available on YouTube. You can also visit projects official website.


wtorek, 8 lutego 2011

Modelling thrown powder snow phenomenon for computer animation

This project is my Bachelor's Thesis on Warsaw University of Technology, Department of Electronics and Computer Science. The original title is "Modelowanie zjawiska wzbitego puchu śnieżnego dla potrzeb animacji komputerowej".

Abstract
The present thesis describes a fluid simulator based on nonlinear Navier-Stokes equations. The way of creating a stable solver is described. There is also some information on how to create vorticity confinement improvement. Next, the way of rendering solver output data using Blender 3D software is presented. Finally, the paper presents some examples and gives an insight into the implementation of the solver.

You can watch some effects on YouTube: [1][2][3][4][5]. I graduated with "5" mark (very good) on the 8th of february 2011.