‘Making the Top Down Shooter Game: Aviator’ Unity Game Manual

‘Making the Top Down Shooter Game: Aviator’ Unity Game Manual

1 and a half year ago, I made a game called Aviator. Then, I thought of writing its manual. And I recently checked my old stuff and realized that I should post it on my blog.

At that time, I was learning Unity and its basics so, I never know a lot of techniques that I know, now. (Seriously, it could have been much easier)

Anyhow, the manual is step by step guide to make the game. The only issue is that I never completed it!

That includes the Graphical User Interface (partially done), the basic Sprite Sheet animation, Music and Sound Effects.

Not a complete package and that is why I am giving it away for FREE!

I am not giving the Unity Game Project itself due to some reasons. But I am sharing all the resources that I used in the game including the music. All the resources are not created by me and so, don’t blame me if you get into some copyright issues with your game. I am sharing those resources for educational/learning purposes.

I hope that the manual will greatly help you.


Aviator Manual: Download Link

Aviator Resources: Download Link

 

Advertisements

FALLINGbits: What is the status?

FALLINGbits: What is the status?

OMG!

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!

Working on Doboomler…

Working on Doboomler…

Finally…

Something decent enough to publish on the market.

BAC Studios is working on a new game called Doboomler.

It falls under the endless runner game genre (Don’t worry! It’s not another clone of Temple Run). Instead of running, there will be falling. It will be a ball with a face (see that image above). Then, DOBOOM, DOBOOM AND DOBOOM.Ā (Explosions are very common in the game)

I am currently developing it on Unity and using Inkscape to draw its assets. The journey is pretty much smooth. I am still struggling to fix so many bugs. I found drawing and redrawing assets quite tiring.

And still… it is just a small game.

But I ensure you that it will be addictive and fun to play.

I don’t wanna show much of the game until it is well polished and it has enough elements. Never mind that because I do have a deadline in my mind.

I hope that a lot of people will enjoy the game and all. I am very inexperienced in terms of marketing and advertising but I am trying my best to ensure that someone, somewhere would play my game. šŸ™‚

 

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

DON’T!

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;
	inputFile.open(inputFileName);

	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;
		}
	}

	inputFile.close();
}

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

void init()
{
	SDL_Init(SDL_INIT_EVERYTHING);
	window = SDL_CreateWindow("BoxBlurrer",
		SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
		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);
	SDL_UpdateWindowSurface(window);
}

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()
{
	SDL_FreeSurface(imageSurface);
	SDL_DestroyWindow(window);
	IMG_Quit();
	SDL_Quit();
}

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

int main()
{
	getInput("settings.ini");
	init();
	blur();
	while (!quit)
	{
		while (SDL_PollEvent(&input) > 0)
			if (input.type == SDL_QUIT) quit = true;
		update();
	}
	setOutput();
	clear();
	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!

C++ Programming Series: Dynamic Arrays (Part 2, Last)

Dynamic arrays can be used with functions in exactly the same way as I have told in this post. Just keep in mind that we have to pass the size of array into the function.

void printIntegerArray(int* pArr, int totalElements)
{
  for(int i = 0; i < totalElements; i++)
  {
    cout << pArr[i] << endl;
  }
}

int main()
{
  int* array = new int[5] { 3, 4, 7, 8, 12 };

  printIntegerArray(array, 5);

  return 0;
}

Note how I allocated the memory and also, set the value of all the elements in the dynamic array in the highlighted line.

That initialization of dynamic array is what the real purpose of this small post is. Why? Because dah! I learned that very late. Very very late.

At least, I am able to save others from this.

array[0] = 3;
array[1] = 4;
//...till the end :p

Also, there is another purpose of this post.

Tell me my mistake in the code.

If you already knew it before reaching this part, you must be a keen observer. There is no delete[] array; at the end of the code.

Damn those memory bees. (By the way, it is a genuine mistake)

This ends my C++ Programming Series. Now, to ease your path, there will be another post in this series. Keep coming back and you will always find bunch of useful stuff here.