Thursday, April 21, 2011

Almost completed

Ok, my game is almost complete, at least the main idea, interaction and elements required (graphics, sounds, gameplay, etc), during the last 3 hours I created the level system, an explosion animation (I didn't find an animation that suites my needs so I need to create it from scratch using gimp and imagination), I also added sounds.

In Addition, my tester (my 4 years old son) did a test and I think it worked as expected, everytime he see me on the computer ask to play the game again and again... the magic is done!

Now I need to work on the following things:

1. The health of the UFO
2. The health of the player
3. The fight back from the UFO (easy with the engine I created)
4. An score system.
5. More sounds.

At this rate I think I will finish my first game in 1 week (or less if I have time during my vacations).

I'm very happy with the current results and I will share some demos of the code (not the one used in the game, but I will manage to create some demos of how I used SDL in my first game).

Tuesday, April 19, 2011

Week 2 Results

Then game is going pretty well and Im starting to love this new career, the results are very good (from my limited and biased point of view) and I want to share the results that I got till now,

Game Engine:

The main idea of a game engine is to create something that you could reuse easily on other projects and avoid the creation of the code from scratch everytime, my 2d game engine has the following features:

  • Image loads (maps, sprites, etc)
  • Movement (gravity and simple movement from left to right)
  • Event managed in a proper way
  • main loop routine
  • Collision detection

So far this is a very good result for the second week of work. But I didn't start this from scratch, the www.sdltutorials.com was a very good help in order to understand where I needed to start from.

Game Content:

This was a little bit difficult, I changed my mind several times about how the game will be, cause everytime you see the screen you want something different, it's hard to keep the original idea because you see how the gameplay will be and then you will change the way you thought it's going to work at the first place, but anyway... that's the idea, improve, adapt and get the best from the game.

Most of the spend time was trying to figure out how to create the images you need to put on screen, I tried to create them from scratch but was a big failure, that's why I decided to google a little bit and found some images that I could modify to create the background of my game, also the ufo was taken from a picture found at google, removed the background and get the ufo out of the picture, the cannon was harder but I found a nice place with tons of sprites that I could use (I will post his link in here later), the missil was created from scratch using inkscape (very good tool).

The mathematics was a little bit tricky but finally I managed to create the cannon effect of following the ufo and also the missil will goes into the direction of the UFO's center.

The results of the second week were saved in a video



Hope you liked the progress and if you have any questions I will be glad to answer them.

Shoot the missil: Maths in action!

I came across a problem these days, how can I send a bullet right into the direction of another target, here's when you need to get back into the school and use your Pythagorean theorem knowlegde,

After spending some hours trying to solve a simple equation I realized that I've to get back to the math books, I found a very good discussion about this subject in yahoo answers what you need to know about maths in order to create games.

Ok, I wasted 2 hours into this equations and then remembered something (very blur btw) about vectors, how they should be used to move a point into the direction of a line (vector), that's how I crossed with this: http://www.gamedev.net/topic/600086-find-point-between-2-points/ actually the problem was very easy to solve:


p1x=1;
p1y=1;
p2x=4;
p2y=4;

dirx=p2x-p1x;
diry=p2y-p1y;

p3x = p1x+dirx*0.25;
p3y = p1y+diry*0.25; 

First you need to find the direction of the vector, you get that doing a substraction between the 2 points (x2, y2) - (x1, y1), now that you have the direction you should apply it to the new point and that's it. easy right?

Now my game has a beatiful rocket moving into the direction of the UFO, one step further in the game creation.

Thursday, April 14, 2011

Week 2: The engine is ready and I'm working on the graphics

The last week was amazing, I thought was going to be harder to create a game, but thanks to sdltutorials.com the engine was created in 2 days, and I started to work on the character interactions.

The first thing I noticed is that the game is not going to be what I started with, actually is very different from the sketch I created 1 week ago, that's because everytime you see the screen working you change your mind and want something new, at this moment the game is going to keep it's scent but several details has been changed from the original idea (things like how the cannon will shoot, when will be the user dead, etc etc).

After the plot of the game was created I started to learn I little bit about sprites, and how they worked, this is very easy subject, but the animation... that was a very different history, I tried to create my own sprites and was a great failure, that's why I started to look for some free sprites in order to avoid this work.

This is how the screen looks like at this moment:


The cannon follows the ufo and the ufos moves as expected. I had to remember how the angles worked and what is all about cos, sin, tan etc that I saw at school and put under the bed a very long time ago, I'm realizing that I need to study very hard mathematics, my brain has some "rusty" at this moment, but anyway I will need to get my mathematics book and put in shape again.

My accomplishments this week:

1. Engine created
2. Basic graphics created
3. Basic movement of the UFO and cannon working

Next week...

1. Cannon shooting
2. UFO crashing and burning

The main idea of the graphics are settled, and I think I will post a video on youtube with the current animation that way you will give an idea of how the animations are, anyway as always I will keep the game idea hidden.

Tuesday, April 5, 2011

Learning SDL

I'm really impressed about how easy is to use the SDL library in order to create your games, I followed the tutorials Basic, Coordinates and Blitting, events and the tic tac toe sample from http://www.sdltutorials.com and it's really simple and straighforward, actually I though it will be harder, but the explanation was amazing an I understood everything in minutes, the examples ran very well and I'm really thinking that this is piece of cake, the game is on its way to sucess.

Here's the result:


I will finish all the tutorials of sdltutorials and then I will start the game I'm planning, but I think everything will be set when the animation tutorial finishes (and that will be tomorrow), I will spend sometime understanding how the collision system works but I will not need it in my first game.

After this tutorials the next step will be the graphics, that will be easier because I've some experience using graphics tools, and I dont think will face any problems in this area.

Step 2: API decision OpenGL or DirectX

This step is a little hard, I need to choose what will be the API I will use to create my first game, in the future I will learn both but I need to start with something, this time I will focus my decision on the following principles:

1. I want to learn how to work with games (both will be handy for this)
2. The game is fairly easy and will not require tons of hardware/software to run, so I don't care which one is faster/better than the other.
3. I usually in love with the open source/freedom and dont like to be pressured to use something
4. The game will run mainly on desktop machines (Windows, Linux or Mac), some of the games will use the keyboard/mouse to run.

After reading this article http://blog.wolfire.com/2010/01/Why-you-should-use-OpenGL-and-not-DirectX I decided that my first API will be OpenGL, and I will try to see how to use the MVC pattern in games in order to abstract the API usage, if I can achieve to run the game using directx and opengl will be great, but my first game will be as easy as it could, that's why I will not shoot myselft if I cannot manage to run it on directx too.

Ok, decision made, now is time to read a lot of OpenGL, to my advantage I have some knowledge about Qt so I could use the Qt-OpenGl interface and speed up the process, let's see how it works.

Monday, April 4, 2011

Step 1: The game plot

Here's the easy part, you should figure out a game idea and put it on paper, that's my first step in this journey.

In order to avoid any further problems I will say little about the game, instead I will put some of the key points of the things you should list in order to start the game:

1. What is the audience of your game? in my case I will create a game for kids between 4 and 5 years, why? because my boy has that age, and the games for kids are a little bit easy, catchy and does not required full 3D render in order to catch their attention, also I think the educational games are the best, if you're going work for free then why not give something to the world?
2. What is the game for? what is the idea of the game? here's the hard part, if you want to teach something (like I want) then you need to know how to teach that, here I will base the game on some other games that does something similar, I will create an idea based on some letters games I saw sometime ago and I will put some ideas together in order to create an original game.
3. The sketch: here you will put your idea on simple graphics, could be on a paper or in the computer, that does not matter, this will help you to realize if the game will be playable and your idea makes sense. I created some simple graphics using inkscape.

Ok, here's the first part, the next post will be about the articles you should read, the exercises you will need to face in order to start with your knowledge base.

Starting with Game Development - Journey

Ok, here I'm, tired of doing the same thing over and over again, stuff that uses/saves something in a database, support a business and get the people rich... I'm tired of the same job, that's why I decided to give a little turn in my life, change and start doing the thing that put me on the development lane at the beginning... THE GAMES!

Most of us started at development when we were young and wanted to know how the games worked, we hacked some of them, changed the fixed texts to include words like "tits", "ass", etc... that was for fun, and started to realized that making games was the thing you want to do for the rest of your life... in some point something changed, you had to pay bills, and raise kids, etc... and you got stuck in the DB/related programming world.

Now that I realized that I want to be in the original path, I'd a good background in development, I'm Java Architect, had some certifications, 15+ years of programming experience in java, c++, delphi, VB6, C-sharp, etc etc etc etc... so I will start to record my progress in the game world, and now... I noticed that I don't have a clue of how to start, thats why I will do it from scratch, I'm reading some guides, and I will post some of them in here, I will record my steps on how to build games and how to start in this world. I'm starting with this so I will do a log and document how everything goes, in 1 or 2 years I will read this again and I will say: "I made it!, I'm not doing DB stuff anymore, I'm a game developer, and the people will say... Oh man, that's why I started in development, I envy your life" or maybe I could say: "It's a shame I started and now I know this is not funny at all, but at least I did it", lets see how this end.