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:

 This one seems good. So instead of redrawing it, I became lazy and used copy and paste to end up with the following:
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.



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.

  • 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.
  • 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:

  • 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
  1. So fed up with such subjects.
  2. Paid money for the ride only, not to listen to others.
  3. Don't care about other people opinions regarding politics simply because they come with nothing new or interesting, beside talking does nothing at all.
  4. 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


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