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.


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.

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


Friday, January 9, 2015

Learning how to draw day 07

Hello there...

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:

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:

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.