I failed…

I couldn’t reach my target…

10 downloads of my game, FALLINGbits, in 30 days… Got only 1.

I am feeling very depressed. Maybe I am not good enough yet.

Maybe I need to put more effort and especially more time.

Time is of the essence. Maybe I…

It doesn’t matter anymore.

I will try again and again and, I won’t lose.

To those who supported me, thank you for your support. I really appreciate that.


FALLINGbits: What is the status?

FALLINGbits: What is the status?


I can’t believe it man! Seriously, this is amazing.

I got a download!

Look at the image below! A download. Really, whoever he is, he made my day. Thanks to him.

FALLINGbits Status #1
FALLINGbits Status #1

Now, 9 more downloads in 20 more days. If you want to help me achieve this target, here is the link.

To those who are thinking:

Wha? This is nothing. Seems like that someone did an act of sympathy. 6 views! What a lowly molly it is….

And so on… Yeah, you are right.

I just wanted to see how things goes on. The real thing is yet to come.

The reason for such less views is probably because…

  1. I never considered doing marketing.
  2. Itch.io has probablyĀ smaller audience who would like to download a game and play it on there Android phone rather than just play it on web.
  3. My game runs on Android only. (again same reason)
  4. My game is not good enough. šŸ˜„
  5. I have not paid much attention to my blog.

I have been very busy dealing with multiple stuff. But I will not leave my blog again.

Stay tuned for more. And do check my game on itch.io (the link is given above).

FALLINGbits on Itch.io

FALLINGbits on Itch.io

My first ever published game… šŸ˜€

Here is the link.

itch.io makes it easy for anyone to publish games and many more stuff into the market. It is just an experiment to see how well things can go over there.

My target is to get, at leastĀ 10 downloads in 30 days span.

Thank you for making it possible.

FALLINGbits is a straight forward game. It can’t be any simpler.

Avoid bits.

Keep the finger on the screen.

If you remove the finger, the game will pause. Colliding with the bits (squares) will result in losing the game.Ā A simpleĀ game worth playing.

It becomesĀ superĀ after 90000 score (90 seconds of playing one game).

Unfortunately, it is only for Android. File size is almost 1 MB only. You may face some issues if your device have the resolution of non-HD aspect ratio.

Some screenshots…


It is one of my old projects that I did with C++ and SDL2. I learned a lot during that time. Do tell me if you want some SDL2 tutorials here.

And yes, I didn’t forgot Doboomler and still working on it.

Try it. You may like the game. And if you do, don’t hesitate to comment!

C++ Programming Series: What’s next?

You wanted to get into game programming.

You found out that C++ is the real deal.

You came here and started reading the first post of the series.

You practiced and moved on till the end.

Now, you are confused what to do next?

(By the way, it applies to all the enthusiastic people who learned programming for the sake of making games.)

What you need to do now, is to google some simpleĀ C++ 2D Game Development Libraries.

Back in the days, SDL2 was my choice (I still use it a lot). SDL2 is pretty neat and it just clicked with me. But it does have drawbacks (for example, no easy-peasy shaders). If SDL2 is your choice, Lazy Foo’s SDL2 Tutorial Series is probably the best place for learning it. I also learned SDL2 from there.

People recommend SFML a lot. Even though I don’t use it, it won’t hurt you to try different libraries in the start and just go with what feels right.

Less features won’t hurt. But less personal compatibility will…

That is why I use SDL2. Even if there is not that something you need, you can craft your own hack to go through it.

Why not OpenGL library or just any library to make 3D games (like Call Of Duty and GTA)?


It’s impractical unless you got a thousand experienced people of all kinds working on it.


Why not a game engine like Unity for making 2D games?

Yeah, you can. In fact, it is awesome go and do it.

But you may consider this. They have a GUI, an editor and all fancy stuff that eases game development. And that makes your brain lazy and kinda limits your creativity.

I am not saying to built a game development career upon some C++ 2D Game Development Library (which honestly, won’t hurt). I am trying to imply the fact that doing code by hand and visualizing the game in the head will give you a much deeper understanding of what a video game is and how video game actually works.

And when you are satisfied with that experience, you can go with Unity like me.

How this deeper understanding thing works on a higher level?

It works. But you may not be able to see it working. Unconscious, maybe.

To see it in effect, just compare yourself with the one who went directly into Unity and you will realize yourself. You will be able to pick things faster than he would.

And please, take my words with a grain of salt.

So, that means I, as an individual, am stuck with 2D forever?

Hell no!

I recently started learning Blender (free, open-source 3D modelling and rigging software) and it seems like 3D is a viable option for any solo developer.

But yeah, as a solo game developer, no Call Of Duty or GTA forever.Ā But awesome games like Gone Home and Inside are always a good option for any experienced artist and game developer.

In the end, I would like to say to make as many complete games as possible. With every completed game, your experience gets higher exponentially as compare to half-baked games.

Here is the summary:

Programming -> 2D in Game Library -> 2D in Game Engine -> 3D in Game Engine

What if I learned C++ for some other purpose?

Well, I don’t know the specifics but you can go for that purpose as hard as you can.

Sorry, I don’t have much advise on that, other than the fact that you shouldn’t go big on what ever the purpose is. Always try small and then, step towards bigger things.

Box Blur with SDL2

Box Blur with SDL2

Originally, this post is intended to be on cplusplus.com as an article of mine but they never accepted it. So, I thought why not just put it on my own website. If you know what the heck SDL2 and C++ is, you can understand the technique.

What is Box Blur?

Box Blur is a very easy technique of blurring an image. It is based on the fact that there is replacing of the color of a pixel with the average of all the colors of its adjacent pixels. With that said, the number of adjacent pixels can be increased or decreased, giving us the option to increase or decrease the extent of blurring effect as well.

The Implementation

First thing, you should know basics of C++ as well as a bit of SDL2. You should know bit shifting, some commonly used color formats and image formats.
We are going to use SDL2 along with SDL2_image. SDL2_image allows us to work with many image formats. We are only going to use PNG image format.

It is going to be a single file project and there will be no exception handling.

We are not going to make UI for managing things like input image name or blur extent. But we do have a settings file acting as input which will provide necessary data to work properly. Therefore, we will include fstream header.

We will also have some safety to know our errors and for this, we need to include iostream. All other headers are as expected.

#include <iostream>
#include <string>
#include <fstream>
#include <SDL.h>
#include <SDL_image.h>

Now that, we talked about input, there are variables to keep them too.

//Input data
int window_width = 800;
int window_height = 600;
std::string input_image_name = "inputImage.png";
std::string output_image_name = "NULL";
int blur_extent = 1;

There will be no SDL_Texture. It is almost useless to have textures because we have to do pixel manipulation with it, all onto the CPU in one way or the other. SDL_Surface is ideal for direct pixel manipulation onto the CPU.

//SDL structures
SDL_Window* window = NULL;
SDL_Event input;
SDL_Surface* windowSurface = NULL;
SDL_Surface* imageSurface = NULL;

bool quit = false;

A simple function to get input from a file in a proper way.

void getInput(std::string inputFileName)
	std::ifstream inputFile;

	if (inputFile.fail())
		std::cerr << "ERROR: Failed to open " << inputFileName << "." << std::endl; 	} 	else 	{ 		while (inputFile.good()) 		{ 			std::string tag; 			inputFile >> tag;

			if (tag == "[window_width]") inputFile >> window_width;
			else if (tag == "[window_height]") inputFile >> window_height;
			else if (tag == "[input_image_name]") inputFile >> input_image_name;
			else if (tag == "[output_image_name]") inputFile >> output_image_name;
			else if (tag == "[blur_extent]") inputFile >> blur_extent;


After getting input, it is time for initializing the systems.

void init()
	window = SDL_CreateWindow("BoxBlurrer",
		window_width, window_height, SDL_WINDOW_SHOWN);
	windowSurface = SDL_GetWindowSurface(window);
	imageSurface = IMG_Load(input_image_name.c_str());

After initializing the systems, we have to blur the image that we loaded in.

Box blur is just averaging the color values of adjacent pixels and then, using it as the color values of that pixel. It is called box blur because of the fact that it is always done in a square.

void blur() //This manipulates with SDL_Surface and gives it box blur effect
	for (int y = 0; y < imageSurface->h; y++)
		for (int x = 0; x < (imageSurface->pitch / 4); x++)
			Uint32 color = ((Uint32*)imageSurface->pixels)[(y * (imageSurface->pitch / 4)) + x];

			//SDL_GetRGBA() is a method for getting color
			//components from a 32 bit color
			Uint8 r = 0, g = 0, b = 0, a = 0;
			SDL_GetRGBA(color, imageSurface->format, &r, &g, &b, &a);

			Uint32 rb = 0, gb = 0, bb = 0, ab = 0;

			//Within the two for-loops below, colors of adjacent pixels are added up

			for (int yo = -blur_extent; yo <= blur_extent; yo++)
				for (int xo = -blur_extent; xo <= blur_extent; xo++) 				{ 					if (y + yo >= 0 && x + xo >= 0
						&& y + yo < imageSurface->h && x + xo < (imageSurface->pitch / 4)
						Uint32 colOth = ((Uint32*)imageSurface->pixels)[((y + yo)
                                                * (imageSurface->pitch / 4)) + (x + xo)];

						Uint8 ro = 0, go = 0, bo = 0, ao = 0;
						SDL_GetRGBA(colOth, imageSurface->format, &ro, &go, &bo, &ao);

						rb += ro;
						gb += go;
						bb += bo;
						ab += ao;

			//The sum is then, divided by the total number of
			//pixels present in a block of blur radius

			//For blur_extent 1, it will be 9
			//For blur_extent 2, it will be 25
			//and so on...

			//In this way, we are getting the average of
			//all the pixels in a block of blur radius

			//(((blur_extent * 2) + 1) * ((blur_extent * 2) + 1)) calculates
			//the total number of pixels present in a block of blur radius

			r = (Uint8)(rb / (((blur_extent * 2) + 1) * ((blur_extent * 2) + 1)));
			g = (Uint8)(gb / (((blur_extent * 2) + 1) * ((blur_extent * 2) + 1)));
			b = (Uint8)(bb / (((blur_extent * 2) + 1) * ((blur_extent * 2) + 1)));
			a = (Uint8)(ab / (((blur_extent * 2) + 1) * ((blur_extent * 2) + 1)));

			//Bit shifting color bits to form a 32 bit proper colour
			color = (r) | (g << 8) | (b << 16) | (a << 24); 			((Uint32*)imageSurface->pixels)[(y * (imageSurface->pitch / 4)) + x] = color;

After blurring, we want to make sure that we can see the blurred image on the screen.

void update()
	//Putting surface onto the screen
	SDL_BlitSurface(imageSurface, NULL, windowSurface, NULL);

At the end, when we are quitting the program, we want to make sure that the blurred image is saved as a PNG image file. If we don’t want to have any saved output, we use “NULL” as the output image name.

void setOutput() //For saving image as PNG
	if (output_image_name != "NULL")
		IMG_SavePNG(imageSurface, output_image_name.c_str());

Now, just need to clear the resources.

void clear()

Getting everything in one piece, all in our main function!

int main()
	while (!quit)
		while (SDL_PollEvent(&input) > 0)
			if (input.type == SDL_QUIT) quit = true;
	return 0;

It’s pretty much straight forward and I hope that you understand that…

To those who loves to criticize, I know it could be way more better than that if we could change the blur extent by pressing some key and having its result instantly on the screen, or if we make another input tag for image format. But I think that we should keep things simple…

The Results

Unfortunately, I couldn’t post the images. But you can try and see it for yourself.

If you want to show some better pixel manipulation, I will appreciate it!

Developing a Game: SamuraiDuel

Now-a-days, I am developing a game called SamuraiDuel. It is going to be a 2D game and being built on OpenGL, SDL2, Box2D and CEGUI all in the language, C++.

SamuraiDuel Title
SamuraiDuel Title

Before starting to develop the game, I first developed the base ofĀ aĀ very low level Game Engine which I should call a GL Engine, GL SDK or something like that, in order to work with OpenGL with ease. Of course, I called it BAC GL EngineĀ 2 (I tried to make oneĀ before but it has some big flaws and so, I put ‘2’ this time after the name).

I am not satisfied with that name. If you had one in your mind, please do comment below.

SamuraiDuel is going to be a side scroller fast paced pixelated game. Of course, it will take time to get completed and once it is completed, this is the place where I will confirm this.

There is the screenshot of the game! I hope that you like that…


All pixel arts are made by me and I think it looks fair.

That’s all that I have to say! If you want some features in it or just has something to tell, comment below and tell that to me! It will be really appreciable.

UPDATE: The project is closed and is no more under development due to lack of funding and maybe, motivation. Sorry guys! But who knows… I might complete it someday!

Hello World!

cout << “Hello World!” << endl;

Hello there,

I am Bilal Ahmad Cheema and this blog is all about programming! Learn C++, create tiny programs and if you encounter some errors, ask me and the community for a fix. Its about innovative programs which are made using some easily understandable colorful logic! It’s about the game that we all want to develop! It’s about the algorithms that feels hard although, are very easy.

It is the very first post of this blog. There is not only C++ but there is Java as well. For C++, there will be programs related to SDL2, Box2D, OpenGL and Bullet. For Java, there will be programs related to standard JavaFX only. I am not an expert programmer. Therefore, I am not a magician. But I am interested in programming. To know more about me, check out My Story.

Feel free to ask! Its about sharing and caring!