Monday, October 21, 2013

My friend Piotrek Czerwiński had an alternative to snippet no.2

template struct WRITE {
	static void write()
	{
		cout<::write();
		cout< struct WRITE<100> {
   static void write()
	{
	}
};


int _tmain(int argc, _TCHAR* argv[])
{
	WRITE<0>::write();
	return 0;
}
This is made by partial template specialization :)

Interesting code snippet no.2

I was presented with a very interesting problem by someone - print out numbers from 0-100 and from 100-0 not using conditional statements and while loops. This is what i came up with:

#include 

using namespace std;


void endRecurence(unsigned int currVal, unsigned int endVal);
void countUpDown(unsigned int currVal, unsigned int endVal);

static void (*functionArray[2])(unsigned int, unsigned int) = {countUpDown, endRecurence};

void endRecurence(unsigned int currVal, unsigned int endVal)
{

}

void countUpDown(unsigned int currVal, unsigned int endVal)
{
   int isEqual =  static_cast(currVal) / static_cast(endVal);//will round up down.

   cout << currVal << endl;
   // You should check if isEqual is bigger then the dimensions of the array but we don't own if's :)
   ::functionArray[isEqual](currVal + 1, endVal);

   cout << currVal << endl;
}

int main()
{

    countUpDown(0, 100);

    return 0;
}

Basically we abuse two things - function pointers, and rounding up down by division and int conversion principles in c++, you can even do an elimination of + operator :)

Stack Overflow as a source

Addition algorithm in asm

i will provide a snippet for that in a later date :)


Wednesday, October 9, 2013

The king's spin patch 0.2

I forgot to post this here:


Interesting code snippet

void wierdWhile(int count)
{
    int n = (count-1)/8 + 1;

    switch(count %8)
    {
        case 0: do{
        case 1: foo();
        case 2: foo();
        case 3: foo();
        case 4: foo();
        case 5: foo();
        case 6: foo();
        case 7: foo();
        }while(--n > 0);
    }
}

void foo()
{
    printf("Foo here, i'm giving you the bar.\n");
}
Yes. It compiles (ANSI C).
Yes. It works(if my memory is not screwing up).

What does it do? A very simple thing that in embedded coding might be very useful. The jump from while is not such a low cost operation, so to save while rolls this little helper is used. It was presented to me while applying to one company. The recrutation process didn't go as planned since this code blew my mind a bit.

Hope It'll help you in some way!

Saturday, October 5, 2013

My current thoughts on 3d vision use

Here's  the teaser of sigraph 2013, fist think in the teaser - 3d model creation from depth map.



Hideo Kojima in his new game Metal Gear Solid V is using 3d vision to get the best data about the materials and for model scanning.

Why do i call it 3d vision? I think the term stereo vision is too small, since when we have more cameras we can achieve more detail :)

It's clear to me that 3d vision brings new quality to the game industry, i need to push my schedule to get in touch again with this technology, 700 series of GTX brings a cheaper TITAN to our houses - that's a huge step for CUDA and OpenCL also the open documentation for linuxes for both NVidia and AMD brings alot of good thoughts. Flash encoders are starting to take advantage in it - mostly Open Broadcaster Software.

Recent developments in matter of affordable 3d vision is extreme! It starts with John Carmack beeing a CTO of the oculus ritf. This technology really emerges the player into the gameplay. But it lacks a manner of augmentation You say? Well there's Haptix - a brand new stereo camera that is designed to be used as a 3d mouse with pressure recognition on any surface with multitouch. With it's high FOV and fps on both eyes - makes a great tool to extend and improve any 3d vision laboratory. For any



But you don't want to count all those dense disparity maps - that is possible - with leap motion you can determine 3d position of fingers above the reader (i know it's not 3d vision but it's extremely cool and speeds up work immensively with gestures, 10 point multitouch and drawing in the air)




If you don't want to count disparity maps, and you want augmented reality search no more. Recently there was a development made that in my honest opinion outgrows google glass by far. It's called Space Glasses Yes it's expensive, Yes there's not alot of Meta.01 models left - but it's the first heads on transparent display - the transparent surface on the glasses is a display - not a 1080p but enoughly good ones( two 960×540) to make work of 3d artists more interesting



, and augmented reality researchers work much more enjoyable.


It comes with a set of quite accurate i must say algorithms  it has accurate accelerometers and brings an extremely good stereo camera (23-degree field of view, a 720p camera, a 320×240 infra-red depth camera)

All this 3d goodness was brought to us by Kickstarter - if you don't know what's kickstarter - you will be a happy camper searching for things you thought are impossible to get at a consumer level.

And now from the creators from kinect itself comes probably something that nobody would expect, a 3d scanner that you can mount to your.... IPad.



Structure sensor is in my opinion the project of the year. As of time while i write this article you can get Your own sensor as fast as possible. I still need money to get all those things + some other peripherals. For now leap motion it's on it's way and i'm very happy from that. It will start my 3d investigations once again. I had a good feel that 3d vision will be a huge point of interest in the near future when I've started my little experiments with it. I just cannot wait to get evil scientist fingers on all of this technology and create something outstanding in my slippers and robe, drinking Yerba Mate and listening to Jimmy Hendrix all the way up on the speakers.


Monday, August 19, 2013

Ludum Dare #27

PolishRAD team

no.27

This year I've made a prommise to myself that I'll take a part in Ludum dare. An oportunity arised when I've started looking for coders. Initially it was suppose to be 4 coders 3 3d artists. The 3d artist count stayed unchanged, but the squad changed, unfortunetley there are only 3 coders now.

But to the point. With my frien Michax from animuj.com we've tried to warmup with unity3d - the expirience was very pleasant. The engine is everything you need to experiment with rapid development and write prototypes, unfortunate I don't see it beeing my end engine due to lack of access to low level c++ code.

The warmup concept: Google Document.

The warmup from my side looks like this: http://www.twitch.tv/mironixdevelop/c/2777926

The warmup part from michax looks like this: https://dl.dropboxusercontent.com/u/25801721/wm_preview_hq.mp4

In the end we didn't merged - i had to end my ludum dare at 11:59pm saturday and made a one sitting 25h of coding a 3-rd person controller with colisions, physics, changing animations according to the vector of movement, jumping and running wit free camera and a crosshair. I've didn't manage to do croaching, item drop system and inventory system with item system, The expirience was extremely fun  - especially with a bunch of ppl watching on twitch and asking questions. It allows to check Your brain database and makes You feel less stagnated and relaxed.

Not sleeping for 25h last day didn't allow my dear friend to fight the nature of sleeping. We didn't merge on his map in the end - but who knows what will be the theme of ludum dare - maybe magically we'll fit :)

I have a bunch of ideas waiting - but since the number of coders is lower then expected - we need to limit the scope. Maybe next LD? See you at the start!

Thursday, February 7, 2013

Super Hexagon image processing gamer plan




Since this game was finally released on PC and it's a perfect field for real time image processing experiments, due to distinctive patterns and never ending gameplay i will try to do an auto player (certain words are missed due to google positioning system). Initially I want to programacaly go for 10s in hexagonest mode, we will see how that will go.

Targets

1. Feed the game feed to OpenCV

I will use dxtory to get a feed from the game, it will be delayed but while experimenting we will se if it will be a huge issue, since in this mode you have quite alot of time to react programically speaking. If the delay will be too huge i have a capture card that will feed me image with 1 frame lag. capture cards are visible as additional cameras in the system

2. find the center and find it's x,y,z rotations x,y,z differentials

This is the essential step, due to unique pattern in the middle we can track the middle and the offsets, they will affect the entire alforithm, we will try to normalize the image to normal view

3. find the player triangle.

We need to draw an elipse arround the middle, scale it up untill we hit a pixel from the triangle.

4. find the tracks, derermine count of tracks

Here i'm still thinking. I have several ideas that I don't want to share now, I need to see if they will be optimal.

5. track the obstacles on the track

We will track the obstacles, they may be nonrectangular that's why we will use a line scanning algorithm on the track, we will have 6 binary array that will determine if the track is closed, we wil feed that information with position of the player to the neural network.

6. create and learn CUDA neural network or an genetic algorithm that will determine the direction of spin

In this part we have 3 choices - stay, move left, move right we need determine it depending on which path we are, how many dimensions there are, distance to change path and


Also this shows how hard our eyes and brain needs to work to actually play this game :) but this algorithm don't care about color changing due to binarization of images and rotations of the entire map, which our brain must compensate.

That's all for now, i will see you around.

Tuesday, December 18, 2012

Ludum dare challange of my dear friend

My friend was in the ludum dare challange, he's project called  Alien Cow Kidnapper 2  is located here:

http://www.ludumdare.com/compo/ludum-dare-25/?action=preview&uid=14308

Please support him if you can!

My target for the next year is to do at least 3 ludum dares. I've tried to get prepared on this years december ludum dare but i have 2 projects on my head (and i'm proud of the way they've developped!) in VoipSwitch, that's why i  really need to focus on professional life. My gaming experiments must wait, but i'm patient and i feel the fun that i will bring in the deepest depths of my bones :)

Saturday, July 28, 2012

Google fiber and my thoughts



Why google want's to deliver you better internet and television for a lower price than others? Is it because they are good and they are expanding? I think there's something deeper in that, google is known for it's agility in delivering accurate ads, imagine if they knew everything that you watch on the internet, what types of files you are downloading and what are the contents of those files, in addition they want to track your netflix and tv programms that you watch. You think it's too much to store for google, you are probably wrong, google has almost unlimited storage. They will say you that this data is safe with them and no 3-rd party will get it, it may be true, it may be not. I know that for many people it will be a good service, cheap, from a very powerful provider with almost instant fix for any problem that you encounter. Maybe google will work with police to help prevent crime on their ISP service, maybe hackers will never get the data collected by google, maybe they will never use data collected there, but i think this will be a little punch for the free internet. I know that it's a harsh statement, but i will speak loud about that what i don't like, i won't even guarantee you that i'm 100% correct, those are just my loose thoughts that i wanted to share with you dear readers. The best thing is - i'm writing that on a service delivered by google - blogger is owned by them :) .