It has been a while since I posted anything on the blog. That's because I've been busy for some time. Recently I released a game on Steam and still working on Alien Planet. In addition to that I am learning blender from a youtube channel called "blender guru". The videos are fun and very easy to follow. I managed to follow the tutorials and managed to get some simple results. My first render is below:
Tuesday, November 27, 2018
Friday, September 23, 2016
Game Development: Alien Planet - Adding Gun and Shooting Enemies, and Passing Through Gates
The player can now equip a weapon, and use it to shoot enemies. The shots are basically a sprite. A collision detection is used. If a collision happens, then the shot is removed from the sprite list. The enemy HP is decreased based on the shot attack power, and when the HP for the enemy reaches zero, then the enemy is removed from the list.
Another added feature is the use of a gate. If the player is equipped with an ID card, and he is colliding with a gate, then a check for the ID card is made. If the ID card exists, then the collision detection has no effect on the player, i.e. the player passes through the gate, otherwise, the x, and y for the player is set back to the coordinates of the previous frame. This means the player is unable to pass through the door.
Another added feature is the use of a gate. If the player is equipped with an ID card, and he is colliding with a gate, then a check for the ID card is made. If the ID card exists, then the collision detection has no effect on the player, i.e. the player passes through the gate, otherwise, the x, and y for the player is set back to the coordinates of the previous frame. This means the player is unable to pass through the door.
Wednesday, July 6, 2016
Game Development: Alien Planet - Adding movable rocks
Movable rocks are good item to have when creating puzzles. For this reason I added them. Each movable rock is a sprite. The game checks if any sprite is colliding with a movable rock. If the player is colliding with a rock, then the rock speedx, or speedy is changed from zero to some value to make the rock move. The value is dependent on the direction of the player. In addition, the player current x and current y is set back to the x and y from the previous frame. This is needed to prevent the player from stepping over the rock and skipping it.
In addition to the above, a check for the rock and its collision with other rocks or tiles is needed. If so, then the rock should never move. This is done by simply setting speedx and speedy of the rock to zero, so even if the player is pushing the rock, it stops when it reaches water or collide with another rock.
Finally if any other sprite/enemy is colliding with a rock then the new x, and y for that enemy is the same as the previous frame thus preventing enemies from stepping over the movable rock.
Monday, July 4, 2016
Game Development: Alien Planet - Re-spawning item
Recently I managed to find a very simple solution for the re-spawning problem. The main issue is that once the player picks an item ( in my case it is fruit ) from the map, the map data structure is updated, and the fruit is removed from the map. The game saves the updated map which means that the item/fruit is lost forever and no replacing item could appear.
This problem is the result of bad tile map design. Probably what should have been done is to store a map state data structure separately. That data structure states where the items are and if they should re-spawn or not. Instead of redesigning the data structure of the game state, a much easier workaround solved this:
1- define an invisible item, that the player can't interact with, call it for example (re-spawn item)
2- during game play if the player picks an item/fruit, then replace the tile containing the fruit with the (re-spawn item).
3- every time the game map reloads, check the tiles searching for the (re-spawn item). If found, then generate a random number between 0 and 1, if the value is less than 0.05 then convert the (re-spawn item) to an actual item that the player could interact with.
This modification needed about 20 minutes to finished and managed to solve the issue very easily.
Friday, July 1, 2016
Game Development: Alien Planet - SDL_Mixer audio problem
One of the issues I had to fix in the game was playing sound effects. For sound effects I am using SDL_Mixer. The issue I am facing was whenever I issue the command to play a new wave file/stream, the previous audio stream stops. There is no mixing happening. So, for example if you are picking a fruit while walking the audio of picking the fruit get cut and the walking audio starts immediately.
To solve this issue I used the "Mix_PlayingMusic()" function which returns true if an audio effect is playing, and false otherwise. First I created a function that loops over all the sound effects and see if any is playing. If none is doing so, then the function returns false. The game checks the result of this function before playing a new audio effect.
This solved the problem partially, what happened is that the walking sound disappears for few seconds after picking fruit. It turns out that the picking fruit audio file has few seconds of silent audio at the end. So, SDL_Mixer was playing silent audio and returning true for few seconds. The solution to this was to use Audacity to remove the trialing silent audio from all the other files, and everything worked perfectly fine.
To solve this issue I used the "Mix_PlayingMusic()" function which returns true if an audio effect is playing, and false otherwise. First I created a function that loops over all the sound effects and see if any is playing. If none is doing so, then the function returns false. The game checks the result of this function before playing a new audio effect.
This solved the problem partially, what happened is that the walking sound disappears for few seconds after picking fruit. It turns out that the picking fruit audio file has few seconds of silent audio at the end. So, SDL_Mixer was playing silent audio and returning true for few seconds. The solution to this was to use Audacity to remove the trialing silent audio from all the other files, and everything worked perfectly fine.
Thursday, June 30, 2016
Game Development: Alien Planet - Results after one year.
It has been over a year since I started working on "Alien Planet" which is an RPG game written in C++, and uses OpenGl for graphics acceleration. Working on a game is such a time consuming process especially if you are not working with a team and have to do everything yourself. Time went into the following:
- Developing code to simplify the use and access of OpenGL, and make the project sprite friendly. This took about a month or so.
- Developing the sprite sheet: this took over 4 months. I ended up using MS. Word, and Gimp for that.
- Developing code to simplify the keyboard and controller input.
- Developing a map rendering engine.
- Developing a map editor.
- Developing map save, and map load routines.
- Working on the splash screens, and profile selection.
- Profile load/save, and map navigation.
- Sound effects, and game music, which are done using LMMS, and Audacity, with recording from the mobile phone.
- Developing code to implement a Finite State Machine model which is used to control enemies.
a screen shot of the result is shown below:
The engine isn't finished yet, and features and bug fixes are being added while developing the game maps.
Currently the game has two maps/screens. More maps will be added later on, however the progress of the game is very slow since I work on it an hour or so every few days.
Next things to do are:
- Fixing a bug with audio which picking fruit.
- Fixing the start motion of the yellow enemies.
- Fixing the rendering of tiles near the edges.
- Adding the save slot option to the game instead of auto saving to the profile.
- Allow the user to exit the game via the controller.
- Adding option to make the fruit re-spawn.
Wednesday, February 18, 2015
Learning how to draw day 08
Hello there...
It has been a while since I last updated the draw manga application. I just added a move xy command which allows moving the cursor without drawing a line. Also, I fixed a bug in the call command.
So, you can now see a circle of heads using very small program. I think the next thing to do, is working on drawing side view of the head, later on, I should focus on drawing the body.
yours sincerely
mkaatr
It has been a while since I last updated the draw manga application. I just added a move xy command which allows moving the cursor without drawing a line. Also, I fixed a bug in the call command.
So, you can now see a circle of heads using very small program. I think the next thing to do, is working on drawing side view of the head, later on, I should focus on drawing the body.
yours sincerely
mkaatr
Friday, January 9, 2015
Learning how to draw day 07
Hello there...
In addition to this, I worked on a hair bitmap to be placed on the top of a head. The results of placing it looks like the following:
In the recent update of the manga creator application I added a repeat statement which allows repeating drawing commands easily. Check the result of this demo below:
Probably I should have made the eyes smaller, however that could be changed easily by modifying the drawing parameters. The next step is to add drawing ears, and nose option. In addition I must add the ability to add effects and calling other files.
Probably the most important feature is adding a set of commands like paint which allows doing every thing in a graphical manner rather than doing things via text. So far I noticed that doing things via text is really hard.
Overall I think reaching this result within 7 drawing/programming sessions is good. So, I think more powerful result could be done later on.
thanks for reading and have a nice day.
mkaatr
Tuesday, January 6, 2015
Learning how to draw day 06
Hello there guys...
For this day I added the ability of the program to insert images at different scales and rotation angles. Also I manged to define an acceptable shape of an eye and head layout using Gimp 2 and using Microsoft Surface. Now with only a number of commands I managed to create an acceptable face as can be seen below.
Why the eyes are kind of angry? Well, this is only the first style. I will have to add more eye styles later on in order to address that issue. Tomorrow I will start addressing how the hair should be rendered.
thanks for reading.
mkaatr
Sunday, January 4, 2015
Learning how to draw day 05
Hello there ...
Tomorrow I will start working on the first component , which is the eye. Of course there are many types of eyes, but I just need to create one as a start. So check out the updates for tomorrow.
yours
mkaatr
Today I added the rotation option to the drawing routines. So, now it is possible to create multiple copies of objects at different scales and at different rotation angles. Check out the results below:
Tomorrow I will start working on the first component , which is the eye. Of course there are many types of eyes, but I just need to create one as a start. So check out the updates for tomorrow.
yours
mkaatr
Saturday, January 3, 2015
Learning how to draw day 04
Hello there guys...
Today I added a simple feature, which is calling other draw routines. Using this feature, I can call a predefined draw commands like a function and instruct the program to draw that image at a different scale. The results can be seen below:
Today I added a simple feature, which is calling other draw routines. Using this feature, I can call a predefined draw commands like a function and instruct the program to draw that image at a different scale. The results can be seen below:
With few lines I managed to create these three faces at different scales and different colors. Next step is to add rotation options. So check out tomorrow to see how things turn out.
mkaatr
Friday, January 2, 2015
Learning how to draw day 03
Hi there...
Today I started with the Manga Creator app. I think it might take me a year till I get good results from it. Regardless, the idea behind it is to combine simple commands for drawing manga. I will try to make the features one at a time and add them to the app.
Today I only added the basic commands for drawing lines, circles, ellipses, filling, and setting drawing angles. Also I tried making an anime face using the app. Compared to my hand drawing, it looks okay. So check it out below:
As you can see, the results are still very primitive. However, this is only the very beginning. The next step is to create an acceptable rendering of an eye. Followed by that I will add a command to include the eye whenever I need, so the drawing of an eye will be like a function call, and the drawing of a nose the same, and so on.
So, check things here tomorrow and see how things turns out to be.
mkaatr.
Thursday, January 1, 2015
Learning how to draw day 02
Hello again...
In my continuous attempts to ruin your eyes, I created two images today but this time without a reference. So check out the results
In my continuous attempts to ruin your eyes, I created two images today but this time without a reference. So check out the results
You can see the problem with the first image is that I got the dimensions of the face wrong. Things are a little better in the second, but the problem is that the left eye is larger than the second.
In the end continuous practice make you improve.
Thanks for watching these horrible drawing. :)
Take care and have a wonderful day.
mkaatr
Wednesday, December 31, 2014
Learning how to draw day 01
It has been long time since I wanted to start drawing. I always wanted to make my own manga. Since I am a programmer, of course I had to think of making a manga drawing program. But how am I going to make a program like that and I don't know how to draw? This is why I deceived that I have to learn how to draw.
So my plan is simple. For a number of months I will try to draw manga every day. Probably something simple and post it here - posting here will be for you guys to laugh at it -. Hope you enjoy.
The first drawing gives the basic way to draw a head. I won't bore you with the details but rather let you see the final result that I did on my Galaxy Note 4:
Try not to stare at the image above for too long in order not to get permanent brain damage. The next step I went into was improving the eyes, so I ended up doing something like this:
I hope this post did not kill too many brain cells. Hope you enjoyed the first attempts.
Thanks for reading and have a happy new year.
yours
mkaatr
Wednesday, September 3, 2014
The Art of Complicating Things!!!
On 2011, I went to the embassy and started the paper work for my ID renewal. Only yesterday I managed to get my new ID after applying for renewal again because they lost the previous paper work. Below is the details of only one day.
What am I going to detail below is only one day of paper work.
What am I going to detail below is only one day of paper work.
- At 8:30 AM i was at the office.
- Took first queue to get the application form.
- Took the second queue for filling the application form.
- Took the third queue to get the file stamped, the employee did not check anything.
- Took the forth queue which took about an hour just to know that it was the wrong one.
- Took the fifth queue to get the form stamped again.
- Got the documents stamped by the forth queue employee
- Took the sixth queue to have the document stamped again.
- Delivered the paper work to the employee at the seventh queue and paid for the paperwork processing.
- A woman passed out because of the heat and because she was standing for so long.
- Received the document at 1:30 PM with the wrong name written - just perfect -, so I had to fix it - more paper work -.
- Went into the employee who is supposed to fix thing, and it turned out the employees are doing nothing because there is no electricity so they are all sitting in the dark.
- Employee A sent me to employee B
- Employee B, is not available at his office, so went back to A asking
- I was told to search for employee B
- Searched for employee B for over 15 minutes, and no one answers where could I find him, or were to wait for him, after that found that employee.
- The employee fixed the error and stamped the documents again.
Basically all these queues are not needed at all. All that is needed is one or two employees at max. It could be done as follows:
- The employee at the first queue could fill the application form - second queue job -, stamp the file - third queue job- , apply another stamp - forth queue job-, verify the document and apply the sixth queue stamp, and deliver the document for processing.
or
- Put all these employees in one room, and the job done by one is passed to the other. People do not have to carry all these documents and keep running all the time.
I think they are doing all of this simply because they pretend to be doing something. All these employees and it takes so long to get work done. Some people came at 6:00 AM, and got their documents at 1:00 PM. It is all just chaos.
How long does it take to renew your ID in your country?
Monday, September 1, 2014
Ranting about taxi drivers in Baghdad
Since coming back to Iraq, I have been taking taxis to and from work. Main reason is less stops, reduced time on the streets, which in turn means less risk in case an explosion happens.
I am a quiet person, so when I get to a taxi, I spend the whole trip to work thinking about work, or planning things to do for the day. This means I don't say anything at all, which in turn makes the taxi driver starts his own subject. The subject(s) I have to listen to could be one of the following:
I am a quiet person, so when I get to a taxi, I spend the whole trip to work thinking about work, or planning things to do for the day. This means I don't say anything at all, which in turn makes the taxi driver starts his own subject. The subject(s) I have to listen to could be one of the following:
- The checkpoints in the streets do nothing. You only get traffic jams, and the explosions happens every day.
- The government is corrupt ... blah blah blah.
- Have you seen the politician ... blah blah blah
- What has been happening in Iraq is a conspiracy done by ... blah blah blah
Basically every taxi driver is an expert on the subject of politics and you have to listen to him whether you like it or not. I don't mind people expressing their opinion on things, but I am
- So fed up with such subjects.
- Paid money for the ride only, not to listen to others.
- Don't care about other people opinions regarding politics simply because they come with nothing new or interesting, beside talking does nothing at all.
- It is all a waste of energy.
If you are from a different country could you tell me what is your experience when riding a taxi?
Friday, August 15, 2014
Pixel by pixel collision detection
Hello there ...
In the Army Defence Android Game, I had to implement a very simple collision detection method to tell if an enemy or if my tank was hit by a bullet or not. The technique works by finding out if the rectangle that the objects occupy collide with each other. This technique works well in general, and it is very fast, however one drawback of this method is that sometimes the bullet registers a hit when it does not touch the enemy.
A solution to this issue is using pixel by pixel collision detection. This means the game registers a hit if and only if two pixels from the two object are above one another. To implement this method I created byte array for storing what I call "a collision map". Simply put, if there is a visible pixel in the sprite/object texture, then 1 is stored at the corresponding location in the collision map. If there is not, zero is stored instead.
The first stage in implementing this method is writing a simple function that receives the texture, and extract the collision map for the object. A check on the Alpha value of the pixel is being used to determine if the pixel is visible or not, and hence if the value in the collision map should be 0 or 1. Next every time a the sprite sheet of an object changes, a variable for the collision map that represents the sprite sheet is updated. This helps identifying which collision map to use quickly. Finally the collision is detected.
For the collision detection, the old collision method is first applied. If no collision happened there, there is no need to perform pixel by pixel check because we are sure there is not pixel collision possible. Otherwise, the program calculates the number of pixels in each object, and selects the one with the fewer pixels. This is done to reduce the number of checks. Next a loop is done on every pixel in the selected object. If the pixel for that object is visible, then the location of the other object's pixel is determined, and if that is visible too, then we got a collision. The method could be summerized as follows:
- If Object1 and Object2 rectangles do not intersect, then return false.
- If number of pixels in Object1 smaller than Object2 then select Object1 otherwise select Object2
- Loop over every pixel location in the selected object
- If the pixel in the selected object is visible then
- Calculate the location of the corresponding pixel for the other object
- If pixel in the other object is visible return true.
- end if
- End loop
- Return false
Hope someone would find this useful.
Take care and have a wonderful day.
Sincerely yours
mkaatr
Wednesday, July 30, 2014
Developing "Army Defence", my second Android game.
Hi there guys...
In the last two or three weeks, I have been working on an Android game whenever I got some free time. The design of the new game is far more simpler than "The Escape". There is no screen scrolling, there is no tiles, and there is no need to generate a map using a map generator which I would need to build. I used many techniques that I learned when developing the previous game in the new one, and improved them a little.
The game itself is about defending yourself from attacks done by different types of airplanes as shown in the screen below.

The game consists of a number of stages. Starting with simple types of enemies and getting more difficult the more you progress. Also, I tried adding new type of enemies every stage or two to make the player curious about what to see next, and avoid repitition.
The tank can use auto file which allows you to focus on moving left and right only, while your tank shoots once every second or so, or if you like you could switch to manual, and fire at will.
So far I have done only 12 stages. You could every level in a minute or so. So far, you can only experience new enemies. Next I am adding upgrades to the tank such as increasing armour, or getting different fire power, etc.
I might publish this game on google play in the next day or so, and add more stages and upgrades as time goes on.
Unlike the previous game, adding more stages to this one is much easier because the stages are stored as text files, which are parsed at runtime. Also since each stage is short, it is not difficult to test the stage.
That is all for today.
yours sincerely
mkaatr
In the last two or three weeks, I have been working on an Android game whenever I got some free time. The design of the new game is far more simpler than "The Escape". There is no screen scrolling, there is no tiles, and there is no need to generate a map using a map generator which I would need to build. I used many techniques that I learned when developing the previous game in the new one, and improved them a little.
The game itself is about defending yourself from attacks done by different types of airplanes as shown in the screen below.
The game consists of a number of stages. Starting with simple types of enemies and getting more difficult the more you progress. Also, I tried adding new type of enemies every stage or two to make the player curious about what to see next, and avoid repitition.
The tank can use auto file which allows you to focus on moving left and right only, while your tank shoots once every second or so, or if you like you could switch to manual, and fire at will.
So far I have done only 12 stages. You could every level in a minute or so. So far, you can only experience new enemies. Next I am adding upgrades to the tank such as increasing armour, or getting different fire power, etc.
I might publish this game on google play in the next day or so, and add more stages and upgrades as time goes on.
Unlike the previous game, adding more stages to this one is much easier because the stages are stored as text files, which are parsed at runtime. Also since each stage is short, it is not difficult to test the stage.
That is all for today.
yours sincerely
mkaatr
Subscribe to:
Posts (Atom)












